LaTeX writer: Add PDF standard support via DocumentMetadata#11407
LaTeX writer: Add PDF standard support via DocumentMetadata#11407
Conversation
jgm
left a comment
There was a problem hiding this comment.
This is a good idea, thanks. I've made a couple small comments. Also tests will probably need to be updated; you can do make TESTARGS=--accept and then inspect the changes to see if everything looks right.
|
Thanks @jgm, sounds good. I've pushed fixes. The CI error was a |
data/templates/hypersetup.latex
Outdated
| $if(pdfstandard)$ | ||
| $-- lang is set in DocumentMetadata instead | ||
| $else$ | ||
| pdflang={$lang$}, | ||
| $endif$ |
There was a problem hiding this comment.
Have you verified that including pdflang here, even if it is also set in DocumentMetadata, causes a problem? It's worth checking on this, because if it doesn't cause a problem, it's cleaner to leave it here.
There was a problem hiding this comment.
I double checked this - they have the same effect, and \hypersetup takes precedence (overwrites).
So it's harmless to do both, and I've removed the change.
jgm
left a comment
There was a problem hiding this comment.
This is close to ready! I made a couple more comments on things that can be improved.
3fc59f8 to
2c5d496
Compare
Add `pdfstandard` metadata variable for specifying PDF standards (PDF/A, PDF/X, PDF/UA) in LaTeX output. Uses LaTeX's \DocumentMetadata command which requires LuaLaTeX. Features: - PdfStandard data type for clean configuration handling - Automatic PDF version inference (e.g., a-2b implies PDF 1.7) - Automatic tagging for standards that require it (ua-1, ua-2, a-2a, a-3a) - Support for explicit version override - Warning for unsupported standards - Documentation in MANUAL.txt (Variables for LaTeX, Accessible PDFs) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2c5d496 to
3feb1ba
Compare
| requires LuaLaTeX and a recent LaTeX installation. | ||
|
|
There was a problem hiding this comment.
I just tried the command above after compiling with this code. I got the error: "! LaTeX Error: The key 'document/metadata/tagging' is unknown and is being
(LaTeX) ignored." I'm guessing this is because my lualatex is too old? It's from TeXLive 2024, lualatex 1.18.0. Can we document the version required?
|
I believe this change is going to cause issues as the 2025-11-01 LaTeX release extended the \RequirePackage{pdfmanagement}
\SetKeys[document/metadata]{%
lang=${if(lang)}${lang}${else}en-NZ${endif},
pdfstandard=${if(pdfstandard)}${pdfstandard}${else}A-3u${endif}
}For details see the newsletter for the LaTeX 2025-11-01 release and the the open and closed issues as well as Unfortunately, I'm not going to be able to contribute more as I'm currently in the process of hiking the south island of New Zealand and am off again tomorrow. |
|
I'm a bit confused, the release note says:
|
|
We could perhaps use a conditional: |
|
We would also need to test for the version of the LaTeX kernel as the original proposal works up to the 2025-11-01 release with both Since 2020-10-01 there exists the command |
|
Good, then we could also issue an error if the kernel is < 2025-06-01 and pdfstandard has been specified. |
|
I opened a new issue at #11421 since this is closed. |
Hi @jgm!
We want to do something like this to support PDF standards in Quarto 1.9, releasing in a month or so.
We'd prefer to have this upstream in Pandoc, as it's going to be an essential feature for Pandoc LaTeX users in public institutions in the US.
It's pretty much the same behavior as Typst's
--pdf-standardoption.Summary
Adds
pdfstandardmetadata variable for generating PDF/A, PDF/X, and PDF/UA compliant documents via LaTeX's\DocumentMetadatacommand.Example usage
Or multiple standards:
Features
a-1b,a-2a,a-2b,a-2u,a-3a,a-3b,a-3u,a-4,a-4e,a-4f), PDF/X, and PDF/UA (ua-1,ua-2) variantsa-2bsets PDF 1.7), or accepts an explicit version (e.g.,1.7,2.0)ua-1,ua-2,a-2a,a-3a)Notes
The
\DocumentMetadatacommand must appear before\documentclass, which is handled by a newdocument-metadata.latexpartial template.