tudace / tuda_latex_templates

LaTeX Templates for TU Darmstadt
LaTeX Project Public License v1.3c
200 stars 69 forks source link

pdfx with current LaTeX Release (2024/06/01) - Not only Letter template broken #472

Open schoeps opened 1 month ago

schoeps commented 1 month ago

Hello @TeXhackse, I recently updated texlive and I see those errors when compiling the letter template:

Latex Error: /usr/local/texlive/2024/texmf-dist/tex/latex/pdfx/pdfx.sty:2746 LaTeX Error: Loading a class or package in a group.

Latex Error: /usr/local/texlive/2024/texmf-dist/tex/latex/xmpincl/xmpincl.sty:20 LaTeX Error: Loading a class or package in a group.

Latex Error: /usr/local/texlive/2024/texmf-dist/tex/latex/xmpincl/xmpincl.sty:34 LaTeX Error: Loading a class or package in a group.

I guess it's a problem from a third party package? Can you check? Maybe there is some way around?

TeXhackse commented 1 month ago

Should help to set pdfa=false. Will explain as soon as possible.

Am 4. Juni 2024 10:31:40 GMT+01:00 schrieb Sebastian @.***>:

Hello @TeXhackse, I recently updated texlive and I see those errors when compiling the letter template:

Latex Error: [/usr/local/texlive/2024/texmf-dist/tex/latex/pdfx/pdfx.sty:2746](txmt://open/?url=file:///usr/local/texlive/2024/texmf-dist/tex/latex/pdfx/pdfx.sty&line=2746) LaTeX Error: Loading a class or package in a group.

Latex Error: [/usr/local/texlive/2024/texmf-dist/tex/latex/xmpincl/xmpincl.sty:20](txmt://open/?url=file:///usr/local/texlive/2024/texmf-dist/tex/latex/xmpincl/xmpincl.sty&line=20) LaTeX Error: Loading a class or package in a group.

Latex Error: [/usr/local/texlive/2024/texmf-dist/tex/latex/xmpincl/xmpincl.sty:34](txmt://open/?url=file:///usr/local/texlive/2024/texmf-dist/tex/latex/xmpincl/xmpincl.sty&line=34) LaTeX Error: Loading a class or package in a group.

I guess it's a problem from a third party package? Can you check? Maybe there is some way around?

-- Reply to this email directly or view it on GitHub: https://github.com/tudace/tuda_latex_templates/issues/472 You are receiving this because you were mentioned.

Message ID: @.***> -- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.

schoeps commented 1 month ago

Thanks. This works for me. I remember that this setting was necessary in the past but then it worked for some time without this option. No it's back again?! Anyway, thanks. No need to rush with an answer or fix.

TeXhackse commented 1 month ago

Well… it's more complicated. The whole pdfx package which we had used to PDF/A mode before is affected. The package will be fixed but that's not on CTAN so far.

I moved the setup to use the new pdfmangement, but did not yet change all the templates to use it.

You can use

\DocumentMetadata{
    pdfstandard=a-2b,
    pdfversion=1.7,% 2.0 is possible as well, but some validators don't support that yet
}

To get PDF/A without that package now. This has to be before \documentclass. But it's complex to do that via a package option. The pdfmanagement is not intending to support these options that way. I did some tests, but don't think it's woth to increase the maintenance effort. It's in the new documentation, which I still am working on as the support effort generally is increased a lot within the last months this is sadly not yet finished :/

schoeps commented 4 weeks ago

Should help to set pdfa=false. Will explain as soon as possible.

If I compile once then yes. If I compile multiple times there is again an error.

TeXhackse commented 4 weeks ago

I have planned to have a look at this today.

u-fischer commented 5 days ago

@TeXhackse Well I'm naturally quite happy if you advertise the use of the \DocumentMetadata setup. But as it doesn't look as if pdfx is moving, I would suggest that you implement this workaround for pdfx user:

https://tex.stackexchange.com/a/720984/2388

TeXhackse commented 5 days ago

@u-fischer Thanks a lot for the hint.

TeXhackse commented 2 days ago

The release (https://github.com/tudace/tuda_latex_templates/releases/tag/v3.40) including the workaround mentioned before has been uploaded to CTAN yesterday and was installed, so it should be available during the day.

I will message the TUDa sharelatex team to ask if the sharelatex can also get that version asap.

StefanFabian commented 2 days ago

pdfx was updated for me today, now I have the issue:

Package pdfx Error: 
(pdfx)  Cannot change the \pdfminorversion
(pdfx)  PDF version remains at 1.5.
(pdfx)  Use \pdfmajorversion=1 
and \pdfminorversion=3 before \documentclass.

Not sure if it's related to this issue or the workaround.

TeXhackse commented 2 days ago

Neither – nor. It's a bug in the package. It's loading the luatex85 package which sets the version number when using luatex and afterwards complains about the number being set already.

What you can do is as mentioned before switching to the other mechanism, which I'd recommend.

Or do what the message tells you to workaround. Silly thing is, the message is wrong for luatex, as those macros only exist after luatex85 was loaded.

So in case you use luatex it would be

\pdfvariable majorversion = 1% instead of  \pdfmajorversion
\pdfvariable minorversion =3 % instead of \pdfminorversion=3

before \documentclass.

But this will use PDF version 1.3. Which might lead to issues with included PDFs of a higher version.

StefanFabian commented 2 days ago

With other mechanism, you mean using DocumentMetadata instead of the pdfa option?

TeXhackse commented 2 days ago

If you activate PDF/A output via the pdfmanagement (So yes, that's what \DocumentMetadata does). The pdfa option will still be active, but the pdfx option which is internally will be switched off automatically. This will prevent pdfx from being loaded.

Alternatively… I just thought about it's also possible to set the PDF version manually with pdfx. But that's more effort than just using the \DocumentMetadata setup.

TeXhackse commented 2 days ago

So actually … Things I fixed yesterday using the workaround won't help … We could enforce this before the pdfx package is loaded … But actually I am not sure if I want to add more workarounds as long as we have the other option.

Actually the update of pdfx was not expected anymore.

u-fischer commented 2 days ago

@schoeps no, I get the error also for book class if I load pgfcore (or tikz or something like that) before pdfx. pdfx is then no longer able to change the pdfversion as the PDF has already started. With luatex this currently errors as it starts with different defaults.

Generally the class should load pdfx earlier, before pgfcore is loaded.

TeXhackse commented 2 days ago

@u-fischer You're extremly fast.

Actually I just had the same finding. That's something I can easily change of course. I will also have a look at the other changes of the packge to avoid other conflicts.

u-fischer commented 2 days ago

Actually the update of pdfx was not expected anymore.

;-) I had given up hope too and was rather suprised.

schoeps commented 2 days ago

You are both (too) fast (for me) 🥇

@TeXhackse: can you put somewhere (here or under discussion or whatever) two MWEs with pdf/a support and without? I am confused and probably other users as well.

u-fischer commented 2 days ago

@TeXhackse

as those macros only exist after luatex85 was loaded.

Yes and another workaround which would work as long as pdfx wants to generate only 1.5 would be to load luatex85 before, but that works only in some cases, and doesn't work before \documentclass as it would disturb your ifPDFTeX test (and that is a but in iftex that we will handle). So I wouldn't recommend that ...

TeXhackse commented 2 days ago

The updated template files use the \DocumentMetadata mechanism already.

You can just remove that and turn pdfa=false as you could before.

\DocumentMetadata{
    pdfstandard=a-2b,
    lang=de,
    pdfversion=1.7,
}
\documentclass{tudapub}
\title{text}
\author{names}
\begin{document}
\maketitle
\end{document}

disabled pdfa

\documentclass[pdfa=false]{tudapub}
\title{text}
\author{names}
\begin{document}
\maketitle
\end{document}

If I could finally finish the refactoring + the global docs … then we could also have this explained in more detail (not your fault of course).

Worst thing about all this is, that we have to do \DocumentMetadata before \documentclass which I can totally understand but it makes it hard with the libraries condition to have pdfa enabled by default.

TeXhackse commented 1 day ago

I changed the order of the packages yesterday and released 3.41 to CTAN. Was already installed and depending on the used mirror it will be lastest by tomorrow morning I guess. - As before I still leave this open until the sharelatex server updated.