TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I’m using XeLaTeX within MiKTeX and also the biblatex package for the literature.

I’ve noticed that my bibliography set using \printbibliography is not set with the \sloppy option by default, which is quite good in my opinion.

What I would like to be able to do is to make \sloppy or \sloppypar only those references in the bibliography that actually need it, that means those records which get overfull \hbox. I don’t want it to be done automatically but I haven’t found a way to do it even manually. Is this even possible?

share|improve this question
You could try to use the execute field in the bib-entry to insert the code (untested as you didn't provide a small example to play around with). – Ulrike Fischer May 18 '11 at 9:12

I'd set \emergencystretch before \printbibliography:


TeX uses \emergencystretch only when a paragraph doesn't fit with the usual parameters, so this may solve the problem. Experiment with the value of \emergencystretch.

share|improve this answer
Worked fine 6em was enough for all my 5 problems though. Start small and expand till it works! – Sebastian Schmitz Jul 21 '14 at 16:07

As Ulrike Fischer has hinted: Use the execute special field to add \sloppy for the respective reference entries.



  Emergency stretch: \the\emergencystretch

  \addspace% ADDED
  \printtext[brackets]{\displayemergencystretch}% ADDED


  author = {Author, A.},
  year = {2001},
  title = {Alpha},
  execute = {\sloppy},
  author = {Buthor, B.},
  year = {2002},
  title = {Bravo},
  author = {Cuthor, C.},
  year = {2003},
  title = {Charlie},





A \verb|\sloppy| paragraph~-- \displayemergencystretch


A \verb|\fussy| paragraph~-- \displayemergencystretch



enter image description here

share|improve this answer
I tried this but it actually did not work. No idea why not. – josefec Jul 14 '12 at 6:57

This isn't 100% a direct answer, but as I just fought through a similar problem in my bibliography, here's my approach. It uses the ragged2e package, which defines a \RaggedRight command that still permits hyphenation -- and crucially for me at least, that includes hyphens inside urls (when using the url package). I decided to enable \RaggedRight only for @electronic items (whose main contents are a short title and a wicked-to-linebreak url), and defined my own .bst file. It's a copy/paste/modify from abbrvnat.bst, and here's the relevant excerpt:

FUNCTION {electronic}
{ output.bibitem
  url empty$ 'skip$ { "\begin{FlushLeft}" write$ newline$ } if$
  format.authors output
  format.title "title" output.check
  year empty$ month empty$ day and and
    format.date output 
  format.url output
  note empty$ 'skip$
    note output
  url empty$ 'skip$ { "\end{FlushLeft}" write$ newline$ } if$

.bst files are tricky beasts, but the upshot of this code is, if there is a url, then I surround the contents of the entry with a FlushLeft environment, which enables \RaggedRight on this paragraph -- and only this paragraph.

To use the execute field, as @UlrikeFischer suggested, you could redefine output.bibitem and fin.entry to check for the execute field and output it:

% in output.bibitem
execute empty$ 'skip$ "\begingroup" execute * write$
% in fin.entry
execute empty$ 'skip$ "\endgroup" write$

Then your execute field could contain \RaggedRight and you'd get the same effect as my code above, but for all .bib items that you annotated. It's not quite the automatic "overfull hbox" solution, but it might be useful anyway.

share|improve this answer
This is a regular natbib solution, not biblatex which is what @josefec is using. – Alan Munn Jun 30 '11 at 3:32
@AlanMunn, touche, I missed that key detail...my bad! I'm not a biblatex user (yet), let alone informed-enough expert, so I can't help there, then. But maybe the ideas above are helpful for people anyway. – Ben Lerner Jun 30 '11 at 20:51
I consider it wrong to use hyphens in URLs, for the simple reason that - can be part of a valid URL, and therefore adding a hyphen can change the URL. – celtschk Jan 9 '12 at 7:58
Have a +1 for your comment and a -1 for your answer (hopefully that cancles each other out ^^) – Sebastian Schmitz Jul 21 '14 at 16:06
FWIW, @SebastianSchmitz, they don't cancel each other, actually -- upvotes on comments don't add reputation points. It's fine; I don't mind the loss of 2 points ;-) – Ben Lerner Jul 23 '14 at 17:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.