I have a line that happens to end in a non-breakable code-fragment
This is a long line that ends in a \pre{std::ostream}
long word.
When printed the line is too full. The spaces between the words on the line are as slim as they can be.
I would like to relax the spacing rules for that line so that the spaces will be stretched as needed to bring the pre-word on the next line, even if that space stretch will not look very nice anymore
This is a long line that ends in a
\pre{std::ostream} long word.
I did put \hfill between all those words, but that can not be the solution, right?
Update: It seems to make a difference that the problematic line is inside a list item. Is there a "paragraph-less" solution that works on both, paragraphs and list items (and supposedly in many other cases)?
* This is a long line that ends in a \pre{std::ostream}
long word.
versus
* This is a long line that ends in a
\pre{std::ostream} long word.
When I use sloppypar I get an additional line break.



\linebreakbefore\pre{std::ostream}would also do the trick. See Underscore makes text go past end of line into margins. – Werner Sep 03 '14 at 20:05