| name | pretext-authoring |
| description | Write and revise PreTeXt documents using the official guide, with explicit guardrails for how PreTeXt differs from DoenetML. |
PreTeXt Authoring Skill
Use this skill when creating or editing PreTeXt source files (.ptx / XML) for books, articles, and static course materials.
What To Read First
docs/pretext-guide-summary.md
docs/tag-reference.md
docs/pretext-vs-doenetml-differences.md
docs/pretext-do-dont-checklist.md
docs/references/pretext.rng (schema reference; source of truth for element/attribute validity)
docs/references/pretext-common.xsl (XSL processing/reference entry point)
docs/sources.md (for canonical guide/source URLs)
Validation Rule (Required)
Before declaring that a particular usage is correct PreTeXt, check docs/references/pretext.rng and verify the claim against the schema.
Core Instructions
- Author semantically, not visually. Prefer PreTeXt structural elements (
<section>, <theorem>, <example>, <exercise>) over ad hoc formatting.
- Treat the schema as authoritative for validity claims. If uncertain, confirm element names, allowed attributes, and nesting in
docs/references/pretext.rng before asserting correctness.
- Keep document hierarchy valid. Do not skip levels in sectioning.
- Use stable, descriptive
xml:id values on divisions and referenceable elements.
- Use
<xref ref="..."/> for internal references rather than hardcoded labels/numbers.
- PreTeXt internal links use
<xref> with a ref attribute; there is no standalone <ref> element for cross-references.
- For math, use
<m> (inline) and <md> (display), with MathJax-compatible LaTeX.
- For figures/images, include accessibility text (
<shortdescription> and/or <description>).
- For exercises, use structured children (
<statement>, optional <hint>, <answer>, <solution>).
- Keep output goals in mind: PreTeXt targets multi-format publishing (HTML/PDF/other), not client-side reactive state.
High-Risk Mistakes To Prevent
- Do not confuse PreTeXt
<answer> (authored exercise content) with DoenetML runtime answer validation. In PreTeXt, <answer> is not a live grading rule.
- Do not invent hybrid markup. Never introduce DoenetML-only patterns such as
$name, name="..." reactive data flow, <mathInput>, <award>, or live graph-interaction logic in PreTeXt source.
- Do not hardcode figure/equation/section numbers. Use
xml:id + <xref ref="..."/>.
- Do not author
<ref> as a cross-reference element in PreTeXt. Use <xref ref="..."/>.
- Do not skip hierarchy levels or omit required titles in divisions.
- Do not leave media inaccessible. If an image is instructional (not purely decorative), include
<shortdescription> and/or <description>.
Difference Emphasis (PreTeXt vs DoenetML)
- PreTeXt is publication-first, static-semantic XML with strong cross-referencing and backmatter.
- DoenetML is interaction-first with reactive components, immediate answer validation, and live graph/input state.
- Do not port DoenetML idioms like
$name reactive references, <answer> scoring logic, or live graph manipulation into PreTeXt source.
- When converting from DoenetML, rewrite into narrative + structured exercises/proofs/examples instead of reproducing app-like behavior.
Minimal Document Example
Use this as a minimal PreTeXt starting point for a short article with one section and one inline math expression.
<pretext>
<article xml:id="mini-article">
<title>Minimal PreTeXt Example</title>
<section xml:id="intro">
<title>Introduction</title>
<p>This is a minimal PreTeXt document with inline math <m>x+1</m>.</p>
</section>
</article>
</pretext>
Output Requirements
When asked to author PreTeXt, provide:
- Valid XML snippets with correct nesting.
- Explicit
xml:id values where needed.
- Accessibility-aware media markup.
- Notes about assumptions if target publication pipeline details are unknown.
- A short self-check list in the response confirming: no DoenetML-only tags were used, no hardcoded numbering was introduced, and references are xref-based.
Pre-Delivery Self-Check
- Confirm every internal reference uses
<xref ref="..."/> and the referenced xml:id exists.
- Confirm no DoenetML runtime constructs appear in the snippet.
- Confirm nesting is valid XML and the section hierarchy was not skipped.
- Confirm math is in
<m>/<md> rather than plain text.
Important Note
- Do not suggest HTML styling or attributes as a solution to PreTeXt problems. PreTeXt is a semantic XML language, and all styling is handled by the processing pipeline (e.g., CSS for HTML output, LaTeX for PDF). Direct HTML styling or attributes are not valid in PreTeXt and will not work.