makesPDF
← Back to How to create a PDF

LaTeX and Pandoc

By Jason Galea · Part of the How to create a PDF benchmark

Takeaway: LaTeX is still the benchmark for academic typography and maths, and the LaTeX Tagging Project is making real progress on PDF/UA-2, but the toolchain is huge, slow, and awkward for data-driven app templates.

Sample PDFSizePagesTaggedPDF/UA-1PDF/A-2aZürich / 東京 / 🚀Fig altTable tags
pandoc-latex46 KB2nofail (10r / 91c)fail (8r / 142c)✓ ✓ ✗✗✗
pandoc-latex-tagged77 KB2yesfail (3r / 5c)fail (1r / 3c)✓ ✓ ✗✓✗

Checked with veraPDF 1.28.2 (r = failed rules, c = failed checks). Click any sample name to download the PDF, or test your own output in /validate (free, no sign-in) and inspect structure trees in /tags.

LaTeX has been typesetting books, academic papers and maths-heavy documents for decades. Most developers who use it today sit Pandoc or Quarto in front of it so they can write in Markdown and let LuaLaTeX or XeLaTeX handle the PDF output.

Important caveat before reading the table

Our automated test harness ran on TeX Live 2023 (LuaTeX 1.17.0, LaTeX2e 2023-11-01, Pandoc 3.1.3). That is old for the LaTeX Tagging Project, which has moved quickly over the last two years.

The LaTeX team's 2025 TUGboat report and documentation show that current TeX Live can emit PDF/UA-2 directly via \DocumentMetadata{tagging=on, pdfstandard=ua-2} on LuaLaTeX, though many third-party packages and publisher journal classes are still catching up. Treat the numbers in our table as a floor from Ubuntu's distro TeX Live 2023; we plan to re-run this sample on a current TeX Live release.

What we measured (TeX Live 2023 + Pandoc 3.1.3)

We ran the shared Quarterly Field Report (reference.md) through Pandoc + LuaLaTeX in two modes:

  • pandoc-latex.pdf (46 KB, 2 pages): plain Pandoc to LuaLaTeX. Untagged, failing PDF/UA-1 on 10 rules (91 checks) and PDF/A-2a on 8 rules (142 checks).
  • pandoc-latex-tagged.pdf (77 KB, 2 pages): exported to .tex, prepended \DocumentMetadata{pdfstandard=A-2a, testphase=phase-III}, and compiled twice with lualatex.

The tagged run built real structure for headings (H1/H2/H3), lists (L/LI/Lbl/LBody), the Figure with /Alt, and the Link, and came very close on PDF/A-2a (1 rule / 3 checks: CID font descriptor metadata 6.2.11.4.2-2). However, on TeX Live 2023:

  • The 36-row table was not tagged (0 TR / 0 TD).
  • PDF/UA-1 failed on 3 rules (5 checks): the same CID font descriptor issue (7.21.4.2-2), missing ViewerPreferences, and no PDF/UA identifier.
  • Accents and CJK worked, colour emoji did not. Zürich, São Paulo and 東京 survived text extraction, while 🚀 dropped out.
  • Default table sizing was rough. Pandoc's default longtable template rendered the table tiny and centred on the page until customised.

Pandoc and Quarto

Pandoc is still the Swiss Army knife for converting Markdown, reStructuredText or DOCX into PDF, and Quarto adds nice publishing features for technical and scientific reports. One useful recent shift: Quarto also supports Typst as a PDF backend now (Quarto PDF accessibility post), which avoids the multi-gigabyte TeX install when you don't specifically need LaTeX packages.

Pros and cons

Pros

  • Unmatched typographic quality, bibliographies, cross-references and complex mathematical notation.
  • Mature ecosystem of academic journal classes and Pandoc/Quarto Markdown workflows.
  • Active LaTeX Tagging Project targeting modern PDF/UA-2 natively.

Cons

  • Massive toolchain (easily several gigabytes for a full TeX Live container) and slow multi-pass builds measured in seconds.
  • Tagging compatibility still breaks easily when you pull in older CTAN packages or custom macros.
  • Painful for dynamic, data-driven business templates (escaping untrusted user strings in .tex is notorious for breaking builds or opening command-injection holes if --shell-escape is anywhere nearby).

When LaTeX / Pandoc is the right call

  • Academic papers, theses, books, or technical specifications where LaTeX maths, citations or a publisher's .cls file are non-negotiable.
  • Batch documentation builds in CI where container size and multi-second compile times don't matter.

If you want a similar local, deterministic document compiler without the TeX Live weight and package fragility, Typst is worth a serious look. If you are generating business documents from JSON or Markdown over HTTP, look at CSS paged media or makesPDF.