# BibLaTeX overflowing URL

When using biblatex with a long URL without many forward slashes the URL overflows outside of the margins of the page.

For example:

references.bib

@online{ons,
author = "Office for National Statistics",
title = "Overview of the UK population: July 2017",
url = {https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/articles/overviewoftheukpopulation/july2017},
year = "2017"
}


main.tex

\documentclass[12pt,a4paper]{article}

\usepackage[style=ieee,citestyle=ieee,dashed=false]{biblatex}

\begin{document}
Lots of text
...
\cite{ons}
\newpage
\printbibliography
\end{document}


Produces the following result:

How can this be fixed?

• Welcome to tex.sx. There are lots of other questions about this problem. This one may contain some useful information. – barbara beeton Apr 10 '19 at 17:49
• Note that you should be wrapping so-called corporate authors like Office for National Statistics in an additional pair of braces (tex.stackexchange.com/q/10808/35864): author = {{Office for National Statistics}},. You should also protect UK and July in the title from unwanted case change: title = {Overview of the {UK} population: {July} 2017}, (tex.stackexchange.com/q/10772/35864). – moewe Apr 10 '19 at 17:52
• – moewe Apr 10 '19 at 17:54

Three suggestions:

• Load the xurl package. It allows line breaks in URL strings at arbitrary positions.

• Encase the author field in an extra pair of curly braces, so that biber/bibtex doesn't misinterpret the name as consisting of first name component "Office", von component "for", and surname component "National Statistics". Observe that in the screenshot you posted, the "first name component" got truncated to its initial, "O.". Not good!

• Encase the word UK in a pair of curly braces, to keep it from getting lowercased. Again, look at the screenshot you posted: The word "UK" got rendered as "uk". Not good!

\RequirePackage{filecontents}
\begin{filecontents}{references.bib}
@online{ons,
author = "{Office for National Statistics}",
title = "Overview of the {UK} population: July 2017",
url = {https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/articles/overviewoftheukpopulation/july2017},
year = "2017"
}
\end{filecontents}

\documentclass[12pt,a4paper]{article}
\usepackage[style=ieee,citestyle=ieee,dashed=false]{biblatex}

• An additional comment: I believe that the BibTeX style file IEEEtran.bst typesets URL strings using the basic ("roman") text font, not in a monospaced font as is shown in the screenshot above. If you need to copy the IEEEtran settings, simply add the instruction \urlstyle{same} after loading the xurl package. – Mico Apr 10 '19 at 18:06