Files
coursebook/prelude.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

134 lines
3.5 KiB
TeX

\usepackage[T1]{fontenc}
\usepackage{microtype}
\usepackage[charter]{mathdesign}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=.9in,
top=1.0in,
bottom=1.5in,
right=.9in,
}
\setlength{\columnsep}{.5in}
\usepackage{fancyhdr}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{mdframed}
\usepackage{setspace}
\usepackage{mfirstuc}
\usepackage{graphicx,changepage}
\usepackage{pgffor}
% For development
\usepackage{comment}
% Make hyperrefs work
\usepackage{hyperref}
% Set up bibliography
\usepackage[semicolon,square,sort&compress,sectionbib,numbers]{natbib}
% Chapter by chapter bib
\usepackage{chapterbib}
% Set up source code highlighting
\usepackage{listings}
\lstset{
basicstyle=\ttfamily,
columns=flexible,
breaklines=true
}
\definecolor{greencomments}{rgb}{0,0.5,0}
\definecolor{redstrings}{rgb}{0.9,0,0}
\definecolor{mygreen}{rgb}{0,0.6,0}
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
\definecolor{mymauve}{rgb}{0.58,0,0.82}
\definecolor{foreground}{HTML}{4D4D4C}
\definecolor{background}{HTML}{FFFFFF}
\definecolor{selection}{HTML}{D6D6D6}
\definecolor{line}{HTML}{EFEFEF}
\definecolor{comment}{HTML}{8E908C}
\definecolor{red}{HTML}{C82829}
\definecolor{orange}{HTML}{F5871F}
\definecolor{yellow}{HTML}{EAB700}
\definecolor{green}{HTML}{718C00}
\definecolor{aqua}{HTML}{3E999F}
\definecolor{blue}{HTML}{4271AE}
\definecolor{purple}{HTML}{8959A8}
\definecolor{window}{HTML}{EFEFEF}
% Has to be name shadecolor
\definecolor{shadecolor}{HTML}{EEEEEE}
\usepackage{framed}
\newcommand{\CodeSymbol}[1]{\textcolor{red}{#1}\bfseries}
\lstset{aboveskip=20pt,
belowskip=20pt,
xleftmargin=1.5cm,
xrightmargin=1.5cm,
framexrightmargin=.5em,
framexleftmargin=.5em,
frame=bt,
framextopmargin=5pt,
framexbottommargin=5pt,
backgroundcolor=\color{shadecolor},
rulecolor=\color{shadecolor},}
% Define syntax highlighting style
\usepackage{listings}
% set up quotes
\usepackage{epigraph}
\renewcommand{\epigraphrule}{0pt}
\setlength{\epigraphwidth}{.6\textwidth}
\renewcommand{\textflush}{flushepinormal}
\makeatletter
% Taken and updated from http://mirrors.ctan.org/macros/latex/contrib/epigraph/epigraph.dtx
\renewcommand{\@epitext}[1]{%
\begin{minipage}{\epigraphwidth}\begin{\textflush} \hspace*{30pt}#1\\
\ifdim\epigraphrule>\z@ \@epirule \else \vspace*{-.5\baselineskip} \fi
\end{\textflush}\end{minipage}}
\makeatother
% Define titles and chapter
\usepackage[Bjornstrup]{fncychap}
\singlespacing
\title{\vspace{-15mm}\fontsize{24pt}{10pt}\selectfont\textbf{CS341 System Programming Coursebook}}
\date{}
% define custom environments, so we can change global style at will
\newcommand{\keyword}[1]{\underline{\smash{\textbf{\texttt{#1}}}}}
\newcommand{\todo}[1]{}
\renewcommand{\todo}[1]{{\color{red} TODO: {#1}}}
\providecommand{\tightlist}{\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
% For pictures
\newenvironment{proof}{\begin{shaded*}\paragraph{Proof:}}{\hfill$\square$\end{shaded*}}
\newenvironment{tableau}{\begin{shaded*}\begin{longtable}}{\end{longtable}\end{shaded*}}
\usepackage{wrapfig}
% 100/90/10/77
\definecolor{titlepagecolor}{cmyk}{1,.9,.1,.77}
\definecolor{linecolor}{cmyk}{.01,.83,.84,0}
\definecolor{namecolor}{cmyk}{1,.50,0,.10}
%-----------------------------------------------------------------
\usepackage{csquotes}
% this is a terrible hack, but pandoc sucks
% we have to call any
\lstnewenvironment{minted}[1]
{\noindent\minipage{\linewidth}\medskip
\lstset{basicstyle=\ttfamily\footnotesize,frame=single,language=#1}}
{\endminipage}
\usepackage{float}
% title spacing
\usepackage[compact]{titlesec}
\renewcommand{\baselinestretch}{1.15}