mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-11-09 10:39:41 -06:00
164 lines
4.5 KiB
TeX
164 lines
4.5 KiB
TeX
% =============================================================================
|
|
% LATEX HEADER CONFIGURATION FOR TINYTORCH MONOGRAPH (VOLUME 1 STYLE)
|
|
% =============================================================================
|
|
|
|
\usepackage{adjustbox}
|
|
\usepackage{afterpage}
|
|
\usepackage{array}
|
|
\usepackage{caption}
|
|
\usepackage{microtype}
|
|
\usepackage{fancyhdr}
|
|
\usepackage{geometry}
|
|
\usepackage{graphicx}
|
|
\usepackage{float}
|
|
\usepackage[skins,breakable]{tcolorbox}
|
|
\usepackage{fontspec}
|
|
\usepackage{amsmath,amssymb}
|
|
\usepackage{enumitem}
|
|
\usepackage{titlesec}
|
|
\usepackage{fvextra}
|
|
\usepackage{newunicodechar}
|
|
|
|
% Page Geometry (7.5" x 9.25" Monograph Standard)
|
|
\geometry{
|
|
paperwidth=7.5in,
|
|
paperheight=9.25in,
|
|
top=0.9in,
|
|
bottom=0.9in,
|
|
inner=0.9in,
|
|
outer=0.9in,
|
|
footskip=25pt
|
|
}
|
|
|
|
% Microtypography
|
|
\microtypesetup{
|
|
activate={true,nocompatibility},
|
|
final,
|
|
tracking=true,
|
|
protrusion=true,
|
|
expansion=true
|
|
}
|
|
|
|
% Code Block Highlighting and Wrapping
|
|
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{%
|
|
breaklines,%
|
|
breakanywhere,%
|
|
breaksymbolleft={\color{flameorange!60}\hookrightarrow\space},%
|
|
commandchars=\\\{\}%
|
|
}
|
|
\RecustomVerbatimEnvironment{verbatim}{Verbatim}{%
|
|
breaklines,%
|
|
breakanywhere,%
|
|
breaksymbolleft={\color{flameorange!60}\hookrightarrow\space}%
|
|
}
|
|
|
|
% Headers & Footers
|
|
\pagestyle{fancy}
|
|
\fancyhf{}
|
|
\fancyhead[LE]{\footnotesize\color{crimson}\scshape\nouppercase{\leftmark}}
|
|
\fancyhead[RO]{\footnotesize\color{crimson}\scshape\nouppercase{\rightmark}}
|
|
\fancyfoot[LE,RO]{\small\color{crimson}\thepage}
|
|
\renewcommand{\headrulewidth}{0.4pt}
|
|
\renewcommand{\footrulewidth}{0pt}
|
|
\renewcommand{\headrule}{{\color{crimson!40}\hrule height 0.4pt}}
|
|
|
|
\fancypagestyle{plain}{
|
|
\fancyhf{}
|
|
\fancyfoot[C]{\small\color{crimson}\thepage}
|
|
\renewcommand{\headrulewidth}{0pt}
|
|
}
|
|
|
|
% Section Titles Styling (Harvard Crimson)
|
|
\titleformat{\chapter}[display]
|
|
{\normalfont\sffamily}
|
|
{\color{flameorange}\Large\bfseries Chapter \thechapter}
|
|
{0.5em}
|
|
{\color{crimson}\Huge\bfseries}
|
|
[\vspace{0.4em}{\color{crimson!30}\titlerule[0.5pt]}]
|
|
\titlespacing*{\chapter}{0pt}{10pt}{24pt}
|
|
|
|
% Numberless chapters (Index, Preface, Appendices)
|
|
\titleformat{name=\chapter,numberless}[display]
|
|
{\normalfont\sffamily}
|
|
{}
|
|
{0pt}
|
|
{\color{crimson}\Huge\bfseries}
|
|
[\vspace{0.4em}{\color{crimson!30}\titlerule[0.5pt]}]
|
|
\titlespacing*{name=\chapter,numberless}{0pt}{10pt}{24pt}
|
|
|
|
|
|
\titleformat{\section}
|
|
{\normalfont\Large\bfseries\color{crimson}}
|
|
{\thesection}{0.6em}{}
|
|
\titleformat{\subsection}
|
|
{\normalfont\large\bfseries\color{darknavy}}
|
|
{\thesubsection}{0.5em}{}
|
|
\titleformat{\subsubsection}
|
|
{\normalfont\normalsize\bfseries\color{darknavy!85}}
|
|
{\thesubsubsection}{0.5em}{}
|
|
|
|
\titlespacing*{\section}{0pt}{1.4em}{0.5em}
|
|
\titlespacing*{\subsection}{0pt}{1.1em}{0.4em}
|
|
\titlespacing*{\subsubsection}{0pt}{0.9em}{0.3em}
|
|
|
|
% Paragraph formatting
|
|
\setlength{\parskip}{0pt plus 0.5pt}
|
|
\setlength{\parindent}{1.2em}
|
|
|
|
% Callout palette overrides
|
|
\definecolor{quarto-callout-note-color}{HTML}{1B3A5F}
|
|
\definecolor{quarto-callout-tip-color}{HTML}{2E7D32}
|
|
\definecolor{quarto-callout-warning-color}{HTML}{D97706}
|
|
\definecolor{quarto-callout-caution-color}{HTML}{A51C30}
|
|
\definecolor{quarto-callout-important-color}{HTML}{C026D3}
|
|
|
|
\definecolor{quarto-callout-note-color-frame}{HTML}{1B3A5F}
|
|
\definecolor{quarto-callout-tip-color-frame}{HTML}{2E7D32}
|
|
\definecolor{quarto-callout-warning-color-frame}{HTML}{D97706}
|
|
\definecolor{quarto-callout-caution-color-frame}{HTML}{A51C30}
|
|
\definecolor{quarto-callout-important-color-frame}{HTML}{C026D3}
|
|
|
|
\tcbset{
|
|
fonttitle=\bfseries\sffamily\color{crimson},
|
|
beforeafter skip=8pt,
|
|
boxrule=0.6pt,
|
|
left=10pt,
|
|
right=10pt,
|
|
top=8pt,
|
|
bottom=8pt
|
|
}
|
|
|
|
% Unicode character mappings
|
|
\newunicodechar{●}{$\bullet$}
|
|
\newunicodechar{○}{$\circ$}
|
|
\newunicodechar{✓}{\checkmark}
|
|
\newunicodechar{✗}{$\times$}
|
|
\newunicodechar{→}{$\rightarrow$}
|
|
\newunicodechar{←}{$\leftarrow$}
|
|
\newunicodechar{↔}{$\leftrightarrow$}
|
|
\newunicodechar{≈}{$\approx$}
|
|
\newunicodechar{≠}{$\neq$}
|
|
\newunicodechar{≤}{$\leq$}
|
|
\newunicodechar{≥}{$\geq$}
|
|
\newunicodechar{∈}{$\in$}
|
|
\newunicodechar{∑}{$\sum$}
|
|
\newunicodechar{∏}{$\prod$}
|
|
\newunicodechar{∂}{$\partial$}
|
|
\newunicodechar{∇}{$\nabla$}
|
|
|
|
% Ensure Preface and Index do not advance main chapter counters
|
|
\let\origchapter\chapter
|
|
\newcommand{\startmainmatter}{%
|
|
\mainmatter
|
|
\setcounter{chapter}{0}%
|
|
}
|
|
|
|
|
|
% Automatic chapter counter synchronization
|
|
\usepackage{etoolbox}
|
|
\pretocmd{\part}{%
|
|
\ifnum\value{part}=0
|
|
\setcounter{chapter}{0}%
|
|
\fi
|
|
}{}{}
|