structure subsection¶
The structure section of the configuration file defines the document body
as an ordered list of blocks. Each block is a YAML dictionary; the key
that is present determines the block type.
source blocks¶
Reads content from an external LaTeX file:
- source: introduction.tex
pygacity searches for the file first in the current working directory, then in its bundled template directory.
source blocks also accept substitutions, which replace <<<KEY>>>
placeholders in the source file with specified values. Two equivalent forms
are supported:
Dictionary form:
- source: introduction.tex
substitutions:
PROB_TITLE: "My Awesome Problem Set"
SEMESTER: "Spring 2026"
List form (useful when order matters or a key appears more than once):
- source: introduction.tex
substitutions:
- search: PROB_TITLE
replace: "My Awesome Problem Set"
- search: SEMESTER
replace: "Spring 2026"
text blocks¶
Injects a literal LaTeX string directly into the document:
- text: |
\section{Introduction}
This is the introduction to the document.
pythontex blocks¶
Imports Python code into the document’s pythontex kernel. The value is a list of named pygacity pythontex resources:
- pythontex:
- setup
See Python Resources for available resources.
Question blocks¶
A block with a question_number key is treated as a numbered exam or
assignment question. It is rendered as an \item inside a LaTeX
enumerate environment in the compiled document. Question blocks must also
have a source key pointing to the LaTeX fragment for that question:
- question_number: 1
source: problem1.tex
points: 25
group: 1
Additional optional keys:
pointsInteger point value. When non-zero, the value is injected into the pythontex header as
pointsand displayed in the compiled output.groupInteger group identifier used by the
AnswerSetto organise answers into separate tables.configPath to a YAML configuration file for
short.tex-style question pools.
Consecutive question blocks (i.e. blocks whose question_number is not
None) are automatically wrapped in a single \\begin{enumerate} …
\\end{enumerate} in the output.
enumerate shorthand (old-style)¶
As a convenience, a list of question blocks can be expressed under a single
enumerate key. Question numbers are assigned sequentially starting from 1
(unless overridden with an explicit question_number):
- enumerate:
- source: problem1.tex
points: 25
- source: problem2.tex
points: 25
This is exactly equivalent to:
- question_number: 1
source: problem1.tex
points: 25
- question_number: 2
source: problem2.tex
points: 25
The shorthand is provided for backward compatibility. New configurations
should use explicit question_number keys for clarity.