# \url{} links with percent (%) signs and overfull hbox error

I have looked at the first comment to this question on % in urls and found that I didn't need to type \ ahead of each %. However, in WinEdt 7.1, everything from the first % in the first URL is now greyed out and I do not know if this is why I am getting an error with the overfull \hbox when I compile to PDF.

The problem in LaTeX is

proposal P293 (see \url{http://www.foodstandards.govt.nz/code/proposals/documents/Reanalysis%20of%20Nutriti.pdf} and \url{http://www.foodstandards.govt.nz/code/proposals/documents/P293_SD3.pdf} for the full analysis reports of the experiments).


The auto linebreak for the second URL should be after /code and not after /proposals as /proposals is going past the right hand margin in my document.

How can I force the linebreak to occur in the correct place in the second URL and still have the link work correctly?

The start of my report class is

\documentclass[11pt,PhD]{muthesis}
\usepackage[english]{babel}
\usepackage{amsmath,amsthm}
\usepackage{amsfonts}
\usepackage[a4paper,layout=a4paper,
bindingoffset=4cm,left=0cm,right=2cm,
\usepackage{microtype}
\usepackage{verbatim}
\usepackage{graphicx}
\usepackage{url}
\usepackage[round]{natbib}
\usepackage{listings}
\usepackage{booktabs}
\usepackage{multirow}
\RequirePackage[l2tabu, orthodox]{nag}
\usepackage{cleveref}


Use the hyperref package to improve the behavior of the \url command. Use it with hidelinks option to view black links. If you don't use \% (using the url or hyperrefpackages) all that happens is that WinEdt means a comment but nothing wrong happens to the output document.

Add the \sloppy command to solve the problem with overfull boxes.

\documentclass[11pt,PhD]{muthesis}
\usepackage[english]{babel}
\usepackage{amsmath,amsthm}
\usepackage{amsfonts}
\usepackage[a4paper,layout=a4paper,
bindingoffset=4cm,left=0cm,right=2cm,
\usepackage{microtype}
\usepackage{verbatim}
\usepackage{graphicx}
\usepackage[round]{natbib}
\usepackage{listings}
\usepackage{booktabs}
\usepackage{multirow}
\RequirePackage[l2tabu, orthodox]{nag}
\usepackage{cleveref}
\begin{document}
\sloppy
proposal P293 (see \url{http://www.foodstandards.govt.nz/code/proposals/documents/Reanalysis\%20of\%20Nutriti.pdf} and \url{http://www.foodstandards.govt.nz/code/proposals/documents/P293_SD3.pdf} for the full analysis reports of the experiments).
\end{document}


You can read what the sloppy command does.

• The \sloppy command has stopped the behaviour in the paragraph. I tried to use the hyperref package as suggested but got the apparently common error ! Argument of \contentsline has an extra }.' and my dissertation no longer compiled. I haven't been able to locate the source of that problem in the .cls or elsewhere, so I have chosen not to use that extra package. – Michelle Nov 11 '13 at 5:04
• @Michelle If with the url package works well, then use it. I recommend hyperref only to have a hyperlink. However it is strange that this error occurs, there must be something in the document that causes it. – OSjerick Nov 11 '13 at 12:15
• \sloppy affects the entire document. it's better to use \begin{sloppypar} ... \end{sloppypar} around just the paragraph or section that contains the problematic url to limit its effect. – barbara beeton Nov 11 '13 at 14:02
• @barbarabeeton certainly is a better solution. – OSjerick Nov 11 '13 at 14:19

I would just reformulate the sentence;

\documentclass[11pt]{muthesis}


If this is not an option, use the sloppypar` environment as mentioned by barbara beeton in a comment to OSjerick's answer.