2

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}
\addbibresource{references.bib}

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

Produces the following result: enter image description here

How can this be fixed?

3

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!

enter image description here

\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}
\addbibresource{references.bib}
\usepackage{xurl}
\begin{document}
    \cite{ons}
    \newpage
    \printbibliography
\end{document}
| improve this answer | |
  • 1
    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

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.