# Force linebreak in URL with beamer, biblatex and biber

The URL in my MWE does not break because it fits on one line. This leads to three lines in the bibliography although two would suffice.

How can I force it to break the URL to compress it to two lines? I tried the ususal approaches, but they did not work, presumably because the URL is not long enough.

\documentclass[aspectratio=169]{beamer}

\usepackage{filecontents}
\begin{filecontents}{myurl.bib}
@online{longurl,
author  = "Someone, Nice",
title   = "This is my URL",
year    = "2017",
url     = "http://abc.efghij.kl.mn/~kausgdha/longsolong/anurlso/looong.html",
urldate = {2017-11-27},
}

\end{filecontents}

\PassOptionsToPackage{hyphens, spaces, obeyspaces}{url}

\usepackage{hyperref}
\hypersetup{
}

\usepackage[backend=biber]{biblatex}

\begin{document}

\nocite{longurl}
\frame[allowframebreaks]{\printbibliography}

\end{document}


This is a quirk of \raggedright and where the breaks fall in this particular url. TeX doesn't seem to be able to find a good line break. You could try using the ragged2e package and \RaggedRight before \printbibliography.

\documentclass[aspectratio=169]{beamer}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@online{longurl,
author  = "Someone, Nice",
title   = "This is my URL",
year    = "2017",
url     = "http://abc.efghij.kl.mn/~kausgdha/longsolong/anurlso/looong.html",
urldate = {2017-11-27},
}
\end{filecontents}
\usepackage{biblatex}
\usepackage{ragged2e}