# \input{glyphtounicode} with \pdfgentounicode=1 creates unwanted hyperlinks from link-like text

I often use \input{glyphtounicode} \pdfgentounicode=1 to generate PDF-files whose contents paste with the correct Unicode codepoints. However I noticed that as a side effect of these commands, some weblinks are created that I didn't explicit call for (using for example hyperref).

\documentclass{article}

% If at least one of the following two lines is omitted,
% the two text strings won't generate weblinks.
\input{glyphtounicode}
\pdfgentounicode=1

\begin{document}

\end{document}


If either of the two relevant commands above is omitted, www.google.com and http://www.google.com/ will not appear as hyperlinks in the generated PDF-file. (I use Adobe Reader to view them.) Why? How can I prevent these text strings from producing hyperlinks?

• Ask adobe (assuming you are using adobe reader). Obviously the reader is guessing that these are links. Jul 8, 2013 at 10:38
• a lot of others PDF viewer assume that and it can be disabled in the prefences of the viewer.
– user2478
Jul 8, 2013 at 10:40
• @Herbert Why do these links not appear when one of the two commands above is commented out? It must be more complicated than that. Also, if I for example replace the two lines in the preamble by \usepackage{hyperref}, no links are created. Jul 8, 2013 at 10:44
• If I try with xpdf I see no link, so it's a previewer's feature. Jul 8, 2013 at 10:46
• @LoverofStructure: The reader is using the names of the glyphs to decide if a sequence of glyphs is a link or not. So everything that change this names can affect the heuristic. E.g. \usepackage[T1]{fontenc} and \usepackage{lmodern} "creates" links too. Jul 8, 2013 at 11:33

## Why are these links generated?

In this case, Adobe Reader is deducing that they are links. (Ulrike Fischer) But this is viewer-dependent: the TeXworks viewer doesn't produce automatic links, but Preview does (and even without glyphtounicode.tex's mechanics). (Joseph Wright)

## How can I prevent these text strings from producing hyperlinks?

For Adobe Reader XI, one can enable or disable the following checkbox: PreferencesGeneralBasic ToolsCreate links from URLs.

## Why is link creation dependent on the two commands \input{glyphtounicode} and \pdfgentounicode=1?

The reader is using the names of the glyphs to decide whether a sequence of glyphs is a link. Usage of the glyph names depends on these two crucial lines. (adapted from Ulrike Fischer)

The most important parts from glyphtounicode.tex seem to be the following lines:

\pdfglyphtounicode{a}{0061}
\pdfglyphtounicode{b}{0062}
...
\pdfglyphtounicode{z}{007A}


and

\pdfglyphtounicode{colon}{003A}
\pdfglyphtounicode{slash}{002F}
\pdfglyphtounicode{period}{002E}


Without colon or slash, the lower text will have only its second part appear as a link. Without period, only the lower text is linked, but it is linked in its entirety.

The lower-case letters seem to have duplicates

\pdfglyphtounicode{Asmall}{0061}
\pdfglyphtounicode{Bsmall}{0062}
...
\pdfglyphtounicode{Zsmall}{007A}


that seem to not make a difference.

As for the capital letters:

\pdfglyphtounicode{A}{0041}
\pdfglyphtounicode{B}{0042}
...
\pdfglyphtounicode{Z}{005A}


With

WWW.GOOGLE.COM


the lower but not the upper text will be linked. Without capital letters, www.GOOGLE.COM is still recognized. This indicates that the capital letters play a role, but there are some details to explore.