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 am having trouble with the interaction between discretionary line breaks and centering.

I have defined macros for math mode that contain discretionary line breaks to help TeX lay out inline formulas without overrunning the paragraph margins. However, in a centering environment, lines always break, even if there is plenty of room to make a longer line. The following is a complete example showing an unnecessary line break in a very short line.

$\qlambda{x} x$ % This would fit in one line but is broken into two

Most of my document is not centered. I noticed the problem when I tried using the following method to center table cells vertically and horizontally.

  $\qlambda{x} x$ % This would fit in one line but is broken into two

How can I make a discretionary line break that doesn't break when a paragraph fits on a single line?

share|improve this question
up vote 10 down vote accepted

\linebreak[1] makes a negative penalty so TeX thinks breaking there is better than doing nothing. In justified text this is counterbalanced by the cost of stretching glue in the short line but when centering (or ragged right or left) stretchable glue fills the short line with no penalty added.

So use \nolinebreak[1] so the break is allowed but discouraged. Or perhaps better instead of using \linebreak tell TeX that the . is being used as a binary operator by using \mathbin{.} which will give different spacing and allow a break.

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.