I would like to know what happens in terms of what the output document looks like. Some example strings would be nice, and a description of what happens to the string in the exported pdf. A description of what the penalty values are set to is insufficient.


1 Answer 1


\nolinebreak is the same as \nolinebreak[4] and in general the argument takes an integer value between 0 and 4 inclusive

As explained in What is the difference between \nobreak and \nolinebreak?

[0] is always \penalty0 which somewhat counter intuitively in the case of \nolinebreak[0] adds a linebreaking possibility, without encouraging or discouraging a break.

[4] (the default) adds \penalty10000 which makes it infinitely bad to break at that point, so will suppress line breaks.

Values [1] to [3] give increasing penalties more strongly dissuading tex from breaking the line, the values are normally set by the class and are respectively \@lowpenalty, \@medpenalty, and \@highpenalty.

For reasons that are not really clear the standard classes set these to low values, all quite close together, out of a possible range of 0-10000 article uses the values 51, 151, 301.

So in practice outside of artificial tests it is rather rare to see \linebreak[1] have an effect different from that of \linebreak[2] or \linebreak[3], however I generated one such test below.

enter image description here


\indent\phantom{0} one two three one two three four

0 one two three one two three\nolinebreak[0] four

1 one two three one two three\nolinebreak[1] four

2 one two three one two three\nolinebreak[2] four

3 one two three one two three\nolinebreak[3] four

4 one two three one two three\nolinebreak[4] four




In the first column you see (from the first paragraph) that TeX naturally wants to break after three increasing the penalty for breaking at that point has no effect (because the penalty for stretching the white space is greater) until [4] is used which prevents the break so forcing TeX to stretch white space instead.

In the second column white space stretching isn't (wuite) as bad and in this case using the "hint" of \linebreak[3] is enough to prevent a break at that point, with Tex chosing instead to stretch white space.

In column 3 again non of th e\nolinebreak have an effect unless the default value [4] is used to prevent a break after three.

In column 4 TeX never needs to take a linebreak at that point so all the paragraphs are the same.

You must log in to answer this question.

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