# Hyperref “enquotes” metadata

EDIT: As Bill B. and Caramdir point out in their comments after Bill B. produced his results posted below, more information is needed in order to make a better call. To remedy, my output was produced using MiKTeX 2.8 pdflatex with no special command line flags or switches. My pdf viewer is Adobe Acrobat Pro 9.0. The platform is Windows 7. All software including hyperref is fully up to date against the latest rev levels and patches.

As I'm guessing that this is a pretty normal setup, at least in the Windows world, I'd be very interested (and grateful) in learning whether this problem affects other people or whether it's just some kind of rather weird one-off. My gut feel after seeing Bill B's results (and also after having traversed hyperref's code) is that the culprit is Adobe Acrobat or possibly MiKTeX pdflatex.

Can anyone corroborate? I'd be very grateful to know.

Original question:

I have a problem with hyperref; it "enquotes" Author and Keywords (but not Title or Subject) metadata if the data sent to these contain a comma or semi-colon (but not, say, a full stop or a colon).

I've included some figures and code that show this below.

\documentclass{article}

% uncomment all but one line below
%  a  b  c%     <-- no problem
a, b, c%     <-- problem
%  a; b; c%     <-- problem
%  a: b: c%     <-- no problem
%  a* b* c%     <-- no problem
}

\usepackage[
pdftitle={\metadata},    % never enquoted
pdfauthor={\metadata},   % enquoted if , or ; is present
pdfsubject={\metadata},  % never enquoted
pdfkeywords={\metadata}, % enquoted if , or ; is present
]{hyperref}

\begin{document}
Press ctl-d (in Acrobat Reader) to see pdf file metadata.
\end{document}


Not only is this quite ugly but, more importantly, it interferes with metadata extracting programs used by certain document repositories.

I've worked my way through hyperref's code without much success. Would anyone have a solution for this problem? Or advice about what I might be doing wrong?

-
Do you still get the issue if you put the metadata inside \hypersetup rather than as package options? –  Seamus Dec 1 '10 at 11:57
Also, the answers to this question might solve your problem, sort of. tex.stackexchange.com/q/5958/215 –  Seamus Dec 1 '10 at 11:58
@Seamus: yes it does, re comment 1. Many thanks for the pointer in your comment 2. As it happens, this is an Adobe Acrobat/Reader bug (ahem, feature) in the way it renders rather than stores the metadata info in the two fields I describe. While I didn't realise it when I asked my question, it turns out that the same problem happens if you manually enter the metadata in these two fields by hand. –  Geoffrey Jones Dec 1 '10 at 14:08

EDIT:

I don't have any way to test using the software you're using. But I can tell you how to narrow it down - Divide and conquer.

1. Open the PDF file in a text editor. (some of the data is binary, but the meta data is in XML)
2. Search for all occurrences of a, b, c
3. Look to see if the quotes are part of the string stored in the file.

If the quotes aren't in the PDF, then the problem is with Acrobat.

If the quotes are there, then the problem is on the MikTex side, either in the PDF generation, or perhaps something deeper into the Latex side of things.

Original Response:

I'm afraid I don't have an answer for you.

However, I cut-and-pasted the above code into a new file, compiled it, and got this:

So, whatever the problem is, it must have something to do with your software version or configuration.

-
...or the pdf viewer. –  Caramdir Oct 3 '10 at 15:43
I get the same thing as Bill B with Preview on Mac OS X. My guess is it's the pdf viewer as Caramdir said. –  TH. Oct 4 '10 at 0:42
Bill, you're a genius! The line /Author(a, b, c)/Title(a, b, c)/Subject(a, b, c)/Creator(LaTeX with hyperref package)/Producer(pdfTeX-1.40.10)/Keywords(a, b, c) appears in the non-binary part. Acrobat, not hyperref, is almost certainly the culprit. Oddly, when I manually edit out the quote marks in Acrobat Reader then save, reopen and bring up the pdf properties dialog again, the quotes do not reappear in the Keywords metadata but reappear in the Author field. A binary diff of the 2 files shows the original file contents are unaltered but new xml is appended at the end. Many thanks again! –  Geoffrey Jones Oct 4 '10 at 4:36

I'm using Acrobat Reader on Windows Vista and I see the problem as you described it. (As you already found out, it is probably irrelevant that I'm using MiKTeX 2.7.) I do not have a solution for you, but another test to prove that Acrobat is indeed the culprit: Edit the pdf-file with an editor that can handle binary files, and replace the commas in /Author(a, b, c) with colons. This makes the quotes disappear.

-
many thanks –  Geoffrey Jones Oct 16 '10 at 8:20

I noticed the same effect, it is definitely an artifact of Acrobat, not PDFLateX. Acrobat displays quotes if the author field contains commas. Tried with Adobe Acrobat Pro 9.5.4.

-
–  Peter Jansson Mar 11 '13 at 20:36