# How to keep a link with underscore stable when inserting the pdf?

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 at 20:53
• I'm referring to the hyperlink. – U. Manhold Jan 24 at 20:55
• For me no hyperlink is generated whatsoever. According to this thread there is a "pax" project: tex.stackexchange.com/q/14620/134574 I tried to make it work but failed. – Phelype Oleinik Jan 24 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 at 21:26

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.
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.