I would like to add pdf metadata to my output with lualatex. I know how to do it with hyperref, but I only like to include that package if I need it. Is there another way? I can use \pdfinfo with pdflatex, and a \special with xelatex, but I can't get either to work with lualatex:

% Works with pdflatex but gives error with lualatex:
%\pdfinfo{ /Title (My Story) /Author (Me) }

% Works with xelatex, but does not work with lualatex:
%\special { pdf:docinfo << /Title (My Story) /Author (Me)>> }

I lived.
  • 1
    See section 3.2.2 of LuaTeX's manual.
    – Udi Fogiel
    Feb 25 at 20:43

2 Answers 2


The problem with using the primitives is that they are not managed. That means that if your code for one or the other reason set the info more than once you end with duplicate entries in the Info dictionary:

<<  /Title (My Story) /Author (Me)  /Title (My other Story) /Author (some one else) >>

This is not allowed.

That's one of the reasons why the PDF management exists. It takes care of this. With its low-level commands you can insert the title like this:



The last setting will win. Be aware that with this it is your task to ensure that the string is valid in PDF, so you must add parentheses and escape non-ascii etc.

More easy it is with the new title module in latex-lab. This requires a current, up-to-date tex system:

\title{my story}
  • Ooo, is this the way of the future (tl2024)? It looks a lot cleaner.
    – dedded
    Feb 25 at 22:11
  • @dedded Yes, we are integrating a lot into the kernel - but it's not easy work, so baby steps
    – Joseph Wright
    Feb 25 at 22:15
  • @dedded \DocumentMetadata is already in texlive 2023, Feb 25 at 22:37
  • @DavidCarlisle yes, but the title module is brand new ;-) Feb 25 at 22:43
  • @UlrikeFischer I chose my words carefully:-) Feb 25 at 22:45

With Udi Fogiel's helpful comment I resolved it with this:


  % From section 3.2.2 of Luatex manual:
  \pdfextension info { /Title (My Story) /Author (Me) }
  \special { pdf:docinfo << /Title (My Story) /Author (Me)>> }
  \pdfinfo{ /Title (My Story) /Author (Me) }

I lived.
  • using tex primitives in this way does make it harder to make the document portable across engines or work with Packages such as the latex tagging code that need to manage global document metadata. Feb 25 at 21:00
  • Is there an alternative? I can protect it against other engines with \ifluatex , but don't know anything about tagging.
    – dedded
    Feb 25 at 21:11

You must log in to answer this question.

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