infra: LaTeX preamble, theorem environments, tcolorbox, build system

This commit is contained in:
Worker Agent
2026-06-04 15:17:48 -05:00
parent 5453da4fbb
commit 4d69c898cd
2 changed files with 221 additions and 0 deletions

37
Makefile Normal file
View File

@@ -0,0 +1,37 @@
# =============================================================================
# Makefile — Differential Equations Handbook
# =============================================================================
TARGET = main
TEX = pdflatex
BIBTEX = bibtex
.PHONY: all quick clean view distclean
## all: Full build (pdflatex -> bibtex if needed -> pdflatex x2)
all:
$(TEX) -interaction=nonstopmode $(TARGET).tex
@if [ -f $(TARGET).blg ] || grep -ql '\\bibliography\|\\bibliographystyle' $(TARGET).tex; then \
$(BIBTEX) $(TARGET); \
$(TEX) -interaction=nonstopmode $(TARGET).tex; \
$(TEX) -interaction=nonstopmode $(TARGET).tex; \
fi
## quick: Single pdflatex pass for rapid iteration
quick:
$(TEX) -interaction=nonstopmode $(TARGET).tex
## clean: Remove all auxiliary files
clean:
rm -f $(TARGET).aux $(TARGET).log $(TARGET).out $(TARGET).toc \
$(TARGET).lof $(TARGET).lot $(TARGET).nls $(TARGET).nlo \
$(TARGET).vrb $(TARGET).synctex.gz $(TARGET).fls $(TARGET).out \
$(TARGET).blg $(TARGET).bbl $(TARGET).run.xml
## view: Open the resulting PDF
view:
xdg-open $(TARGET).pdf
## distclean: Clean + remove PDF
distclean: clean
rm -f $(TARGET).pdf

184
preamble.tex Normal file
View File

@@ -0,0 +1,184 @@
% =============================================================================
% preamble.tex — Differential Equations Handbook
% =============================================================================
% Complete preamble: packages, theorem styles, tcolorbox environments,
% custom macros, and configuration for a 14-chapter handbook.
% =============================================================================
\documentclass[10pt,a4paper]{article}
% ---------------------------------------------------------------------------
% Geometry
% ---------------------------------------------------------------------------
\usepackage[margin=0.75in]{geometry}
% ---------------------------------------------------------------------------
% Math packages
% ---------------------------------------------------------------------------
\usepackage{mathtools}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{bm}
\usepackage{empheq}
% ---------------------------------------------------------------------------
% Colors and boxes
% ---------------------------------------------------------------------------
\usepackage[svgnames]{xcolor}
\usepackage[most]{tcolorbox}
% ---------------------------------------------------------------------------
% Nomenclature (notation glossary)
% ---------------------------------------------------------------------------
\usepackage{nomencl}
\makenomenclature
\setlength{\nomlabelwidth}{2.5cm}
\setlength{\nomitemsep}{2pt}
% ---------------------------------------------------------------------------
% Tables
% ---------------------------------------------------------------------------
\usepackage{booktabs}
% ---------------------------------------------------------------------------
% TikZ
% ---------------------------------------------------------------------------
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{patterns}
\usetikzlibrary{decorations.markings}
% ---------------------------------------------------------------------------
% Hyperref (loaded before cleveref)
% ---------------------------------------------------------------------------
\usepackage[colorlinks=true,
linkcolor=MidnightBlue,
urlcolor=Navy,
citecolor=RoyalBlue,
breaklinks=true]{hyperref}
% ---------------------------------------------------------------------------
% Cross-referencing (must be after hyperref)
% ---------------------------------------------------------------------------
\usepackage[capitalize]{cleveref}
% =============================================================================
% Theorem styles (amsthm)
% =============================================================================
% Number theorems, definitions, and remarks per chapter (section).
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
% =============================================================================
% tcolorbox environments
% =============================================================================
% Worked Example — blue frame
\newtcolorbox{workedexample}{
breakable,
colframe=SteelBlue,
colback=LightSteelBlue!15,
coltitle=white,
fonttitle=\bfseries,
title=Worked Example,
boxrule=0.6pt,
arc=2pt,
left=6pt, right=6pt, top=4pt, bottom=4pt
}
% Exercise — gray frame
\newtcolorbox{exercise}{
breakable,
colframe=Gray,
colback=LightGray!10,
coltitle=white,
fonttitle=\bfseries,
title=Exercise,
boxrule=0.5pt,
arc=2pt,
left=6pt, right=6pt, top=4pt, bottom=4pt
}
% Key Result — gold/yellow frame
\newtcolorbox{keyresult}{
breakable,
colframe=Goldenrod,
colback=LemonChiffon!25,
coltitle=black,
fonttitle=\bfseries,
title=Key Result,
boxrule=0.8pt,
arc=2pt,
left=6pt, right=6pt, top=4pt, bottom=4pt
}
% Hint — green frame
\newtcolorbox{hintbox}{
breakable,
colframe=ForestGreen,
colback=Honeydew!40,
coltitle=white,
fonttitle=\bfseries,
title=Hint,
boxrule=0.6pt,
arc=2pt,
left=6pt, right=6pt, top=4pt, bottom=4pt
}
% =============================================================================
% Custom macros
% =============================================================================
% Differentials
\newcommand{\diff}{\mathrm{d}}
\newcommand{\dd}{\mathrm{d}}
% Partial derivative shorthand
\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}}
% Number sets
\newcommand{\R}{\mathbb{R}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\C}{\mathbb{C}}
% Operators
% Note: \Re and \Im are already provided by amsmath; no need to redefine.
\DeclareMathOperator{\tr}{tr}
\DeclareMathOperator{\detop}{det}
\DeclareMathOperator{\spanop}{span}
\DeclareMathOperator{\kerop}{ker}
\DeclareMathOperator{\rankop}{rank}
% =============================================================================
% Additional setup
% =============================================================================
% Table of contents depth
\setcounter{tocdepth}{2}
% Cleveref naming
\crefname{theorem}{Theorem}{Theorems}
\crefname{lemma}{Lemma}{Lemmas}
\crefname{proposition}{Proposition}{Propositions}
\crefname{corollary}{Corollary}{Corollaries}
\crefname{definition}{Definition}{Definitions}
\crefname{remark}{Remark}{Remarks}
\crefname{equation}{equation}{equations}
\crefname{section}{section}{sections}
\crefname{figure}{figure}{figures}
\crefname{table}{table}{tables}
% =============================================================================
% End of preamble.tex
% =============================================================================