1

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}
9
  • Please tell us whether you load the xurl package. (Hint: You should.)
    – Mico
    Sep 6, 2020 at 17:06
  • Maybe loading hyperref and deleting \url{...} from howpublished. Sep 6, 2020 at 17:07
  • I updated the question and added the packages I am using. What is the xur1 and how can I use it?
    – soooleh
    Sep 6, 2020 at 17:17
  • Luis, what do you mean by deleting \url
    – soooleh
    Sep 6, 2020 at 17:18
  • 1
    @soooleh and @Mico, my comment was clearly sloppy, what I mean is that is shouldn't be (or at least I believe) an \url inside a field when there is a dedicated field named url Sep 6, 2020 at 18:43

1 Answer 1

1

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}

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.