In LaTeX's article
documentclass, how do I (using hyperref
, if I understood right) get email links to show in color (say, red) when I type them in the middle of a paragraph?
[Tex/LaTex] How to get email to show in color when typed in text
colorhyperref
Best Answer
Depending on your preference, you could do any one of the following:
If you just want to typeset it in colour, without any linking capabilities, you could use
Note the scoping of the
\color{...}
by putting it within{ }
, otherwise all the text following the command will be typeset in red. Compiling this may cause some unwanted linking of@cares.com
, while leavingwho
unlinked.The
hyperref
package does allow linking through a number of commands. You're probably interested in using the\url{...}
command, since it takes care of the tricky@
that has to be escaped in order to be typeset. It will also take care of breaking the email address (or url) across lines, if needed.This is also not entire accurate if you want to hyperlink to an email (via a
mailto
protocol).Using
hyperref
's\href{<url>}{<text>}
provides the correct action:You can also typeset the email address in a different shape using, say,
\texttt{who@cares.com}
. Then it will be typeset similarly to that of option 2.