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.

This is a curiosity-driven question.

The LaTeX \linebreak command comes with five options, from 0 to 4, determining its strength. \linebreak[0] allows TeX to break a line where he normally does not do it, while \linebreak[4] forces him to break a line in a place where the command is put (and is thus equivalent to \linebreak).

To be honest, in my LaTeX practice never have I used any variation of the command beyond mere \linebreak. So, I would like to ask you to share your experience with applying other possibilities. To be more precise:

  • could you please point to situations in which it is reasonable to apply \linebreak[i], where i is not 4 ? could you please explain why you do so ?
  • maybe some of you worked out some general rules which facilitate typesetting with LaTeX (similar for example to placing non-breakable space joining single letter with a word that follows it, like in: a~dog) ?

This, I think, qualifies as a CW question, yet I do not have enough reputation to create it.

share|improve this question
1  
I've been (intensively) using LaTeX since 1993 and I don't remember having needed \linebreak more than a handful of times. –  egreg Apr 1 at 21:20
    
This tells a lot about usage of \linebreak[i], I suppose :) –  Mad Hatter Apr 1 at 21:22
1  
Usually I'm quite fussy about the appearance of my paragraphs, preferring to reword them rather than resorting to \linebreak or, heavens forgive me, sloppy. ;-) –  egreg Apr 1 at 21:35
    
This is my point of view as well. Yet I was very curious if anyone uses these commands. I have been using LaTeX for about 10 years and only recently have I discovered that \linebreak has any options whatsoever. And I never missed any options! Hence the curiosity ;) –  Mad Hatter Apr 1 at 21:43
1  
I didn't say it's a bad question. ;-) –  egreg Apr 1 at 21:44

1 Answer 1

up vote 6 down vote accepted

The whole TeX linebreaking mechanism is driven by minimising badness (demerits, which are penalties squared, more or less) over the paragraph. So at one level it is natural to be able to inject penalties of different strengths so that for example you can emulate the behaviour in math where a linebreak can happen at a relation with penalty by default 500 (\relpenalty) or an operator with penalty by default 700 (\binoppenalty).

However as egreg commented on the question, use of \linebreak at all should be fairly rare anyway and if you get as far as wanting manual control you tend to want to force a break. Also the values in the standard classes are a little odd:

   0
   51 (`\@lowpenalty`)
  151 (`\@medpenalty`)
  301 (`\@highpenalty`)
10000

these are not exactly evenly distributed over the range (10000 is the maximum value) especially when the demerits formula squares these values.

This means that while \linebreak[0] is useful to allow a break at a place where a break wouldn't normally be allowed and \linebreak[4] is useful to force a break. and \linebreak[1 or 2 or 3] are very occasionally useful as a hint. It is really hard to find any general cases where there can be any real advance logic in choosing which of 1 2 or 3 to use, although obviously it is easy to generate test cases where they act differently, all three are considerably weaker penalties than the penalties on math operators, and a bit higher than the penalty for breaking at hyphenation. (50 is the default penalty for breaking at a hyphen).

In the above I've not really distinguished between \linebreak and \nolinebreak (the only difference being the sign of the penalty added) the contribution (positive or negative) to the overall demerits calculation for the paragraph has the same issues in either case.

share|improve this answer
    
David, thank you very much for this explanation. –  Mad Hatter Apr 2 at 6:36

Your Answer

 
discard

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.