1

I'm setting up my job application portfolio, and want to link my email address. However, when I insert the pdf with the linked email address to my portfolio, the link does not work properly anymore.

It works just fine without an underscore.

  1. Creating document "email"

    \documentclass{article}
    \usepackage[utf8]{inputenc}
    \usepackage{hyperref}
    \begin{document}
    \href{mailto:fnm_lnm@abc.org}{fnm\_lnm@abc.org}
    \end{document}
    
  2. Inserting the pdf

    \documentclass{article}
    \usepackage{pdfpages}
    \begin{document}
    \includepdf{email}
    \end{document}
    

I expect the hyperlink to be fnm_lnm@abc.org, but instead it reads lnm@abc.org.

  • Welcome to TeX.SE! Are you talking about the typeset appearance of the e-mail or about the hyperlink? – Phelype Oleinik Jan 24 '19 at 20:53
  • I'm referring to the hyperlink. – U. Manhold Jan 24 '19 at 20:55
  • For me no hyperlink is generated whatsoever. According to this thread there is a "pax" project: https://tex.stackexchange.com/q/14620/134574 I tried to make it work but failed. – Phelype Oleinik Jan 24 '19 at 21:04
  • Strange that no hyperlink at all is generated for you. In the documentation of the pdfpages package it says that it is unable to copy links. I also came across the pax project, but didn't work for me neither. – U. Manhold Jan 24 '19 at 21:26

2 Answers2

1

I found that adding \usepackage[T1]{fontenc} in line 3 of email.tex eliminates the problem. Admittedly, I don't really understand why. The link in the second pdf (generated from the file that includes email.pdf) isn't highlighted, but it does work.

Ian Thompson
  • 43,767
1

I get no link in the included pdf (as the package documents) neither xpdf nor windows firefox detect any link.

acrobat does make a bad link starting from after the _ but (I think) that is just "guessing" a link and inferring it from the text. If you use OT1 then \_ is constructed as a rule not a character, so if the pdf reader is guessing email addresses of the form <letters and dots>@<letters and dots> then it will not include the prefix. However with T1 encoding \_ does resolve to a character in the font and so the heuristic gets lucky.

David Carlisle
  • 757,742
  • Doesn't work for me, I still get the same result. Don't know why. I'm working with TeXstudio compiling with PdfLaTeX using MiKTex. Any ideas why results could differ? – U. Manhold Jan 25 '19 at 14:43
  • @U.Manhold as I say, not working is the expected outcome. There is no link in the pdf so most viewers I tried the issue does not arise at all. Only acrobat of the viewers I tried try to guess a link from the text here and guesses wrong if you use the default OT1 encoding. – David Carlisle Jan 25 '19 at 14:45