3

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{
  breaklinks=true
}

\usepackage[backend=biber]{biblatex}
\addbibresource{myurl.bib}

\begin{document}

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

\end{document}

url does not break, entry has three lines

2

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}
\addbibresource{\jobname.bib}
\setbeamertemplate{navigation symbols}{}
\begin{document}
\nocite{longurl}
\frame[allowframebreaks]{\RaggedRight\printbibliography}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.