2

I have recently switched from using texlive2022 to texlive2023, and in the process some things seem to have broken in hyperxmp. In particular, if I use the following

\documentclass{article}                                                                                                          
\usepackage{hyperxmp}                                                                                                            
\usepackage{hyperref}                                                                                                            
\title{Baking through the ages}                                                                                                  
\author{Larry Fine, Moe Howard}                                                                                                  
\hypersetup{pdftitle={Baking through the ages},                                                                                  
  pdfauthor={A. Baker, C. Kneader},                                                                                              
  pdflang={en},                                                                                                                  
  pdfkeywords={cookies, muffins, cakes},                                                                                         
  pdfpublisher={Baking International}                                                                                            
}                                                                                                                                
\begin{document}                                                                                                                 
\maketitle                                                                                                                       
This is the document.                                                                                                            
\end{document} 

Under texlive2022 with hyperxmp v5.9, this produced XMP that identifies the authors from pdfauthor:

<dc:creator>                                                              
  <rdf:Seq>                                                               
    <rdf:li>A. Baker</rdf:li>                                             
    <rdf:li>C. Kneader</rdf:li>                                           
  </rdf:Seq>                                                              
</dc:creator>

(I deliberately created an example with different values in \author to see where hyperxmp picks it up from). Under texlive2023 with hyperxmp v5.11, it omits this section for <dc:creator entirely, and the author information is not present elsewhere. There are certainly differences between hyperxmp 5.11 and hyperxmp 5.9, but I could find nothing that is directly related to how pdfauthor is handled. At this point I'm at a loss to solve the problem. Can anyone suggest a source of the problem here? Can someone try that document under texlive2023 and then inspect the pdf file to see if the dc:creator field is there? You don't need a pdf tool to see it, since the XMP package is just text inside the PDF.

2
  • hm, I can't check now older versions, but from the code it looks as if hyperxmp has to be loaded after hyperref (but before \hypersetup) for the authors to work. Commented Aug 28, 2023 at 22:53
  • Section 2 of the current documentation for hyperxmp says: "To use hyperxmp, merely put a \usepackage{hyperxmp} in your document’s preamble. That line can appear anywhere before the hyperref pdf options are specified (i.e., with either \usepackage[. . . ]{hyperref} or \hypersetup{. . . }". hyperxmp also appears to load hyperref in \AtEndPreamble in case it wasn't already loaded. Do you see a smoking gun in hyperxmp that would require hyperref to be loaded first?
    – mccurley
    Commented Aug 29, 2023 at 2:43

1 Answer 1

3

hyperxmp tries to change the way how hyperref handles options (both in the package options and in \hypersetup) as it wants to catch the content of options like pdfauthor for the XMP-metadata.

It does it by redefining \ProcessKeyvalOptions to inject its code. That is not a good idea as \ProcessKeyvalOptions is used by other packages too and in 2022 it was discovered that it can lead to a loop: https://tex.stackexchange.com/a/648036/2388.

In version 5.11 hyperxmp tries to repair this and resets \ProcessKeyvalOptions to the original meaning after the first use:

\let\hyxmp@ProcessKeyvalOptions=\ProcessKeyvalOptions
\renewcommand*{\ProcessKeyvalOptions}{%
  \global\let\ProcessKeyvalOptions=\hyxmp@ProcessKeyvalOptions
  \hyxmp@redefine@Hyp
  \hyxmp@ProcessKeyvalOptions
}

But this "fix" makes the patch actually useless as hyperref loads at the begin a package which uses \ProcessKeyvalOptions too and so the hyperxmp redefinitions are lost.

You should report this error. As a work-around loading hyperxmp after hyperref should more or less work as long as you set all relevant options in a later \hypersetup.

As an alternative you can set the XMP-metadata by loading with \DocumentMetadata the PDF management from the pdfmanagement-testphase code. See the l3pdfmeta documentation or https://tug.org/TUGboat/tb43-3/tb135fischer-xmp.pdf for how XMP are handled:

\DocumentMetadata{}
\documentclass{article}
\usepackage{hyperref}
\title{Baking through the ages}
\author{Larry Fine, Moe Howard}
\hypersetup{pdftitle={Baking through the ages},
  pdfauthor={A. Baker, C. Kneader},
  pdflang={en},
  pdfkeywords={cookies, muffins, cakes},
  pdfpublisher={Baking International}
}
\begin{document}
\maketitle
This is the document.
\end{document}
3
  • I was aware of the \DocumentMetadata test phase, but unfortunately my work involves a journal processing pipeline, so I didn't want to depend on relatively recent experimental code yet. I'm confident that this will improve LaTeX handling of XMP, but the problems of producing valid PDF/A are daunting. At this point I'm leaning toward using xmpincl or maybe pdfx instead, since then I think I can use a high-level language in our journal system to produce the RDF in a robust fashion. This also gives us the chance to use XMP extension schemas. Thank you both for the valuable information.
    – mccurley
    Commented Aug 29, 2023 at 21:24
  • well it is your choice, but you should be aware the pdfmanagement is actively maintained by the LaTeX team so the same people you are depending on for the general workflow (and even if we still call it testphase, it is quite stable now). On the other pdfx hasn't been updated since 2019 and xmpincl is from 2004 and has no maintainer. Commented Aug 29, 2023 at 22:16
  • I definitely see pdfmanagement as the future, so you're right that it probably doesn't make much sense to target hyperxmp or pdfx in 2023. Part of our problem is that while I can control the LaTeX environment for compiling the papers in the cloud, I cannot guarantee that authors are using anything close to that environment to prepare their manuscripts. xmpincl is at least quite simple and easy to rip out later and we want to use extended XMP schemas. Many authors use \hypersetup in some pretty ugly ways, so I still have to figure that part out.
    – mccurley
    Commented Aug 30, 2023 at 2:08

You must log in to answer this question.

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