TeXSmith Exam
texsmith-exam is an exam-focused template for TeXSmith.
It provides:
- An exam template for both backends — LaTeX (
exam.cls) and Typst — and the IR pass that reads the exam constructs for either. - TMark spellings for question structures, multiple-choice answers, and fill-in blanks.
- Solution-aware rendering to generate both student and answer-key PDFs from the same source.
- Demo content and Makefiles to quickly produce sample exam/solution outputs.
The current template branding is oriented to HEIG-VD and can be adapted over time.
What it is
This repository contains:
- A TeXSmith template entry point:
exam. - An IR pass declared by the template manifest (texsmith 0.9), which reads:
- Heading-to-question/part/subpart mapping.
- Task-list-based multiple-choice blocks.
- Solution containers (
::: solution) with lines/grid/box options. - Fill-in-the-blank placeholders.
- Documentation source under
docs/. - Working demos under
demo/examanddemo/quiz.
Prerequisites
- Python
>=3.13 - TeXSmith
>=0.9,<1.0— the template's IR pass and both emitters need it - uv installed
- A LaTeX environment available for TeXSmith PDF builds, or
typstfor the Typst backend
Installation
From repository root:
uv sync --group dev --group docs
This installs runtime deps, dev/test tools, and docs tooling.
How to use
1. Prepare your exam markdown
Create one or more .md files using the exam syntax documented in:
docs/index.mddocs/syntax.md
Optional front matter can define title, author, language, and exam.* settings (see demo/exam/config.yml for a complete example).
2. Render with the installed template entry point
If the package is installed in your environment, use:
uv run texsmith render --template exam exam.md
Generate solution version from the same source:
uv run texsmith render --template exam -a solution=true exam.md
3. Render with the local template path (dev workflow)
From this repository, use the local template directly:
uv run texsmith -t src/texsmith_template_exam/exam exam.md --build
Solution mode:
uv run texsmith -t src/texsmith_template_exam/exam exam.md --build -a solution=true
4. Run the provided demos
Build exam + solution PDFs for the full demo:
make -C demo/exam
Outputs:
demo/exam/build/exam/exam.pdfdemo/exam/build/solution/solution.pdf
Build quiz demo:
make -C demo/quiz
Clean demo build artifacts:
make -C demo/exam clean
make -C demo/quiz clean
Build and use documentation
Serve docs locally (live reload)
uv run mkdocs serve
Then open http://127.0.0.1:8000.
Build static docs
uv run mkdocs build
Generated site output is in site/.
Development checks
Run tests:
uv run pytest
Run lint/format checks:
uv run ruff check .
uv run ruff format .
Repository layout
src/texsmith_template_exam/: package sourcesrc/texsmith_template_exam/exam/: template assets and manifestdocs/: MkDocs documentationdemo/: runnable examplestests/: automated tests
Extension points
- Renderer handlers:
src/texsmith_template_exam/exam_renderer.pydelegates to domain modules insrc/texsmith_template_exam/exam/. - Markdown extensions:
src/texsmith_template_exam/markdown.pyexportsexam_markdown_extensions(). - Template filters:
src/texsmith_template_exam/exam/__init__.pyregistersmarkdown_to_latex,exam_date,exam_version. - Compatibility layer for texsmith internals:
src/texsmith_template_exam/exam/texsmith_compat.py.
Metadata
Release files for texsmith-exam 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| texsmith_exam-0.3.0.tar.gz | 150.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| texsmith_exam-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 209.2 kB
Release files / texsmith_exam-0.3.0.tar.gz
| Download URL | texsmith_exam-0.3.0.tar.gz |
|---|---|
| Size | 150.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eb432fb88a7df73362511321667273731ac93acf217319d2cb1d3556c83603fd
|
|
BLAKE2b-256 checksum How to use checksums |
d65d8ea2499805ef851aa5e8b036df274c4514b960b7cb72d2881f1fbb8eaf71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.
Transparency logRelease files / texsmith_exam-0.3.0-py3-none-any.whl
| Download URL | texsmith_exam-0.3.0-py3-none-any.whl |
|---|---|
| Size | 58.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a8f385f8fcd6095805371ac0365d29db069b92f38022783a0d0a0c570bfdcacc
|
|
BLAKE2b-256 checksum How to use checksums |
51ef07cef862460568580f362654fc3103bb8a3f9f48de75a280eb3be36706a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.
Transparency log