# Is it a good practice if we always locally precede \href with \sloppy?

Is it a good practice if we always locally precede \href with \sloppy as follows?

if you are interested to know the details,
\href{mailto:asdfkoafdkfaldfkafsdfkdf@kdsoffkdlfasdfjaldf.xxx}
{asdfkoafdkfaldfkafsdfkdf@kdsoffkdlfasdfjaldf.xxx}}.

-
Best email address ever... –  Pureferret Sep 2 '12 at 12:04
How did you get the idea to do that? –  Martin Schröder Sep 3 '12 at 6:34
@MartinSchröder: Because I previously assumed that \sloppy can work in a word scope. I did not know it must be in a paragraph scope. –  Please don't touch Sep 3 '12 at 7:38

No. Placed there the command \sloppy has no effect:

\documentclass{article}
\usepackage{hyperref}
\usepackage[width=7cm]{geometry}
\begin{document}

If you are interested to know the details,
\href{mailto:asdfkoafdkfaldfkafsdfkdf@kdsoffkdlfasdfjaldf.xxx}
{asdfkoafdkfaldfkafsdfkdf@kdsoffkdlfasdfjaldf.xxx}}.

If you are interested to know the details,
\href{mailto:asdfkoafdkfaldfkafsdfkdf@kdsoffkdlfasdfjaldf.xxx}
{asdfkoafdkfaldfkafsdfkdf@kdsoffkdlfasdfjaldf.xxx}.

\end{document}


The command \sloppy only works with complete paragraphs, so one would need to write

{\sloppy
If you are interested to know the details,
\href{mailto:asdfkoafdkfaldfkafsdfkdf@kdsoffkdlfasdfjaldf.xxx}
{asdfkoafdkfaldfkafsdfkdf@kdsoffkdlfasdfjaldf.xxx}}.
\par
}


or use sloppypar. However, this is often not satisfactory. Some discussion may be found in l2tabu. In your case, I suggest you use

\url{asdfkoafdkfaldfkafsdfkdf@kdsoffkdlfasdfjaldf.xxx}


Hyperref should be able to deduce the link type and it provides more break points LaTeX can use. For a more realistic example, where there are more .'s in the email address, this gives rather good results:

If you are interested to know the details,