TransWikia.com

Unable to get break lines in URLs for bibliography

TeX - LaTeX Asked by Jinzu on September 28, 2021

I cannot get the URL address in a reference in my document to break. I looked at this question’s chosen answer URLs in bibliography: LaTeX not breaking line as expected and it did not work for me.

The citation at "14" hangs over the right edge of left column boundary

MWE:

tex file

documentclass[10pt,conference,letterpaper]{IEEEtran}
usepackage[hyphens]{url}
usepackage[hidelinks]{hyperref}
hypersetup{breaklinks=true}
urlstyle{same}
usepackage{cite}
%usepackage{parskip}
% commented for existing packages in cls
usepackage{amssymb}
usepackage{amsmath}
usepackage{mathtools}
%usepackage{amsthm}
usepackage{graphicx}
% usepackage[lined, boxed, commentsnumbered]{algorithm2e}
usepackage{algorithm}
usepackage{algorithmicx}
usepackage{algpseudocode}
usepackage[normalem]{ulem}
%usepackage{enumitem}
%usepackage{wrapfig}
%usepackage{setspace}
usepackage{subfigure}
usepackage{makecell}
usepackage{multirow}
usepackage{comment}
usepackage{url}
usepackage{caption}

Urlmuskip=0mu plus 21mu
bibliographystyle{IEEEtran}

bibliography{IEEEabrv,reference}

bib file entry not breaking

@Manual{nmonchart,
title={nmonchart},
author = "Griffiths, Nigel",
address={http://nmon.sourceforge.net/pmwiki.php?n=Site.Nmonchart},
}

I have to edit the link because of protocol

Screenshot of the paper currently

enter image description here

One Answer

There's a mistake in your bib entry: The name of the field that contains the entry's URL address should be url, not address:

@Manual{nmonchart,
  title  = {nmonchart},
  author = "Griffiths, Nigel",
  url    = {http://nmon.sourceforge.net/pmwiki.php?n=Site.Nmonchart},
}

Second, load the xurl package rather than the url package to allow linebreaking in long URL strings anywhere.

enter image description here

documentclass[10pt,conference,letterpaper]{IEEEtran}
%% (I simplified the preamble to make it truly minimal)

begin{filecontents}[overwrite]{mybib.bib}
@Manual{nmonchart,
  title  = {nmonchart},
  author = "Griffiths, Nigel",
  url    = {http://nmon.sourceforge.net/pmwiki.php?n=Site.Nmonchart},
}
end{filecontents}

usepackage{cite}
bibliographystyle{IEEEtran}

usepackage{xurl} % not usepackage{url}
urlstyle{same}
usepackage[hidelinks]{hyperref}
%Urlmuskip=0mu plus 21mu % not needed when using 'xurl' package

begin{document}
nocite{*}
bibliography{mybib}
end{document}

Correct answer by Mico on September 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP