5

I am trying to have something like {name1, name2}@server.com where name1 and name2 have hyperlinks of name1@server.com and name2@server.com. This is my code:

\usepackage{hyperref}

\{\href{mailto:name1@server.com}{name1}
\href{mailto:name2@server.com}{name2}\}@server.com

but in the out put, }@server.com has also a link which is }@server.com. The only solution I found for this is to have a space between } and @ which I don't like it. Is there anyway to disable the hyperlink for @ so that the output would be {name1, name2}@server.com where name1 and name2 have hyperlinks of name1@server.com and name2@server.com?

1
  • I think, this comes from your pdf-viewer which automatically recognizes potential hyperlinks. I actually don't know how to come by, maybe you can somehow exchange the dot with something else, so your pdf-viewer can't recognize it anymore.
    – musicman
    May 21, 2014 at 16:31

1 Answer 1

8

It's the heuristics of the PDF viewer, that turns "}@server.com" into a link. At least with AR9/Linux, the heuristics is defeated, if the dot comes from a different font, e.g. a math font:

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\{\href{mailto:name1@server.com}{name1},
\href{mailto:name2@server.com}{name2}\}@server$.$com
\end{document}

Different method using an invisible explicit space character

The next example inserts an explicit space character after @ to fool the heuristics to see }@ server.com instead of }@server.com:

\documentclass{article}
\usepackage{hyperref}

\newfont{\spacefont}{phvr8r}
\newcommand*{\dummyspace}{%
  \leavevmode
  \rlap{\spacefont\symbol{32}}%
}

\begin{document}
\{\href{mailto:name1@server.com}{name1},
\href{mailto:name2@server.com}{name2}\}@\dummyspace server.com
\end{document}

Remarks:

  • An explicit space character is a little tricky, because TeX usually replaces the space with horizontal skip space. Therefore I have used a different font that does have a space character at position 32 (space).

(In a pre-release version of pdfTeX 3.14159265-2.6-1.40.15 for TeX Live 2014 it triggered a bug, see bug report on pdfTeX mailing list. The bug is now (2014-05-23) fixed.)

3
  • Thanks @Heiko, but the first solution doesn't work!
    – NESHOM
    May 22, 2014 at 3:43
  • @M0HS3N: It depends on the heuristics of the used PDF viewer and even the version of the PDF viewer. May 22, 2014 at 12:12
  • @ Heiko Oberdiek: I tried your second solution and it works. Thank you.
    – NESHOM
    May 23, 2014 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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