Skip to content

Conversation

@gordonwoodhull
Copy link
Contributor

@gordonwoodhull gordonwoodhull commented Jan 8, 2026

To be merged after #13249

Fixes #4426

Also includes

Adds basic support in Typst and LaTeX for PDF standard selection.

PDF versions and standards can be independently specified, so this takes a list. Version specifies the output format; standard specified what validation is applied to the output.

Here are the rules: you can combine standards from different families:

  • PDF/A (archival) + PDF/UA (accessibility) is the common combo
  • PDF version can also be included

The constraint is you can only have one from each category:

  • One PDF version (1.4, 1.5, 1.6, 1.7, 2.0)
  • One PDF/A standard (a-1b, a-2b, etc.)
  • One PDF/UA standard (ua-1, ua-2)
  • One PDF/X standard (x-4, etc.)

It would be equally valid to take pdf-version and pdf-standard as separate options, as LaTeX does, but I chose to follow Typst here and use one option for both.

Once the options have been validated, these go to the command line --pdf-standard for Typst, new \DocumentMetadata{} command for PDF.

The metadata includes tagging=on for any standard in LaTeX.

Auto-installs required LaTeX packages (latex-lab, colorprofiles) when missing.

This includes a test which will fail UA-1 in Typst and warn in LaTeX; these warnings are surfaced from the LaTeX log.

@gordonwoodhull gordonwoodhull requested a review from cderv January 8, 2026 00:11
@posit-snyk-bot
Copy link
Collaborator

posit-snyk-bot commented Jan 8, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@gordonwoodhull gordonwoodhull requested a review from cscheid January 8, 2026 00:14
@gordonwoodhull gordonwoodhull changed the base branch from main to deps/pandoc-2025-08 January 8, 2026 12:54
@cderv
Copy link
Collaborator

cderv commented Jan 9, 2026

Following our meeting discussion, related issues on pdf accessibility

@gordonwoodhull gordonwoodhull force-pushed the feature/pdf-standard branch 2 times, most recently from 77f8c0c to 21d0394 Compare January 10, 2026 05:06
gordonwoodhull and others added 2 commits January 10, 2026 00:07
New `pdf-standard` option for LaTeX and Typst PDF output that supports:

- PDF versions: 1.4, 1.5, 1.6, 1.7, 2.0
- PDF/A standards: a-1b, a-2a, a-2b, a-2u, a-3a, a-3b, a-3u, a-4, a-4f
- PDF/UA standards: ua-1, ua-2 (LaTeX only)
- PDF/X standards: x-4, x-4p, x-5g, x-5n, x-5pg, x-6, x-6n, x-6p (LaTeX only)

Standards can be combined, e.g., `pdf-standard: [a-2b, ua-1]` for accessible
archival PDF. Uses LaTeX's \DocumentMetadata API with `tagging=on` for
tagged PDF support. Auto-installs required LaTeX packages (latex-lab,
colorprofiles) when missing.

Closes #4426
Closes #13782

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Preserve markdown image captions and fig-alt attributes as alt text
for \includegraphics[alt={...}] in LaTeX output. This enables PDF/UA
compliance by ensuring alt text is embedded in the PDF.

The fix preserves image captions as the alt attribute before clearing
them for figure handling. Also propagates fig-alt from FloatRefTarget
to Image elements for LaTeX output.

Closes #13248

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gordonwoodhull gordonwoodhull marked this pull request as ready for review January 10, 2026 05:20
PDF tagging is now only enabled for standards that actually require
document structure tagging:
- PDF/UA (ua-1, ua-2) - accessibility standards require tagging
- PDF/A level "a" (a-2a, a-3a) - "accessible" level requires tagging

Standards that don't require tagging no longer enable it:
- PDF/A level "b" (a-1b, a-2b, a-3b) - "basic" level
- PDF/A level "u" (a-2u, a-3u) - "unicode" level
- PDF/A-4, a-4e, a-4f - tagging optional
- PDF/X standards - print exchange, no tagging
- PDF version only (1.7, 2.0) - version is independent of tagging

Also fixes supported standards list:
- Removed a-1a (not supported by LaTeX DocumentMetadata)
- Added a-4e (supported by LaTeX)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gordonwoodhull
Copy link
Contributor Author

gordonwoodhull commented Jan 10, 2026

Clarification: LaTeX does not do compliance validation; that's why it only produces warnings.

We'd have to integrate something like veraPDF to actually validate LaTeX PDFs.

Compliance validation is integrated for Typst.

Closes #13868

Workaround for Pandoc not passing alt text to Typst image() calls.
When an image has alt text (from caption or explicit alt attribute),
emit raw Typst with image(..., alt: "...") for accessibility.

This is a temporary fix until jgm/pandoc#11394 is merged upstream.

- Add alt text handling in render_typst_fixups() Image filter
- Alt parameter placed second after filename (matches Pandoc PR)
- Escape backslashes and quotes in alt text
- Add comprehensive test coverage with unique test images
- Replace test-image.png with smaller penrose.svg

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants