%============================================================================== % preamble.tex — packages and configuration (single source of truth). % Edit setup HERE, not in main.tex. Grouped by purpose; each line commented. %============================================================================== % ---- Encoding, font, micro-typography -------------------------------------- \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{lmodern} % Latin Modern outlines: same look as default CM, but % vector (crisper at every size, no substitution warnings) \usepackage{iftex} % detect engine (pdfTeX vs xetex/luatex e.g. tectonic) \ifPDFTeX % pdfTeX: full protrusion + expansion (unchanged) \usepackage[activate={true,nocompatibility},final]{microtype} \else % xetex/luatex: font expansion is pdfTeX-only -> protrusion only \usepackage[protrusion=true,final]{microtype} \fi % ---- Page geometry --------------------------------------------------------- \usepackage[margin=1in]{geometry} % ---- Quiet typographic polish (subtle; every line is safe to delete) ------- \linespread{1.05} % a little more leading (set 1.0 for tight page limits) \frenchspacing % uniform inter-word spacing (no wide gap after '.') \widowpenalty=10000 \clubpenalty=10000 % forbid single lines stranded at page breaks \setlength{\emergencystretch}{3em} % fewer overfull lines in justified text % ---- Authors & affiliations ------------------------------------------------ \usepackage{authblk} % \author[1]{...}\affil[1]{...} for multi-author \renewcommand\Affilfont{\small} % affiliations a touch smaller than the names % ---- Core mathematics ------------------------------------------------------ \usepackage{amsmath} \usepackage{amssymb,amsfonts} \usepackage{mathtools} % \DeclarePairedDelimiter, \coloneqq, \vcentcolon, ... \usepackage{bm} % \bm — bold math symbols, including Greek \usepackage{nicefrac} \allowdisplaybreaks % allow long aligned displays to break across pages % ---- Theorems (environments defined in theorems.tex) ----------------------- \usepackage{amsthm} % thm-restate is loaded in main.tex AFTER theorems.tex: this MiKTeX's thmtools patches \newtheorem % in a way that breaks shared-counter definitions ("\c@ already defined"). Plain-amsthm % definitions first, thm-restate after, keeps {restatable} fully functional (verified minimal repro). % ---- Figures, tables, algorithms ------------------------------------------- \usepackage{graphicx} \graphicspath{{figures/}{./}} % find images in figures/ \usepackage{booktabs} % \toprule \midrule \bottomrule \usepackage{multirow,makecell,array} \usepackage[font=small,labelfont=bf]{caption} % restrained, bold-label captions \usepackage{subcaption} % subfigures (load after caption) \usepackage{algorithm} \usepackage{algpseudocode} % algorithmicx pseudocode % ---- Lists ----------------------------------------------------------------- \usepackage{enumitem} \setlist[itemize]{leftmargin=2.2em,itemsep=2pt,topsep=2pt} \setlist[enumerate]{leftmargin=2.2em,itemsep=2pt,topsep=2pt} % ---- One named colour palette (reused for links, citations, notes) --------- \usepackage{xcolor} \definecolor{LinkColor}{rgb}{0.10,0.40,0.75} % internal references \definecolor{CiteColor}{rgb}{0.70,0.25,0.20} % citations \definecolor{UrlColor} {rgb}{0.20,0.50,0.50} % external URLs \definecolor{TodoColor}{rgb}{0.80,0.30,0.10} % draft notes % ---- Diagrams -------------------------------------------------------------- \usepackage{tikz} \usetikzlibrary{positioning,calc,arrows.meta} % ---- Citations (natbib author–year; \citep / \citet) ----------------------- \usepackage[round,sort&compress]{natbib} % ---- Hyperlinks & cross-references ----------------------------------------- \usepackage{url} \usepackage{hyperref} \hypersetup{ colorlinks=true, linkcolor=LinkColor, citecolor=CiteColor, urlcolor=UrlColor, breaklinks=true, bookmarksnumbered=true, } \usepackage{bookmark} % robust PDF bookmarks % cleveref is loaded in main.tex after theorems.tex + thm-restate (cleveref always last); the % explicit \crefname declarations (crefnames.tex) keep names independent of load order. % ---- Equation numbering (consistent: numbered within each section) --------- \numberwithin{equation}{section} % ---- Draft mode: line numbers + visible TODO notes (off by default) -------- % Flip to \drafttrue while writing/reviewing; \todo{...} then prints in red. \newif\ifdraft \draftfalse \ifdraft \usepackage{lineno}\linenumbers \newcommand{\todo}[1]{\textcolor{TodoColor}{\textbf{[TODO:}~#1\textbf{]}}} \else \newcommand{\todo}[1]{} % notes vanish in final builds \fi