josephwright / luatex85

This package provides emulation of pdfTeX primitives for LuaTeX v0.85+
3 stars 0 forks source link

\def\pdfcreationdate {\pdffeedback creationdate} is not enough for hyperxmp #2

Closed Lenchik closed 8 years ago

Lenchik commented 8 years ago
% !TeX program = lualatex 
\RequirePackage{luatex85}
\documentclass{book}
%\edef\pdfcreationdate {\pdffeedback creationdate} % Cannot compile without this line. Error "! Argument of \hyxmp@pdf@to@xmp@date has an extra }."
\usepackage{hyperxmp}
\begin{document}
Some text 
\end{document}

All in the code. luatex85 version 1.2 from tlnet update of TeXLive 2016.

davidcarlisle commented 8 years ago

Hmm yes, in general it isn't possible to "fake" a primitive by a macro and get the same number of expansion steps, but the hyperxmp package assumes \pdfcreationdate just takes one expansion step to return the date.

For most of the \pdffeedback cases I think that's unavoidable, for example if you try to remove one layer of expansion from \pdffontname, either by using edef or a chain of \expandafter then you get an error about the missing font identifier. \def\pdffontname {\pdffeedback fontname}

so you have to use \def.

However as creationdate doesn't take any more arguments and is essentially a constant I think you are probably correct that edef is safe here, and certainly works better for this example. @josephwright ??

josephwright commented 8 years ago

Yes, though Hans shows this as a \def in the LuaTeX manual. Probably make the change for now and revisit if it goes wrong later!

davidcarlisle commented 8 years ago

OK I added the edef but actually luatex85 isn't enough to give compatibility for the package it now says

Package hyperxmp Warning: Unrecognized hyperref driver `hluatex'.
(hyperxmp)                qq205.tex's XMP metadata will *not* be
(hyperxmp)                embedded in the resulting file.

Until hyperxmp is updated you would need


 \RequirePackage{luatex85}
 \documentclass{book}
 \usepackage[pdftex]{hyperref}
 \usepackage{hyperxmp}
 \begin{document}
 Some text 
 \end{document}

so that hyperref stays in pdftex mode as well.

davidcarlisle commented 8 years ago

I just mailed Scott Pakin, the hyperxmp author, pointing to this thread. The changes required to make the package work without luatex85.sty would not be large so hopefully this situation is only temporary.

Lenchik commented 8 years ago

Great!

you are probably correct that edef is safe here

I am glad it worked. Every time reading theory and examples of expansions they look pretty straightforward, but then real issues come... as mindblowing disaster for me.

davidcarlisle commented 8 years ago

New version uploaded to ctan (will take a day or so to appear in distributions)