### Url Linebreaks with hyphens

In LaTeX, urls are best embedded in a document, using the url package.
This package is supposed to take care of the proper formatting of urls which are inserted using the \url{...}  command.
The package should also break urls properly if they exceed the length of a line. Unfortunately, this does not work in all cases.

In my case (using pdflatex), I tried to embed the url http://www.uni-bamberg.de/en/pi/bereich/research/software-projects/pattern-based-analysis-of-orchestration-languages/ which is obviously quite long and does not fit into a single line.
The problem here is that the url package does not break hyphens by default. This can be enabled by loading the package with the hyphens option.
For some reason, this did not yet fix my problem.

After a while of google-ing and reading, I found a way to fix this, although this means to modify the line breaking mechanism of TeX itself.
The \sloppy command tells TeX to break lines less often at the cost of more space between single words in a line. My default configuration is \fussy which breaks lines more often, but minimizes the space between single words.
So my solution of line breaking for long urls with hyphens looks as follows:

%...
\usepackage[hyphens]{url}
%....
\begin{document}
....
\sloppy
\url{http://www.uni-bamberg.de/en/pi/bereich/research/software-projects/pattern-based-analysis-of-orchestration-languages/}
\fussy
....
\end{document}


Put in words, I change the line breaking mechanism just before embedding the large url and then change it back to the default. This is not a beatiful solution at all, but at least a working and quick one.

Edit: In the end, I also shortend the url. So for anyone who is interested, you can find it at http://www.uni-bamberg.de/en/pi/bereich/research/software-projects/pattern-based/ The above method works nevertheless.