6

I have tried some solutions proposed by others (URLs in bibliography: LaTeX not breaking line as expected), but in vain. The long URL still goes into the margin. How can I break a very long URL in the reference? Thanks!

enter image description here

% !TEX program = pdflatex

% !BIB program = biber

\documentclass{report}

\usepackage[ backend = biber, style = apa, doi = false, url = true, isbn = false]{biblatex}

\addbibresource{Thesis.bib}

\begin{document}

Cite this article: \parencite{OFFICEFORNATIONALSTATISTICS_MiddleSuperOutput_2018}.

\printbibliography[title = References]

\end{document}

Thesis.bib

@online{OFFICEFORNATIONALSTATISTICS_MiddleSuperOutput_2018,
  title = {Middle {{Super Output Area Population Estimates}} (Supporting {{Information}})},
  author = {{Office for National Statistics}},
  date = {2018},
  url = {https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/datasets/middlesuperoutputareamidyearpopulationestimates}
}
moewe
  • 175,683
Frank KKK
  • 215

1 Answers1

6

The xurl package builds on the url package and allows line breaks in arbitrary positions in the URL string.

enter image description here

% !TEX program = pdflatex
% !BIB program = biber

\documentclass{article}

\begin{filecontents}[overwrite]{Thesis.bib} @online{ONS_MiddleSuperOutput_2018, title = {{Middle Super Output Area Population Estimates (Supporting Information)}}, author = {{Office for National Statistics}}, date = {2018}, url = {https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/datasets/middlesuperoutputareamidyearpopulationestimates} } \end{filecontents}

\usepackage[style = apa, url = true, doi = false, isbn = false]{biblatex} \addbibresource{Thesis.bib}

\usepackage{xurl} % <-- new

\begin{document} \noindent \parencite{ONS_MiddleSuperOutput_2018}. \printbibliography[title = References] \end{document}

Mico
  • 506,678