TransWikia.com

how to cite a website without getting an "underfull hbox" warning?

TeX - LaTeX Asked on April 2, 2021

I am trying to cite a website but I am getting this message

Underfull hbox (badness 1939) in paragraph at lines 9--11 

my citation is

@MISC{K&J,
author        = {k&J magnetics},
year          = {2011},
title         = {The original K&J magnet calculator},
howpublished  ={url{https://www.kjmagnetics.com/calculator.asp}},
note = {Accessed 2020-2-30},
}

the packages I am using

documentclass[5p,preprint]{elsarticle}

journal{Energy}
setcitestyle{square}
usepackage{times}
usepackage{hyperref}
usepackage{graphicx}
usepackage{subfig}
usepackage{amsmath}
usepackage[RPvoltages]{circuitikz}
usetikzlibrary{patterns}
usepackage{array,booktabs}
%usepackage[round, sort & compress]{natbib}
usepackage{tikz}
usepackage{float}
hypersetup{pdfauthor=whatever}

One Answer

Some suggestions and observations:

  • To avoid getting warning messages about either underfull or overfull lines because of URL strings, load the xurl package before loading hyperref.

  • Since the elsarticle-num bibliography style recognizes a field called url, use it, i.e, replace howpublished = {url{https://www.kjmagnetics.com/calculator.asp}}, with url = {https://www.kjmagnetics.com/calculator.asp},.

  • Encase the string K&J in the title field in curly braces to keep it from getting lowercased by BibTeX.

  • Change the author field from {k&J magnetics} to {{K&J Magnetics}} so that the author is recognized as a "corporate" author and is sorted under K, not M.

  • With the elsarticle document class, it's better to specify times as a document class option than it is to load it as a package.

enter image description here

documentclass[5p,preprint,times]{elsarticle}
journal{Energy}
begin{filecontents}[overwrite]{testbib.bib}
@MISC{K&J,
author        = {{K&J Magnetics}},
year          = {2011},
title         = {The Original {K&J} Magnet Calculator},
xxhowpublished= {url{https://www.kjmagnetics.com/calculator.asp}},
url           = {https://www.kjmagnetics.com/calculator.asp},
note          = {Accessed 2020-2-30},
}
end{filecontents}

bibliographystyle{elsarticle-num} % information gleaned from an earlier posting
setcitestyle{square}

usepackage{graphicx,subfig,amsmath,array,booktabs}
usepackage{tikz}
usepackage[RPvoltages]{circuitikz}
usetikzlibrary{patterns}

usepackage{xurl} % <-- new
usepackage[colorlinks,allcolors=blue]{hyperref}
hypersetup{pdfauthor=whoever}

begin{document}
cite{K&J}
bibliography{testbib}
end{document}

Answered by Mico on April 2, 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