A reusable template for writing single-page articles with MyST Markdown, built as an interactive HTML site on GitHub Pages and as a publication-ready PDF via a customized Typst template.
- Single-file article authored in MyST Markdown with Jupyter code-cell support, figures, citations, and a bibliography
article-themeHTML layout for the published website- Customized
lapreprint-typsttemplate vendored locally undertemplates/for full control over the PDF output - Publication-ready PDF styling: 1-inch margins, three-line tables in the booktabs style of peer-reviewed journals, shaded code blocks,
1.1.1heading numbering, figure and table captions ending in a period, and no left-margin gutter or running headers - PDF export driven by a Python script (
build_pdf.py) that wrapsmyst build --pdf - GitHub Pages deployment on every push to
main: the HTML site is built with MyST, the PDF is generated, and the PDF is copied alongside the HTML so it is reachable at a stable URL on the deployed site - Pre-commit hooks: Black, codespell, nbstripout
- Click Use this template on GitHub to create a new repository
- Update myst.yml with your article title and GitHub
owner/repo - Edit the frontmatter and content of article.md (title, authors, abstract, keywords, body)
- Edit references.bib with the sources you actually cite
- Push to
mainto trigger the HTML and PDF builds
.
├── myst.yml # MyST configuration (article-theme)
├── article.md # The article (single source of truth)
├── references.bib # Bibliography
├── build_pdf.py # Python wrapper around `myst build --pdf`
├── requirements.txt # Python dependencies for code cells
├── templates/
│ └── lapreprint-typst/ # Vendored + customized Typst PDF template
│ ├── template.typ
│ ├── lapreprint.typ
│ ├── frontmatter.typ
│ ├── template.yml
│ └── LICENSE
├── images/ # Article figures
│ └── sample_figure.png
├── logo.png # Site logo
├── fav.ico # Favicon
├── custom.css # Site styling overrides
├── CNAME # Custom domain (optional)
├── robots.txt # Search engine directives
├── .pre-commit-config.yaml # Pre-commit hook configuration
├── CONTRIBUTING.md # Contribution guidelines
├── CONDUCT.md # Code of conduct
└── .github/workflows/
├── build.yml # PR checks: HTML + PDF artifact
└── deploy.yml # Production deploy to GitHub Pages
Edit the YAML frontmatter at the top of article.md:
title,short_titleauthors: name, affiliations, emailabstract,keywordsexports: points at the local./templates/lapreprint-typstand writes toarticle.pdfin the repo root
Replace the example entries in references.bib with your own. Cite them from article.md using MyST's [@key] (parenthetical) and @key (textual) syntax. MyST auto-generates a References section with only the entries you cite.
Edit myst.yml:
project.title,project.github(yourowner/repo)project.bibliographysite.template(kept asarticle-theme)
The PDF styling is controlled entirely by the files under templates/lapreprint-typst/. The vendored copy has been modified from the upstream lapreprint-typst to better suit a traditional journal layout. Edit templates/lapreprint-typst/lapreprint.typ and templates/lapreprint-typst/template.typ directly to tweak margins, fonts, table styling, or any other typography. Changes persist across _build/ wipes because the template lives in the source tree rather than being downloaded on each build.
Install the toolchain:
pip install -r requirements.txt
npm install -g mystmd
# Install the Typst CLI from https://github.com/typst/typstBuild the HTML site:
myst build --html
# output: _build/html/Build the PDF:
python build_pdf.py
# output: ./article.pdfThe script wraps myst build --pdf, checks that myst and typst are on PATH, and verifies that ./article.pdf was produced.
Preview the site with a live dev server:
myst startPushes to main trigger deploy.yml, which:
- Installs
mystmd(via npm), Python, andtypst - Builds the PDF via
python build_pdf.py(writes./article.pdf) - Builds the HTML site with
myst build --html(usesBASE_URL=/<repo-name>so asset paths work underusername.github.io/<repo-name>/) - Copies
article.pdfinto_build/html/article.pdfso it ships alongside the site - Deploys
_build/html/to GitHub Pages
The PDF is published at a stable URL next to the HTML site, for example:
https://opengeos.org/myst-article-template/article.pdf
Link to that URL from anywhere you reference the article (the landing page, README, external posts, etc.). If you configure a custom domain via CNAME, remove the BASE_URL environment variable from deploy.yml.
Pull requests trigger build.yml, which builds the HTML site and the PDF, then uploads the PDF as an article-pdf workflow artifact for download from the run summary.