[Tex/LaTex] Break url in tabular

line-breakingtablesurls

How can I break hyperref URLs in a tabular environment. Consider the following example:

\documentclass{article}

\usepackage[colorlinks=true,linkcolor=black,anchorcolor=black,citecolor=black,menucolor=black,runcolor=black,urlcolor=black,bookmarks=true]{hyperref}
\usepackage{breakurl}

\begin{document}

\url{http://www.avery/long/url?zz/very/very/long/this/should/break/very/long/long.html}

\begin{tabular}{l l}
   A long url &
\url{http://www.avery/long/url?zz/very/very/long/this/should/break/very/long/long.html}

\end{tabular}


\end{document}

The first one breaks, the second one doesn't. The output looks like:

url

I am using pdflatex.

Best Answer

Use the p{10.0cm} column specification, which require a length. This makes the column able to have line breaks:

enter image description here

\documentclass{article}

\usepackage[colorlinks=true,linkcolor=black,anchorcolor=black,citecolor=black,menucolor=black,runcolor=black,urlcolor=black,bookmarks=true]{hyperref}
\usepackage{breakurl}

\begin{document}
\noindent
\url{http://www.avery/long/url?zz/very/very/long/this/should/break/very/long/long.html}

\noindent
\begin{tabular}{l p{10.0cm}}
   A long url &
\url{http://www.avery/long/url?zz/very/very/long/this/should/break/very/long/long.html}
\end{tabular}
\end{document}