Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In another, now rather confused, question, I'm struggling to get copyright information into a PDF produced by memoir.

The investigations so far have led to this problematical MWE:

% !TEX TS-program = XeLaTeX
% !TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage{lipsum}
\usepackage{hyperref}
\usepackage{hyperxmp}
\hypersetup{
    pdfauthor={Brent Longborough},
    pdftitle={O Hai},
    pdfcopyright={Copyright © 2012 by Brent Longborough. All rights reserved.},
    }
\begin{document}
\lipsum[1]
\end{document}

which produces a PDF with the copyright notice successfully included in the metadata, and with the "PDF Producer" set to "XeTeX 0.9997"

However, if I change the document class to:

\documentclass{memoir}

then I get no copyright notice, and the PDF Producer is now set to "xdvipdfmx (0.7.8)".

After an hour or so ploughing through memoir.sty and memhfixc.sty, I'm flummoxed. Does anyone have any idea where to look next?

share|improve this question
1  
Is there a missing left brace in the pdfcopyright line? –  Seamus Feb 28 '12 at 12:46
    
@Seamus: Well spotted, actually, I think it's missing both left and right (as the right one you can see actually closes \hypersetup{) –  Brent.Longborough Feb 28 '12 at 15:54
add comment

1 Answer

up vote 17 down vote accepted

This is actually a timing problem: The metadata has to be inserted before the final \clearpage command, otherwise, it isn't written to the PDF document any more. However, memoir issues a \clearpage with

\AtBeginDocument{\AtEndDocument{\clearpage\dol@stsheet\dol@stpage}}

so the code used by hyperxmp

\AtBeginDocument{%
   % [...]
      \AtEndDocument{%
        \hyxmp@find@metadata
        \hyxmp@embed@packet
      }%
   % [...]
}

is too late as \hyxmp@find@metadata and \hyxmp@embed@packet are executed after \clearpage.

To solve this, you can manually issue

\makeatletter
  \AtEndDocument{\hyxmp@find@metadata\hyxmp@embed@packet}
\makeatother

in your document's preamble.

Minimal test code:

% !TEX TS-program = XeLaTeX
% !TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage{lipsum}
\usepackage{hyperref}
\usepackage{hyperxmp}
\makeatletter
  \AtEndDocument{\hyxmp@find@metadata\hyxmp@embed@packet}
\makeatother
\hypersetup{
    pdfauthor={Brent Longborough},
    pdftitle={O Hai},
    pdfcopyright=Copyright © 2012 by Brent Longborough. All rights reserved.}
\begin{document}
\lipsum[1]
\end{document}
share|improve this answer
    
Yes, that fixes. +1, accepted, and my heartiest congratulations. –  Brent.Longborough Feb 28 '12 at 12:44
1  
Worth filing a bug report perhaps? But whose bug is this? memoir or hyperxmp? –  Seamus Feb 28 '12 at 12:47
    
@Seamus: I'll talk to Lars. I think the right place for this is in memhfixc.sty, but I have no idea where. –  Brent.Longborough Feb 28 '12 at 16:28
    
Might also be an idea to talk to Heiko (but please do send me an email, I tend to forget what I have read online) –  daleif Feb 28 '12 at 16:47
    
@daleif: Sent!! Thanks. (I do too, especially when it annoys me, as it often does these days.) –  Brent.Longborough Feb 28 '12 at 17:56
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.