preamble subsection¶
The optional preamble subsection supplies LaTeX code that is injected into
the generated document immediately before \begin{document}. It accepts
three forms.
String form (literal LaTeX)¶
A plain YAML string is inserted verbatim:
document:
preamble: |
\setmainfont{Lato}
This form gives full control but suppresses all pygacity defaults — nothing extra is added.
Absent / null¶
If preamble is omitted entirely, pygacity applies its
built-in defaults: the default font and the default pagestyle (see
below).
Structured dict form¶
The most flexible form is a mapping with up to four sub-keys: font,
pagestyle, colors, and commands. Each is optional; font and
pagestyle default to "default" when absent.
document:
preamble:
font: default
pagestyle: default
commands:
Universityname: Drexel University
Coursename: CHE 230 - Thermodynamics I
font¶
Controls the font preamble. Accepted values:
"default"(default when absent)Loads TeX Gyre Heros via
fontspecand sets it as the document default:\setmainfont{TeX Gyre Heros}
- literal LaTeX string
Any other string is inserted verbatim, e.g.:
font: \setmainfont{Lato}
- dict with
inputkey Reads font preamble from a local file:
font: input: my_font.tex
~(null)Suppresses the default entirely — no font preamble is added.
pagestyle¶
Controls the page-style preamble. Accepted values follow the same pattern as
font:
"default"(default when absent)Sets up
fancyhdrwith the course name and serial number in the header and the page number in the footer:\pagestyle{fancy} \fancyhf{} \lhead{\footnotesize \Universityname\ --- \Coursename\ --- \Termname} \rhead{\footnotesize <<<serialstr>>>} \rfoot{\thepage}
<<<serialstr>>>is replaced by pygacity at build time with the document’s serial-number string."single"A minimal page style suited to single-page documents (singlets):
\pagestyle{fancy} \fancyhf{} \chead{\sc{singlet}} \rfoot{\thepage}
~(null)Suppresses the default — no page-style setup is added. Use this when your document class handles headers and footers itself.
colors¶
Controls an optional color / hyperref configuration block. Accepted values
follow the same pattern as font:
"example"Loads the bundled example color configuration (Drexel blue/yellow palette with
hyperreflink colours).- literal LaTeX string or dict with
inputkey As for
fontabove.~(null, default)No color preamble is added.
commands¶
A mapping of autoprob class variable names to values. Each entry becomes a
\renewcommand in the preamble:
commands:
Universityname: Drexel University
Departmentname: Chemical & Biological Engineering
Instructorname: A. N. Other
Instructoremail: ano@drexel.edu
Coursename: CHE 230 - Thermodynamics I
Termcode: 202535
Termname: Spring 2025
Only commands that are defined as zero-argument \newcommand entries in
autoprob.cls are permitted. pygacity raises a ValueError at startup
if an unknown command name is supplied.
Typical full example¶
This is the pattern used by the bundled examples — suppress the built-in font
and pagestyle so they are fully controlled by the commands block and any
additional LaTeX in the class:
document:
preamble:
font: ~
pagestyle: ~
commands:
Universityname: University of Nowhere
Departmentname: Mechanical Engineering
Instructorname: Eustace T. Smartypants
Instructoremail: ets@unow.edu
Coursename: BIO 5678 - Applied Pyrohydrodynamics
Termcode: 202525
Termname: Winter 2025-2026