2

Many bibliography entries in the document I am writing produce overfull hboxes. I have attached a small example that shows this undesired behavior below.

I think the problem could easily be fixed by allowing bigger inter-word spaces. While very long inter-word spaces can also look ugly, I am willing to accept them in the bibliography. However, I do not want them in the main text of the document or the appendix (which follows after the bibliography)

So my question is: How do I allow LaTeX to use bigger inter-word spaces in the bibliography?

I would prefer a solution that achieves this, while only requiring changes in the preamble of the document. (In order to keep the body of the document uncluttered)

Of course, entirely different solutions that remove the overlong lines from the bibliography are also welcome.

Small example:

\documentclass{article}

\usepackage[style=alphabetic,maxnames=9,backend=biber]{biblatex}

\begin{filecontents}{references.bib}
@inproceedings{bad,
  title         = {{The Protracted Example Heading for Parametrized Bibliography Entries}},
  author        = {James Smith and John Johnson and Robert M. Williams and David Brown and Richard Anderson},
  booktitle     = {Proceedings of the 18th Annual Symposium on Fictional Content with Long Titles},
  publisher     = {Publishing},
  series        = {Lecture Notes and Other Stuff},
  volume        = {1337},
  pages         = {290--301},
  year          = {2019}
}
@inproceedings{better,
  title         = {{The\, Protracted\, Example\, Heading\, for\, Parametrized Bibliography Entries}},
  author        = {James Smith and John Johnson and Robert M. Williams and David Brown and Richard Anderson},
  booktitle     = {Proceedings of the 18th Annual Symposium on Fictional Content with Long Titles},
  publisher     = {Publishing},
  series        = {Lecture Notes and Other Stuff},
  volume        = {1337},
  pages         = {290--301},
  year          = {2019}
}
\end{filecontents}

\addbibresource{references.bib}

\begin{document}
\cite{bad}
\cite{better}
\printbibliography
\end{document}

The citation of bad results in an overfull line. Citing better "solves" this by artificially inserting longer spaces.

PDF produced by the example

3
  • Welcome...Do you try for the PlainTeX command \spaceskip?
    – MadyYuvi
    May 13 '20 at 12:35
  • No I have not tried that (as I did not know this command before). This seems to be something worth trying, thank you! If I change \spaceskip before \printbibliography, how would I restore its original value afterwards?
    – zuenni
    May 13 '20 at 12:47
  • Just group it, i.e., introduce { and } before and after thebibliography respectively, or just give \bgroup .... \egroup....
    – MadyYuvi
    May 13 '20 at 13:27
4

'Parametrize' (pa-ram-e-trize) is on the list of US hyphenation exception that TeX can't hyphenate properly with the default US English patterns. This list can be found in https://ctan.org/pkg/hyphenex and is periodically updated in TUGBoat.

You can add

\hyphenation{pa-ram-e-trized}

to your preamble to help TeX along.

\documentclass{article}

\usepackage[style=alphabetic,maxnames=9,backend=biber]{biblatex}
\hyphenation{pa-ram-e-trized}

