The following used to be OK. With the most recent release of hyperxmp, it no longer does, giving error:

./hypersetup-bug.tex:9: Argument of \hyxmp@pdf@to@xmp@date has an extra }.
<inserted text> 
l.9 }

How can this be fixed or worked around?


\usepackage{hyperxmp} % to add metadata info into pdf



I tried changing the preamble so as to include the following:


That avoids the error. However, I still want to be able to include in the text of the document a date of a form such as "December 1, 2020". Unfortunately, timedate2 has redefined \today, and I cannot figure out from that package's documentation to have both 2020-112-01 as the value of \today in the argument to \hypersetup, on the one hand, and somehow nanipulate the date so as to have the wordy form "December 1, 2020" within the body of the document.

1 Answer 1


The error stems from the requirement that pdfdate needs to be in a specific format, not <monthname> <day>, <year>. The hyperxmp documentation mentions:

XMP metadata can include a number of dates (in fact, timestamps, as they include both date and time components). pdfdate specifies the document date. It is analogous to the LaTeX \date command, and, like \date, defaults to the date the document was built. It must be specified in either XMP format or PDF format.

Your date format doesn't match either of these. As you found, including datetime2 fixes this as it suddenly conforms to the PDF date format. However, in order to get your desired in-document date display, you need to redefine the date format. Here's how:



\usepackage{hyperxmp} % to add metadata info into pdf

  pdftitle = {A title},
  pdfauthor = {An author},
  pdfapart = 2,
  pdfaconformance = U,
  pdfdate = {\today}


% Set a new date style/representation
  % \DTMdisplaydate{<year>}{<month>}{<day>}{<day of week>}
    \DTMenglishmonthname{##2} \number##3, \number##1 }%
   \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% Capitalization of \DTMdisplaydate
\DTMsetdatestyle{usdate}% Use the above-defined date for date representation within the document




  • That redefinition of \DTMdisplaydate has one problem: when in the body of the document the command \today is executed, it erroneously prints a new paragraph consisting of just a comma.
    – murray
    Dec 2, 2020 at 16:22
  • @murray: That's unrelated to the date setting. You need to supply addition PDF-related entries, like pdftitle and pdfauthor (at least). I've updated my answer to include that.
    – Werner
    Dec 2, 2020 at 17:13
  • Yes, I figured that out, too. Thanks for your datetime2 solution. Digging through the package's documentation wasn't easy, with too few examples. (The thoughtful documenter includes plenty of examples along with the bare-bones reference marerial.)
    – murray
    Dec 2, 2020 at 20:48
  • The spurious comma-only paragraph seems to be caused not by the redefinition of \DTMdisplaydate but rather by my omitting from the MWE some necessary items in the \hypersetup arguments consistent with hyperxmp, namely, pdftitle and pdfauthor. With those items included, the comma-only paragraph disappears.
    – murray
    Dec 2, 2020 at 20:49

You must log in to answer this question.

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