After switching from Tex Live 2019 to 2021, pdfx doesn't seem to work correctly. MWE that works on 2019 but not on 2021:

    \Title{Some document}
    \Author{Some author}

This document won't compile on \TeX{} Live 2021.

Tex Live 2021's pdflatex shows multiple repetitions of the following errors:

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
l.2855  \includexmp{\xmp@template}

In addition, some XMP tree is included as document text (in contrast to metadata as would have been expected).

To me, it seems that Tex Live 2021 has a regression (lualatex and xelatex seem to fail in a similar way). Tex Live 2021 was installed today and thus is fully up to date. Maybe I'm missing something here? Any help is appreciated.

  • 1
  • 2
    your document runs without error with pdflatex-dev rather thanpdflatex Jul 21, 2021 at 11:27
  • Thanks! The other question unfortunately didn't show up during my search - guess my search terms were too specific...
    – ebbes
    Jul 21, 2021 at 11:36
  • @DavidCarlisle it works in -dev only because -dev hasn't yet the fix for github.com/latex3/latex2e/issues/605, as soon as this is there too, it will break too. So this really need to be fixed in pdfx. Jul 21, 2021 at 12:10
  • 1
    @UlrikeFischer yes but if the OP wants to get a document out today.... Jul 21, 2021 at 12:59

3 Answers 3



With xmpincl 2021/08/31 v2.3 this patch is no longer needed

You can try this patch

    \Title{Some document}
    \Author{Some author}



This document won't compile on \TeX{} Live 2021.
  • works for me.. could you elaborate on what does it do? Aug 29, 2021 at 14:27
  • 1
    it replaces a wrong \if in xmpincl by the correct \ifx. Aug 29, 2021 at 14:31
  • If this patch does not break anything, could that fix be incorporated directly into the xmpincl package in CTAN? That package has currently no active maintainer, so anyone can submit a bugfix. Aug 31, 2021 at 14:29
  • @JarmoNiemelä. Sure. Contact ctan and tell them you are willing to do it. I won't do it. I don't neither use xmpincl nor pdfx (pdfx is incompatible with pdfmanagement-testphase). Aug 31, 2021 at 14:40
  • I added this fix to xmpincl and submitted a corrected version to CTAN. Aug 31, 2021 at 18:19

Since I don't know how to fix pdfx, I built a temporary workaround package fixpdfx.sty:

\ProvidesPackage{fixpdfx}[2021-07-22 A package that fixes pdfx errors on TeX Live 2021 in a quick and dirty way]

% temporarily reverts https://github.com/latex3/latex2e/commit/5fb2860f2fedc87b213730f06ec1d77bcab4814a
% resp. https://github.com/latex3/latex2e/commit/dd2ec509ec98e9c359a41e35aea6aade86485ca2
% as it breaks pdfx (see https://tex.stackexchange.com/questions/605854/error-using-pdfx-on-tex-live-2021)
% published on https://tex.stackexchange.com/questions/605854/error-using-pdfx-on-tex-live-2021/610445#610445 

    \PackageError{fixpdfx}{pdfx is loaded}{This package must be loaded before pdfx}


% this is the old implementation from base/ltpara.dtx, version 1.0g
\cs_new_protected:Npn \__old_para_end: {
  % ltpara v1.0h as well as firstaid/latex2e-first-aid-for-external-files.dtx v1.0o inserted
  % \scan_stop: here, which breaks pdfx
  \mode_if_horizontal:TF {
    \mode_if_inner:F {
         \mode_if_horizontal:TF {
           \if_int_compare:w 0 < \tex_lastnodetype:D
             \tex_kern:D \c_zero_dim
         { \msg_error:nnnn { hooks }{ para-mode }{end}{horizontal} }

\cs_set_eq:NN \par     \__old_para_end:
% these two aren't actually required to fix pdfx, so we'll skip them...
%\cs_set_eq:NN \@@par   \__old_para_end:
%\cs_set_eq:NN \endgraf \__old_para_end:

    % pdfx v1.6.3 from 2019-02-27 is bad, so anything later is hopefully fixed...

    % restore additional definitions
    \cs_set_eq:NN \par     \para_end:
    % see above: as we didn't replace them, no need to restore them.
    %\cs_set_eq:NN \@@par   \para_end:
    %\cs_set_eq:NN \endgraf \para_end:


fixpdfx has to be loaded before pdfx and reverts the fix for issue 605. At the start of the document, however, pdfx has already included the XMP metadata in the output document and everything gets reverted. This way, other packages should hopefully not break (especially since pdfx loads hyperref and thus should be loaded very late anyway).

At least that's the fix I'll be using until pdfx is hopefully fixed some day... (or someone proposes a better fix)


As Ulrike Fischer suggested in her answer above, the error in question originated from the xmpincl package called by pdfx. The culprit was the following line in xmpincl.sty version 2.2:


In version 2.3 this line is replaced with


This removes the error, but as it turned out, it doesn't work as intended. The purpose of this line is to filter out empty lines from the input .xmp file because otherwise they would be output as \par commands. Unfortunately, the condition \ifx\par\xmpinclReadln is never true, and that will cause some \par commands to pass through to the generated pdf file. This, in turn, will cause PDF/A validation errors.

I should have tested it more thoroughly before I uploaded version 2.3 to CTAN; sorry about that. To correct my mistake, I have now submitted a new version 2.4 of xmpincl where the above-mentioned line is replaced with


In my tests, this seemed to work without problems.

And as David Carlisle pointed out in his comment, the error in question does not happen at all with pdflatex-dev. So this might be only a temporary problem and will go away after the next release of LaTeX.

  • no, the next release will not resolve it. It worked temporarly in pdflatex-dev as pdflatex-dev was behind the latex release for some days. But this has changed. Sep 24, 2021 at 8:02
  • I just tested that pdflatex-dev (LaTeX2e <2021-11-15> pre-release-1 (develop 2021-9-23 branch)) still works with xmpincl version 2.2. Sep 24, 2021 at 8:26
  • Version 2.2 of xmpincl.sty does not work anymore with pdflatex-dev (LaTeX2e <2021-11-15> pre-release-2 (develop 2021-10-4 branch)). Oct 4, 2021 at 16:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .