Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Consider the following minimal, using \linebreak:

It is impossible to say how first the idea entered
my brain, but, once conceived, it haunted me day
and night. \linebreak

Object there was none. 


This produces the output,

enter image description here

I am interested to find out how the explanation of this behaviour. Is LaTeX2e buggy in this respect?


Based on the suggestions in the answers, I had another look at the TeXBook and it appears the behaviour is embedded in TeX's algorithm, quoting:

Question In one of the paragraphs earlier in this chapter, the author used \break to force a line break in a specific place; as a result, the third line of that particular paragraph was really spaced out. Explain why all the extra space went into the third line, instead of being distributed impartially among the first three lines.

answer Distributing the extra space evenly would lead to three lines of the maximum badness (10000). It's better to have just one bad line instead of three, since TeX doesn't distinguish degrees of badness when lines are really awful. In this particular case the \tolerance was 200, so TeX didn't try any line breaks that would stretch the first two lines; but even if the tolerance had been raised to 10000, the optimum setting would have had only one underfull line. If you really want to spread the space evenly you can do so by using \spaceskip to increase the amount of stretchability between words.

Of course I was wrong in titling the question a failing and apologies to the LaTeX Team and Knuth. However, I still have a feeling that the algorithm has room for improvement in this edge cases or at least \linebreak could be given a better semantic name \maybebreak can be one of them.

share|improve this question
I would simply use \newline instead. We don't have a \linebreak vs. \newline question yet, it seems, but the difference is similar to the one of \pagebreak vs \newpage. –  Martin Scharrer Dec 30 '11 at 11:31
@MartinScharrer It is not a matter of what to use, I was just going through the source2e and experimenting. There is a comment on the analogy between \pagebreak and newpage as well as a note that it is still considered buggy. –  Yiannis Lazarides Dec 30 '11 at 11:42
@barbarabeeton Please see my edit. –  Yiannis Lazarides Dec 30 '11 at 14:00
\linebreak is usually considered a "last resort" command, to be used when nothing else (not even \newline) will easily cause a line to break in a desired place in the middle of a paragraph and it's required to keep an even right margin. –  barbara beeton Dec 30 '11 at 14:17

2 Answers 2

Terminates the current line and formats it in the same way as the preceding line. If that line is justified, this line would be justified as well. The optional argument <value> takes integer values between 0 and 4 inclusive to specify the urgency of the line break; 4 means it must occur.

by the way: \linebreak has the same behaviour as \pagebreak for the vertical adjustment.

share|improve this answer
Herbert try \linebreak[2] and \linebreak[4] to see some differences. The [2] breaks ok, whereas the [4] not. Primarily I am trying to understand the way source2e defined it and why? –  Yiannis Lazarides Dec 30 '11 at 10:00
@Yiannis: No, that is the intended behaviour that \linebreak[4] is the same as \linebreak. linebreak[1] ...\linebreak[3] are the same as \newline in your example. –  Herbert Dec 30 '11 at 10:25

Here's what texdef -t latex linebreak answers:

macro:->\@testopt {\@no@lnbk -}4

macro:#1[#2]->\ifvmode \@nolnerr \else \@tempskipa \lastskip \unskip
\penalty #1\@getpen {#2}\ifdim \@tempskipa >\z@ \hskip \@tempskipa
\ignorespaces \fi \fi 

The default argument to \linebreak is 4; the code is then in common with \nolinebreak (which doesn't add the -). What it does is to save the \lastskip, remove it and then apply a penalty computed by \@getpen (with a minus sign added in front of it). Then the removed glue is put again in the paragraph.

What does \@getpen do?

macro:#1->\ifcase #1 \z@ \or \@lowpenalty \or \@medpenalty \or \@highpenalty \else \@M \fi 

The argument should be an integer from 0 to 4 (included). In case the argument is 4, 10000 is returned.

So in the case of a final \linebreak, TeX sees this \penalty-10000 which forces a line break. As usual, it tends to accumulate the resulting badness in one line (look for "really spaced out" in the TeX book). Note that the paragraph you get has an empty line after the break and you get two "Underfull \hbox" messages (just like you get usually from \break\break in Plain TeX).

If you say \linebreak[3] (or less), the line break is not forced but only encouraged (\@highpenalty is 301 in the standard setting) and so a correctly typeset paragraph results.

share|improve this answer

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.