Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to add clickable hyperlinks and email addresses in LaTeX

📅 2010-Jan-19 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

Hyperlinks can be added to a LaTeX document by using the commands from the hyperref package:

\documentclass[a4paper]{article}
\usepackage{hyperref}   % Package for hyperlinks

\begin{document}
\href{http://web.media.mit.edu/~minsky/}{Marvin Minsky}\\   % Text to URL
\url{http://web.media.mit.edu/~minsky/}\\                   % Text is URL
\href{mailto:linus@kernel.org}{Email Linus}                 % Email
\end{document}

 

Note that the URL is displayed in a fixed-width font. This is the default font used for the \url command. If you want the URL to be displayed in the same font as that used for the rest of the document, use the \urlstyle command as follows:

\documentclass[a4paper]{article}
\usepackage{hyperref}   % Package for hyperlinks

\begin{document}
% Default URL font
\url{http://web.media.mit.edu/~minsky/}\\
% Set URL font to same as current text font
\urlstyle{same}
\url{http://web.media.mit.edu/~minsky/}\\
\end{document}