Max Nikulin writes: > On 17/09/2023 01:00, Juan Manuel Macías wrote: >> >> [1] A longer example to export to a pdf that has pdf-x compliance, with >> the pdfx package: >> >> \providecommand{\pdfxopts}{x-1a} >> \begin{filecontents*}{\jobname.xmpdata} >> \Title{Some Title} >> \Author{Author} >> \Language{es-ES} >> \Keywords{keywords} >> \Publisher{publisher} >> \end{filecontents*} >> \documentclass{... > > Perhaps you have in mind other cases, but I am unsure concerning this > one. However I have tried only setting metadata for hyperref only, so I > may miss some important aspects. > > First of all, I was unaware of .xmpdata and, trying to get more info, I > have found hyperxmp that declares to reuse data from \hypersetup without > extra files and without the requirement to add settings before > \documentclass.
According to the pdfx package documentation (https://www.ctan.org/pkg/pdfx), p. 6 (at the bottom of the page)/7: --- Warning: The \jobname.xmpdata file may be included in the main document source, within a {filecontents*} environment, provided this comes before the \documentclass command, as follows[...] --- > Do you need to add commands before \documentclass because you are using > custom classes that loads a lot of packages, so there is no chance to > specify various options after \documentclass, but before specific > packages are loaded? Apart from the previous case, there are other varied cases (as I mentioned) in which it is necessary to put code before documentclass. For example, the newpax package, to preserve the internal links of a pdf included in the document, requires putting commands like \DocumentMetadata{ } before documentclass. -- Juan Manuel Macías https://juanmanuelmacias.com https://lunotipia.juanmanuelmacias.com https://gnutas.juanmanuelmacias.com