Section 7.2 PreTeXt Cheat Sheet
A comprehensive guide to PreTeXt XML elements and structure for authoring mathematical content.
Subsection 7.2.1 Document Structure
PreTeXt documents follow a strict hierarchical organization.
<pretext>
<docinfo> ... </docinfo>
<book xml:id="my-book">
<title>Book Title</title>
<chapter xml:id="ch-demo">
<title>Chapter</title>
<section xml:id="sec-demo">
<title>Section Title</title>
<introduction>
<p>
<tag>202606012315</tag> |
<tag>topic</tag>
</p>
</introduction>
<subsection xml:id="sub-demo">
<title>Subsection</title>
<p>Content with <m>E=mc^2</m> and <xref ref="ch-demo"/>.</p>
</subsection>
<conclusion>
<p>ποΈ <alert>Linked Notes:</alert> <xref ref="other-note"/></p>
</conclusion>
</section>
</chapter>
</book>
</pretext>
Subsection 7.2.2 Inline Elements and Tags
Inline elements are used within paragraphs (
p) to style text or add semantics.
| Element | Usage | Example |
|---|---|---|
m |
Inline Math (LaTeX) | \(E = mc^2\) |
tag |
Semantic Tags (Metadata) | quantum mechanics |
c |
Inline Code/Verbatim | git status |
em |
Emphasis (Cooler Blue/Italic) | Nuance |
term |
Defining a term (Orange Gradient) | Bivector |
strong |
Strong emphasis (Prominent Cyan) | Key Term |
alert |
Metadata labels (Glassmorphic Pill) | Warning! |
em class="alert" |
Critical Emphasis (Blue Gradient) | Important! |
xref |
Cross-reference | See SectionΒ 7.2 |
url |
Hyperlink | PreTeXt |
Note: In this project,
tag elements are styled as glassmorphic pills.
Subsection 7.2.3 Mathematics
PreTeXt supports various math environments using standard LaTeX notation.
-
Inline Math.
Use
m>...</mfor inline expressions. -
Single Line Equations.
Use
mdfor equations. Single-line equations no longer usemeormen(deprecated). Use@number="yes"onmdfor numbering.<md number="yes"> <mrow xml:id="eq-schrodinger">i\hbar\frac{\partial}{\partial t}\Psi = \hat{H}\Psi</mrow> </md>Output:\begin{gather} i\hbar\frac{\partial}{\partial t}\Psi = \hat{H}\Psi\tag{7.2.1} \end{gather} -
Aligned Equations.
<md> <mrow> \nabla \cdot \mathbf{E} \amp = \frac{\rho}{\epsilon_0} </mrow> <mrow> \nabla \cdot \mathbf{B} \amp = 0 </mrow> </md>Output:\begin{align*} \nabla \cdot \mathbf{E} \amp = \frac{\rho}{\epsilon_0} \\ \nabla \cdot \mathbf{B} \amp = 0 \end{align*}
Subsection 7.2.4 Common Blocks
Structural blocks organize content into logical units with specific styling.
<definition xml:id="def-unitary">
<title>Unitary Operator</title>
<statement>
<p>An operator <m>U</m> is unitary if <m>U^\dagger U = I</m>.</p>
</statement>
</definition>
Output:
<theorem xml:id="thm-noether">
<title>Noether's Theorem</title>
<statement>
<p>Every differentiable symmetry ... has a corresponding conservation law.</p>
</statement>
</theorem>
Output:
Theorem 7.2.3. Noetherβs Theorem.
Every differentiable symmetry ... has a corresponding conservation law.
<assemblage>
<title>Key Concept</title>
<p>Assemblages are used for boxed summaries (Glassmorphic in this theme).</p>
</assemblage>
Output:
Key Concept.
Assemblages are used for boxed summaries (Glassmorphic in this theme).
Subsection 7.2.5 Comprehensive Element Table
| Category | Elements | Description |
|---|---|---|
| Structure |
book, part, chapter, section
|
High-level document organization |
| Blocks |
definition, theorem, example
|
Semantic mathematical environments |
| Admonitions |
note, warning, insight, remark
|
Side-bars or callout boxes |
| Technical |
program, image, table, figure
|
Non-textual data, code, and graphics |
| Lists |
ul, ol, dl
|
Unordered, ordered, and description lists |
| Backmatter |
idx, biblio, glossary, colophon
|
Indices, references, and metadata |
Subsection 7.2.6 Project Conventions
Custom styles and standards used in this Zettelkasten.
-
Note Metadata: Every note should include a metadata block (Note ID, Tags, etc.). This block can be placed in
introduction,blockquote,aside, orparagraphs.<!-- Traditional Introduction --> <introduction> <p> <tag>202606012315</tag> | <tag>topic1</tag> <tag>topic2</tag> </p> </introduction> <!-- Alternative using Blockquote (Always visible, no title) --> <blockquote> <p> <tag>202606012315</tag> | <tag>topic1</tag> </p> </blockquote>Output (approximate): -
Note IDs: Use
YYYYMMDDNNNNorHHMMformat. The firsttagin a supported metadata block (Introduction, Blockquote, etc.) is automatically styled as a purple glassmorphic Note ID. -
Conclusion Metadata: Conclusions use
alerttags for metadata labels (e.g., Linked Notes, References), which are automatically styled as blue glassmorphic pills.<conclusion> <p> ποΈ <alert>Linked Notes:</alert> <xref ref="sec-topic" /> </p> <p> π <alert>References:</alert> <xref ref="biblio-item" /> </p> </conclusion> -
List Titles: Headings inside list items (e.g.
li><title>...</title></liorli class="li"><title>...</title></li) are styled in prominent cyan with the heading font. -
Assemblages: Use for primary takeaways or "atomic" notes within a section.