\begin{filecontents}{\jobname.bib}
@inproceedings{good,
  title     = {The Protracted Example Heading for Parametrized Bibliography Entries},
  author    = {James Smith and John Johnson and Robert M. Williams and David Brown and Richard Anderson},
  booktitle = {Proceedings of the 18th Annual Symposium on Fictional Content with Long Titles},
  publisher = {Publishing},
  series    = {Lecture Notes and Other Stuff},
  volume    = {1337},
  pages     = {290--301},
  year      = {2019}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\autocite{good}
\printbibliography
\end{document}

Nicely aligned bibliography entry with hyphenated 'pa-rametrized'

It may still be a good idea to load babel or polyglossia, but if you write in US English (english, american) then loading one of those packages alone will not help hyphenation along.

Line breaking in the bibliography is tricky and not all issues can be resolved by introducing new hyphenation points. See How to adjust the breaking in the bibliography? for a survey of methods to improve line breaking in the bibliography.

That answer also gives a solution to the question

How do I allow LaTeX to use bigger inter-word spaces in the bibliography?

namely (point 2 under general solutions)

\begingroup
\setlength{\emergencystretch}{.5em}
\printbibliography
\endgroup

If you prefer a solution that only involves preamble code, go with

\appto\bibfont{\setlength{\emergencystretch}{.2em}}

which appends the emergency stretch change to the bibliography font setup.

Note that the value .2em was an arbitrary guess here. You may want to adjust it for better results (keep it as small as possible).

\documentclass{article}

\usepackage[style=alphabetic,maxnames=9,backend=biber]{biblatex}

\appto\bibfont{\setlength{\emergencystretch}{.2em}}

\begin{filecontents}{\jobname.bib}
@inproceedings{bad,
  title         = {{The Protracted Example Heading for Parametrized Bibliography Entries}},
  author        = {James Smith and John Johnson and Robert M. Williams and David Brown and Richard Anderson},
  booktitle     = {Proceedings of the 18th Annual Symposium on Fictional Content with Long Titles},
  publisher     = {Publishing},
  series        = {Lecture Notes and Other Stuff},
  volume        = {1337},
  pages         = {290--301},
  year          = {2019}
}
@inproceedings{better,
  title         = {{The\, Protracted\, Example\, Heading\, for\, Parametrized Bibliography Entries}},
  author        = {James Smith and John Johnson and Robert M. Williams and David Brown and Richard Anderson},
  booktitle     = {Proceedings of the 18th Annual Symposium on Fictional Content with Long Titles},
  publisher     = {Publishing},
  series        = {Lecture Notes and Other Stuff},
  volume        = {1337},
  pages         = {290--301},
  year          = {2019}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\cite{bad}
\cite{better}

\printbibliography
\end{document}

Bibliography without overfull boxes

2
  • 1
    This is a great answer, but I really would emphasize that tex.stackexchange.com/questions/442308/… is an absolute masterpiece of comprehensively discussing this topic of getting decent spacing in the bibliography. May 13 '20 at 16:13
  • Thank you very much for this answer. \emergencystretch is exactly the thing I was looking for!
    – zuenni
    May 13 '20 at 20:04
0

It's just a matter of language. Generally speaking, it's better to leave TeX do his job rather than forcing some behaviors. In this particular case, Biblatex was not able to hyphen correctly because it didn't know in which language your entry was.

\documentclass{article}
\usepackage{polyglossia}
    \setmainlanguage{english}
    \hyphenation{pa-ra-me-tri-zed}

\usepackage[style=alphabetic,maxnames=9,backend=biber]{biblatex}

\begin{filecontents}{references.bib}
@inproceedings{bad,
  title         = {{The Protracted Example Heading for Parametrized Bibliography Entries}},
  author        = {James Smith and John Johnson and Robert M. Williams and David Brown and Richard Anderson},
  booktitle     = {Proceedings of the 18th Annual Symposium on Fictional Content with Long Titles},
  publisher     = {Publishing},
  series        = {Lecture Notes and Other Stuff},
  volume        = {1337},
  pages         = {290--301},
  year          = {2019},
  Langid = {english}
}
@inproceedings{better,
  title         = {{The\, Protracted\, Example\, Heading\, for\, Parametrized Bibliography Entries}},
  author        = {James Smith and John Johnson and Robert M. Williams and David Brown and Richard Anderson},
  booktitle     = {Proceedings of the 18th Annual Symposium on Fictional Content with Long Titles},
  publisher     = {Publishing},
  series        = {Lecture Notes and Other Stuff},
  volume        = {1337},
  pages         = {290--301},
  year          = {2019}
}
\end{filecontents}

\addbibresource{references.bib}

\begin{document}
\cite{bad}
\cite{better}
\printbibliography
\end{document}
4
  • That solves some of the problems, but not all of them. An example of a reference that still produces an overlong line contains the word "algorithms", where no hyphenation within the "rithms" syllable is possible.
    – zuenni
    May 13 '20 at 14:08
  • Another one contains the acronym "SIGSPATIAL", which should not be hyphenated at all cost.
    – zuenni
    May 13 '20 at 14:12
  • The problem here is not that biblatex does not know the language. If no language package is loaded TeX generally assumes US English. The problem is that the US English hyphenation patterns can't hyphenate 'parametrize', so TeX needs help with \hyphenation.
    – moewe
    May 13 '20 at 15:26
  • 1
    @zuenni Line breaking/hyphenation is tricky in general and even more so in the bibliography (because text is auto-generated and usually less representative of normal prose). In this particular example where hyphenation of single word failed because the patterns couldn't deal with it, the best solution is to add a hyphenation exception. But this may not be possible for other cases. Good help with bad line breaks in the bibliography can only be given on a case-by-case basis, because there is no one solution that fits all. But some methods are listed in tex.stackexchange.com/q/442308.
    – moewe
    May 13 '20 at 15:31

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.