Files
coursebook/main.tex
T
Lawrence Angrave 8ce9fc0ab8 Make PDF build fail on real LaTeX errors; fix accumulated hidden errors
The Makefile used '-' prefix on recipe lines, '-f' (force past errors),
and output redirection to /dev/null, making the PDF build incapable of
failing. latexmk already returns exit code 0 for warnings (overfull
hbox, undefined refs, font substitution) and 12 for real errors, so
the fix is to stop suppressing that exit code.

Makefile changes:
- Remove '-' prefix so make propagates latexmk's exit code
- Remove '-f' so latexmk stops at the first error (fail-fast)
- Remove '2>&1 >/dev/null' redirect so output is visible
- Keep -interaction=nonstopmode (prevents hanging on errors)
- Keep -quiet (clean logs on success)
- Add grep of the .log for '^! ' lines on failure so the actual
  error is visible in CI output without needing the log file
- Clean up .tmp file on chapter build failure

The stricter build uncovered pre-existing errors hidden for years:

Preamble (prelude.tex):
- color option clash: xcolor loaded, then color with options
- xtopmargin/xbottommargin: invalid listings options
- lstlisting redefinition: \lstnewenvironment on existing environment
- minted {m}: wrong argument specifier, should be [1]
- \tightlist: used 36 times, never defined

main.tex:
- Duplicate minted definition removed (already in prelude.tex)

Source files:
- Unescaped & in \keyword{} (appendix, synchronization)
- \n as undefined control sequence in \keyword{} (introc, networking)
- \0 in text mode (introc/c_memory_model)
- \? as undefined control sequence (introc/language_facilities)
- \backslash in text mode, should be \textbackslash (introc/common_bugs)
- Standalone \\ before \begin{center} (synchronization, signals, appendix)
- language=golang: not a listings language, should be Go (appendix)
- language=console: not a listings language, removed (introc, introduction)

signals/signals.bib:
- Unescaped _ in title field broke bibliography rendering
2026-08-24 03:49:48 -05:00

90 lines
2.2 KiB
TeX

\documentclass[hidelinks,10pt]{book}
%% Differentiate out the prelude to use in standalone markdown builds
\input{prelude.tex}
% Set up glossaries here so they aren't generated in each
\usepackage[toc,section=chapter]{glossaries}
\input{glossary.tex}
\makeglossaries
% Define and set styles so not injected into the markdown
% Pandoc chokes while processing the following, so put them here
\lstdefinestyle{cstyle}
{
language=C,
showspaces=false,
showtabs=false,
breaklines=true,
showstringspaces=false,
breakatwhitespace=true,
tabsize=4,
commentstyle=\color{comment}\itshape,
stringstyle=\color{red}\bfseries,
basicstyle=\ttfamily,
keywordstyle=\color{purple}\bfseries,
otherkeywords = {;,<<,>>,++,<,>,\#include,\#define},
morekeywords = [2]{;,\#include,\#define},
keywordstyle = [2]{\color{blue}\bfseries},
morekeywords = [3]{<<, >>},
keywordstyle = [3]{\color{yellow}},
morekeywords = [4]{++},
keywordstyle = [4]{\color{teal}},
morekeywords = [5]{<,>},
keywordstyle = [5]{\color{yellow}},
literate={\{}{{\CodeSymbol{ \{}}}1
{\}}{{\CodeSymbol{\}}}}1
}
\lstset{language=C,style=cstyle}
%% Spacing
\titlespacing*{\section}
{0pt}{5.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
\titlespacing*{\subsection}
{0pt}{5.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\titlespacing*{\subsubsection}
{0pt}{5.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
%% PDF Sizes
\titleformat*{\section}{\LARGE\bfseries}
\titleformat*{\subsection}{\Large\bfseries}
\titleformat*{\subsubsection}{\large\bfseries}
\titleformat*{\paragraph}{\large\bfseries}
\titleformat*{\subparagraph}{\large\bfseries}
%% Go to the next page if a section only has 3 lines
\widowpenalties 3 10000 10000 0
\usepackage{tocloft}
%% Add some space to the table of contents justification
\addtolength{\cftsecnumwidth}{10pt}
%% Epub command
\ifcsname ifepub\endcsname\else
\expandafter\let\csname ifepub\expandafter\endcsname
\csname iffalse\endcsname
\fi
\begin{document}
\raggedbottom
%% The title so that it isn't included in the chapters
%% Introduction, background, then the book starts
\setcounter{chapter}{0}
\frontmatter
\include{title}
\fancyhf{}
\mainmatter
\input{order.tex}
%% Add glossaries back in when a number of terms have been defined
%% \printglossaries
\end{document}