v1.4.1 — LaTeX rendering fixes: table overflow, Python listings, learning-paths diagram
Three rendering bugs found while proofreading the compiled PDF, all fixed
at the generator level (build/build_latex.py) rather than by hand-patching
generated .tex:
- Tables overflowing the page margin.
simplify_tables()converted Pandoc’slongtable+wrapping-p{width}columns to a plaintabular, but discarded the width info and emitted bare non-wrappinglcolumns — long cells (e.g. the universal-property table in Chapter 1 §5) ran off the right edge instead of wrapping. Now preserves Pandoc’s ownp{...}widths (brace-depth aware, since the width expression itself contains a nested\real{...}group), with an equal-width fallback for tables with no width info at all. The same function also left\bottomrulesitting between the header and body (where longtable’s\endlastfoothad declared it) instead of after the last row — fixed to relocate it. Affects all 14 tables across 8 files. - Python code listings silently styled as Lean. A case-mismatch bug
(
build_latex.pymatched[language=python], but Pandoc always emits[language=Python], capitalized) meant,style=pythonwas never appended, so all 8 Python listings in the book inherited Lean’s tactic keyword list andtabsizeinstead oflean-listings.tex’s own\lstdefinestyle{python}. Fixed the match to Pandoc’s actual output. - Learning-paths dependency graph was purely linear, encoding none of
the four named reading paths’ actual skips. Added the two genuine
skip points as dashed edges (the other two named paths change how a
chapter is read, not which chapters are read, so they stay prose-only):
Chapter 1 split into §1-3/§4-5 sub-nodes with a dashed bypass to Chapter
2 (and a second bypass from Chapter 4 to Chapter 6, skipping Chapter 5)
for “I already know Lean,” and a dashed Chapter 0 → Chapter 6 bypass for
“I want to see Lean do real mathematics as fast as possible.” Applied to
both
learning-paths.md’s Mermaid source and the hand-authoredtikz-cddiagram (re-verified via its standalone compile smoke-test before the full rebuild). - Also fixed a pre-existing blank-page bug:
bookclass’s default\cleardoublepage(used before every\chapter, sincebookdefaults toopenright) doesn’t set\thispagestyle{empty}on the blank page it inserts, so those pages showed the running header rule and page-number footer despite having no content. Redefined it to blank those pages properly. - New verification habit:
xelatex’s compile log already reports every margin overflow viaOverfull \hbox (Npt too wide)warnings — grepping the log and filtering to anything above a few points catches this whole bug class across all ~230 pages systematically, instead of relying on spot-checking rendered pages by eye. All large-magnitude overflows (previously up to ~600pt, from the table bug above) are now gone.