latex-architect
LaTeX document standards on TeX Live 2026 — latexmk-only builds, preamble and package-order discipline, biblatex + biber bibliographies, semantic cross-references (cleveref, siunitx, booktabs), float
Files4
View on GitHubSKILL.mdskills/languages/latex-architect/SKILL.md
GitHubLaTeX Architect
LaTeX conventions for documents you control — papers, reports, theses, preprints. Targets TeX Live 2026 with pdfLaTeX as the default engine and latexmk as the only build entry point. Full skeletons (project tree, .latexmkrc, preamble, CI workflow, .gitignore) live in RECIPES.md; pinned versions in STACK.md.
Venue-specific formatting (page limits, anonymization, conference style files) is not this skill's job — see ml-conference-paper-architect.
1. Scope & defaults
| Decision | Default | Switch when |
|---|---|---|
| Distribution | TeX Live 2026 | Never for CI. Use Tectonic for hermetic/reproducible builds where package coverage allows |
| Engine | pdflatex |
lualatex when you need system fonts, real Unicode input, or microtype-heavy typography. xelatex only for legacy font pipelines |
| Build driver | latexmk |
Never |
| Bibliography | biblatex + biber |
Venue templates that ship natbib — see §8 |
| Document classes | article, report, book, institutional thesis classes |
— |
Never hand-run pdflatex twice. Rerun logic (cross-refs, bibliography, ToC convergence) is exactly what latexmk exists to solve. A build recipe that calls pdflatex && biber && pdflatex && pdflatex is a bug waiting to happen — it silently under-runs on the documents that need a fourth pass.
2. Project layout
One file per chapter or section, assembled by \input from a thin root file. The root holds the preamble and the \input list and nothing else — this keeps merge conflicts confined and lets you comment out a chapter with one line while drafting.
main.tex— documentclass, preamble,\inputlist only.sections/(orchapters/) — one.texper unit, no preamble, no\documentclass.figures/— source images.tables/if tables are large enough to warrant their own files.refs.bib— one bibliography database. Split only past ~200 entries.preamble/— split the preamble intopackages.tex+macros.texonce it passes ~100 lines.
Rules that make this survive collaborators:
\inputover\includeunless you specifically need\includeonlyand per-chapter.auxfiles (long theses).\includeforces a page break;\inputdoes not.- No file extensions in
\includegraphics—\includegraphics{figures/plot}lets the engine pick.pdfover.png. Hardcoding.pnglocks you out of vector output. - Forward slashes and relative paths only.
C:\Users\...or\graphicspathwith absolute paths breaks every other machine, including CI. - Vector figures (PDF/EPS) for anything plotted. Raster only for photographs, at 300 dpi minimum.
Tree and root-file skeleton in RECIPES §1.
3. Build
.latexmkrc committed at the repo root is the contract — it encodes the engine, the bibliography backend, and the output directory so that latexmk alone reproduces the build on any machine and in CI. Nobody should need to remember flags.
- Build into
build/($out_dir), never the source tree. Keepsgit statusclean and makes cleanup a directory delete. - Set
$pdf_modeand$bibtex_useexplicitly rather than relying on latexmk's defaults. latexmk -Cfor a full clean;-cleaves the PDF.- Commit
.latexmkrc; gitignorebuild/and every generated artifact (.aux,.bbl,.fls,.synctex.gz, …). Exception: journals that demand a.bblin the submission tarball — generate it at submission time, don't track it.
.latexmkrc and .gitignore in RECIPES §2.
4. Preamble discipline
Package order is load-bearing, not stylistic. The canonical order:
- Encoding/font:
fontenc(T1) +lmodern, orfontspecunder lua/xelatex. - Layout:
geometry,setspace. - Math:
amsmath,amssymb, thenmathtools(which patches amsmath and must follow it). - Content:
graphicx,booktabs,siunitx,listings/minted. - Bibliography:
biblatex. hyperrefsecond-to-last — it redefines a large surface of internal commands and must see the final versions.clevereflast — it must load afterhyperref. This one ordering constraint causes more silent breakage than any other.
Additional rules:
microtypealways. One line, measurably better justification and fewer overfull boxes. There is no reason to skip it.- Define semantic macros, not visual ones.
\newcommand{\model}{\textsc{Orion}}survives a rename;\newcommand{\bs}{\boldsymbol}just aliases a primitive and buys nothing. \newcommandover\def— it errors on redefinition instead of silently clobbering a package's internals.- No
\usepackage{times},{mathptmx},{pslatex}— obsolete font packages. Usenewtxtext/newtxmathif a Times clone is mandated. - Don't load
inputencunder LuaLaTeX/XeLaTeX (UTF-8 is native), and don't loadsubfigureever — it has been deprecated for two decades in favor ofsubcaption.
Preamble skeleton in RECIPES §3.
5. Semantic markup
The rule underneath all of these: write meaning, let packages render it. Anything you type as literal formatting becomes a manual-update liability when the document is restructured.
\cref/\Cref(cleveref) over hand-writtenFigure~\ref{...}. The package emits the right word and the right capitalization, and\cref{fig:a,fig:b}handles ranges and lists automatically. Never write the word "Figure" next to a\refby hand.\labelimmediately after\caption, never before — a label placed before the caption picks up the enclosing section's counter instead of the float's, producing references to the wrong number with no error.- Label prefixes by type:
fig:,tab:,eq:,sec:,alg:,app:. Makes\crefmisuse visible on sight. siunitxfor every number with a unit —\SI{9.8}{\meter\per\second\squared},\num{1e-3}. Consistent spacing, correct minus signs, and one place to switch decimal separator.booktabsrules only (\toprule,\midrule,\bottomrule). No\hline, no vertical rules — vertical rules in tables are a typographic error, not a preference.~before every reference and citation (Figure~\ref,Smith~\cite{x}) to prevent a line break between the word and its number.- Quotes:
`single'and``double'' `` — never the"` character, which renders as two right-quotes. - Dashes:
-hyphen,--numeric range,---em dash.
6. Floats
- Placement specifier
[t]or[tb]. Never[h]alone (LaTeX may ignore it entirely) and never[H]unlessfloatis loaded and you have a real reason — forcing exact placement fights the algorithm and produces half-empty pages. - Reference every float in the text before it appears. A float nothing points to has no defined position in the reading order.
- Caption above tables, below figures. This is convention, not taste; follow it unless a venue's style file overrides.
- One
\centeringinside the float environment, not\begin{center}— the latter adds vertical space that misaligns the float. - Fighting float placement at draft stage is wasted effort. Write first; place at the end, when the text is final.
7. Math
\[ ... \]orequation/align. Never$$— plain-TeX$$breaksamsmathspacing andfleqn.eqnarrayis banned — broken spacing, known bug. Usealign.alignfor multi-line,splitinsideequationfor one numbered equation across lines,gatherfor unrelated centered lines.- Don't number equations you never reference. Use the starred forms (
align*,equation*). \text{}(amsmath) for words inside math, not\mboxor bare italics.- Operator names:
\newcommand{\argmax}{\operatorname*{arg\,max}}, not\text{argmax}— spacing and limit placement differ.
8. Bibliography
Default: biblatex + biber. Unicode-correct sorting, real field handling, \autocite and friends, no .bst archaeology. Set backend=biber explicitly.
- One
.bibfile, entries keyed consistently (author-year-keyword), exported from a manager (Zotero/JabRef) rather than hand-typed. - Clean the exported entries. Publisher exports carry wrong-cased titles, missing DOIs, and arXiv preprints for papers that were later published in a venue — cite the published version.
- Protect capitals with braces in titles:
{B}ayesian,{L}aTeX. Style files that lowercase titles will mangle proper nouns otherwise. \autocitefor the common case;\textcitewhen the author is part of the sentence.
natbib carve-out. Conference and journal templates ship their own .sty with natbib wired in and a matching .bst. Do not convert them to biblatex — you break the venue's citation rendering and risk desk rejection. In that case: keep natbib, use \citep/\citet, and run bibtex (set $bibtex_use = 2 in .latexmkrc). The rule is scoped by ownership: your document, biblatex; their template, whatever it ships. See ml-conference-paper-architect for the venue side.
biblatex config and both .latexmkrc variants in RECIPES §4.
9. Quality gates
chktex— lints for the mechanical errors above (missing~,$$, bad quotes, space after abbreviations). Run it in CI; suppress specific warnings with a committed.chktexrc, never by disabling the tool.latexindent— deterministic formatting. Commit.latexindent.yamland run in pre-commit so diffs stay reviewable.- Zero tolerance for
Overfull \hboxover ~5pt in the final pass. Fix by rewording, not by\sloppy. \usepackage[l2tabu, orthodox]{nag}while drafting — warns on obsolete commands directly during compilation. Remove before submission.- CI builds the PDF on every push and uploads it as an artifact. A LaTeX repo where
maindoesn't compile is worse than useless, and it's a 20-line workflow. - One sentence per line in source. Line-level diffs become sentence-level diffs, making review and merges tractable. Never reflow paragraphs — it produces diffs nobody can read.
CI workflow and latexindent config in RECIPES §5.
10. Banned constructs
Each of these has a correct replacement and no legitimate use in a new document:
| Never | Instead | Why |
|---|---|---|
\\ to end a paragraph |
blank line | \\ breaks the line without paragraph spacing or indentation logic |
$$ ... $$ |
\[ ... \] |
Breaks amsmath spacing |
eqnarray |
align |
Known-broken spacing |
\hline in tables |
booktabs rules |
Cramped, no vertical padding control |
subfigure |
subcaption |
Deprecated, conflicts with caption |
\bf, \it, \rm, \sc |
\textbf, \textit, … |
LaTeX 2.09 syntax; doesn't nest |
\vspace / \hspace for layout |
fix the underlying spacing | Hand-tuned space breaks on any reflow |
\centerline |
\centering |
Plain TeX; ignores paragraph parameters |
\sloppy to fix overfull boxes |
reword the sentence | Trades one visible defect for worse inter-word spacing |
Absolute paths in \includegraphics |
relative paths | Breaks on every other machine |
11. Out of scope
- Venue formatting (page limits, anonymization, camera-ready toggles, conference
.styfiles) → ml-conference-paper-architect - Presentations / beamer → demo-presentation-architect for deck content design, reveal-js-architect for HTML decks
- URU institutional formats (Word-targeted
.mdspecs) → uru-thesis-architect, uru-scientific-paper-architect - Repo tooling (task runner, pre-commit wiring, version pinning) → repo-tooling-architect
- CI pipeline design beyond the build job → ci-cd-architect