2

I am writing a paper using the LNCS style and I have a lot of Underfull \hbox warnings because URLs generated from the doi attribute of a Bib item do not split into multiple lines.

The LNCS style convert bibliography item doi value such as: 11.1111/111-1-1111-1111-1\_11 into URL form: https://doi.org/11.1111/111-1-1111-1111-111.

Below is the minimum working example that generates the warning:

\documentclass{llncs}
\begin{document}

  Hello world, I cite somebody here \cite{Somebody}.

\bibliographystyle{splncs04}
\bibliography{paper-bibliography}
\end{document}

In the paper-bibliography.bib file I have the following entry:

@inbook{Somebody,
  author = {Somebody Someone},
  year = {2014},
  pages = {193--198},
  title = {Paper, Rock, and Scissors},
  isbn = {123-1-1234-1234-4},
  doi = {11.1111/111-1-1111-1111-1\_11}
}

The code resulting in something like below:

enter image description here

and generated the following warning:

Underfull \hbox (badness 10000)

I expect to avoid the Underfull warning and get the following result, where the URL is split into two lines, like the following

enter image description here

What I did to get the expected results is somewhat a hack to the Bib entry:

@inbook{Somebody,
    author = {Somebody Someone},
    year = {2014},
    pages = {193--198},
    title = {Paper, Rock, and Scissors},
    isbn = {123-1-1234-1234-4},
    url = {\url{https://doi.org/11. 1111/111-1-1111-1111-1\_11}}
}

I changed the doi entry to: url = {\url{https://doi.org/11. 1111/111-1-1111-1111-1\_11}} and able to get the desired result. However, I don't think it is a good idea to change the doi values of all Bib entries that way.

Is there any proper way to get the expected result without modifying Bib item's doi value?

1 Answer 1

2

A good solution is to the xurl package that allows URLs to be split at arbitrary positions.

A problem with splncs04 and llncs.cls is that it defines doi as plain text string (unless the hyperref package is loaded). A way to obviate to this issue is to add

@preamble{ "\renewcommand{\doi}[1]{\url{https://doi.org/#1}}" }

to the bib file, and use

doi = {11.1111/111-1-1111-1111-1\_11}

i.e., for the doi (so the doi without the common prefix). In case, one wants the doi in the same font as the text, include

\urlstyle{rm}

in the preamble.

4
  • I tried and the URL does split into two lines if I use doi = {\url{11.1111/111-1-1111-1111-1\_11}}. However, another problem arise, the font type for the https://doi.org/ and the trailing doi path differ.
    – Aryo
    Feb 4, 2021 at 5:23
  • The added details solve the problems. Just to mention, using the url package also works instead of xurl. Thank you.
    – Aryo
    Feb 4, 2021 at 23:08
  • The xurl package internally calls the url package and offers more points where a URL can be broken.
    – Guido
    Feb 5, 2021 at 4:58
  • Can this be done to the \doi macro in the doi.sty package somehow? I honestly do not know how to put the \url macro in its \@doi command to get the printed text to break Nov 19, 2021 at 7:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .