# List of url-links with \href

When trying to create a list of weblinks using

\documentclass{report}
\usepackage{hyperref}

\begin{document}

\begin{itemize}
\item \href{www.washingtonpost.com}
\item \href{www.newyorktimes.com}
\item \href{www.lemonde.fr}
\item \href{www.guardian.co.uk}
\item \href{www.spiegel.de}
\item \href{www.bbc.co.uk/news}
\end{itemize}

\end{document}


I run into an error stating \pdfendlink cannot be used in vertical mode. What is a better approach to achieve this, or how can I modify mine?

• Use \href{www.washingtonpost.com}{washington post} – Yiannis Lazarides Nov 1 '11 at 7:55

\href takes two arguments, \href[options]{URL}{text} where the first is a full URL and the second the link text, and formats the text as normal text (see http://www.tug.org/applications/hyperref/manual.html#x1-130004 for details). So you can fix your problem by adding a full URL in the first argument and adding a second argument, i.e. \href{http://www.washingtonpost.com}{www.washingtonpost.com}.

But the easiest way to fix it may be to replace \href with \url which formats the URL in typewriter font (I've added the protocol for completeness):

\documentclass{report}
\usepackage{hyperref}

\begin{document}

\begin{itemize}
\item \url{http://www.washingtonpost.com}
\item \url{http://www.newyorktimes.com}
\item \url{http://www.lemonde.fr}
\item \url{http://www.guardian.co.uk}
\item \url{http://www.spiegel.de}
\item \url{http://www.bbc.co.uk/news}
\end{itemize}

\end{document}

• Ah, much quicker answer. You might want to add to your answer that \href formats the link as normal text, while \url uses a typewriter font. – Jake Nov 1 '11 at 8:01
• @Jake Good point. Fixed. – N.N. Nov 1 '11 at 8:08
• @Jake: But one can change the appearence of the \urls via \urlsytle{<option>} – Tobi Nov 1 '11 at 8:18
• @Jake: It is possible to setup \href to format the link as typewriter font? – Beni Bogosel Apr 11 '12 at 20:57
• @BeniBogosel: I don't think hyperref has a configuration option for this, but you could define a new command like \newcommand{\tthref}[2]{\href{#1}{\texttt{#2}}}, which will take two arguments (like \href): \tthref{<URL>}{<link text>}. – Jake Apr 11 '12 at 21:14