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.

Because I am not fond of the look of tracking ("stretching") for math formulas, I generally use ${...}$ instead of $...$ for math formulas. (Please respect this aesthetic preference of mine.) However quite often, this leads to overshoot lines. Here is some working example code leading to this problem:



Consider the following claim: ${a \in S \cap T}$ or
maybe ${a^2 + b^2 = c^2}$ and ${e^{\pi i} + 1 = 0}$, but
not ${xy = abc = uvw}$ or ${a/b = c/d = \frac{e}{f}}$
are interesting formulas. The preceding text was meant
to cause overshoot mathematical formulas.


Specifically, here the word "preceding" is broken between lines 2 and 3 as pre-ceding, but line 1 has the formula ${e^{\pi i} + 1 = 0}$ overshoot into the margin. The end of the equals sign aligns (roughly) with the end of the hyphen in "pre-ceding", with "0," being placed into the margin.

I would like to indicate an optional math formula line break before the equals sign. Is there a way to specify optional linebreak points for math formulas (just like \- can be used to indicate a hyphenation point for a word), while maintaining the constraint that math formulas are never tracked?

share|improve this question
A formula in braces cannot be broken because it's basically typeset inside an \hbox; without going into the details, it's pretty much like when you write \mbox{$...$}. My opinion is that space in formulas must be flexible. –  egreg Jun 8 '12 at 8:50
I guess I wouldn't mind minor tracking, but a scenario that happens often is that I typeset something as simple as $x \in S$ within a line of text, and the result is that the spaces around the element symbol get overly stretched, with all other spaces in the line appearing to be of ordinary size. This can look very ugly. –  Lover of Structure Jun 9 '12 at 7:29
@user14996: If you don't mind minor tracking, then adjust the values in my answer to that question to your needs. –  Hendrik Vogt Jun 9 '12 at 8:01
@user14996: It may make sense to set ${x \in S}\text{, if } x \le y$ but never for the complete inline math. –  Herbert Jun 9 '12 at 8:24
add comment

1 Answer

up vote 9 down vote accepted

If you really never want to have the spacing in math formulas stretched or shrunk, you can use the answers to How to change default for spacing around binary relations? Namely, set the flexible spaces \thickmuskip and \medmuskip to some constant values:


These are the default values, but without the stretch and shrink. Hence you'll get the same spacing as with your ${...}$ method, but formulas can be broken at the end of the line.

If you add the above to the preamble of your example code (and remove the extra {}, of course), you'll see that the $e^{\pi i} + 1 = 0$ will be broken after the equals sign, which is very much by design – Knuth specifically programmed TeX not to put a break before relational symbols. If you still want a break before the equals sign, you can put a \break command there, but I don't recommend this. For an optional break you can use \allowbreak or, if that doesn't suffice, something like \penalty-100.

share|improve this answer
What you write about making the flexible spaces rigid is very useful. Is there a way to have an optional \break instead so that if I later modify the text and the linebreak becomes unnecessary, it disappears automatically? (And, btw, in this case I do find a linebreak before the equals sign aesthetically more pleasing, since the formula part on the next line will be easier to recognize as part of a formula (if one looks only at that part) with an obviously mathematical symbol on that line; also the formula will appear more balanced that way. But then, this is just my personal opinion.) –  Lover of Structure Jun 9 '12 at 7:46
@user14996: See my edit. –  Hendrik Vogt Jun 9 '12 at 8:09
add comment

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.