Re: Fixing pdfx in TeX Live (maybe upgrade to 2025?)
Date: Tue, 01 Apr 2025 11:50:32 UTC
On Tue, 1 Apr 2025 12:15:18 +0200 Michael Gmelin <grembo@freebsd.org> wrote: > Hi, > > Currently pdfx is broken in TeX Live due to changes in latex. There > is a new version of pdfx out there that fixes the problem which I > assume is included in TeX Live 2025 - any chances to upgrade? > Otherwise we could also patch the existing version. > > Until then, adding this to files acts as a workaround: > > \RequirePackage[2024-05-01]{latexrelease} > > But this breaks other things, so it's not a real solution. > > Thanks & Best > Michael > > p.s. this is the error in question: > > ! LaTeX Error: Loading a class or package in a group. > > p.p.s. for now I'm using the hack below, which could be the bare > minimum to include - I could open PR or patch myself. > > --- share/texmf-dist/tex/latex/pdfx/pdfx.sty.orig 2025-04-01 > 10:13:02.158341000 +0000 +++ share/texmf-dist/tex/latex/pdfx/pdfx.sty > 2025-04-01 10:12:48.131257000 +0000 @@ -2740,10 +2740,10 @@ > %% it should be loaded outside the grouping, else biblatex may > barf %% > \RequirePackage{ifthen} > +\RequirePackage{xmpincl} > \begingroup > %% override the \ifpdf check of xmpincl package, inside the > grouping \pdftrue > - \RequirePackage{xmpincl} > %% combine coding from xmpincl and hyperxml to support XeTeX > \def\pdfx@xmpincl@xetex#1{% > \IfFileExists{#1.xmp}{% > > The patch above was too naive, please see below for a working patch we use in production now: --- /usr/local/share/texmf-dist/tex/latex/pdfx/pdfx.sty.orig 2025-04-01 10:13:02.158341000 +0000 +++ /usr/local/share/texmf-dist/tex/latex/pdfx/pdfx.sty 2025-04-01 10:12:48.131257000 +0000 @@ -2740,10 +2740,25 @@ %% it should be loaded outside the grouping, else biblatex may barf %% \RequirePackage{ifthen} -\begingroup + +%% 2024-04-05: from July 2024 LaTeX will not allow packages to load +%% within a grouping, so reorganise a bit. +%% %% override the \ifpdf check of xmpincl package, inside the grouping - \pdftrue - \RequirePackage{xmpincl} +%% after saving its current value: +\let\pdfx@ifpdf\ifpdf +\pdftrue +%% now load the packages, then enter the grouping: +\RequirePackage{xmpincl} +%% +\begingroup +%%% 20240405 revert the value of \ifpdf ... +\pdfx@ifpdf +\else + %% 20240624 ... outside the grouping + \aftergroup\pdffalse +\fi + %% combine coding from xmpincl and hyperxml to support XeTeX \def\pdfx@xmpincl@xetex#1{% \IfFileExists{#1.xmp}{% Please let me know if I should open a PR with that patch or if you will proceed to upgrading TeX Live soon anyway. Best Michael -- Michael Gmelin