Prevent Line Breaking Inline Formula in Tex/Latex

If you ever wrote a document in latex (or tex) that used inline formulas you know how frustrating it is when latex insists on breaking you inline formula across two lines. The easiest solution to this problem, in my opinion is to prevent line breaking inline formulas at all except under extreme cases. To prevent line breaking inline formulas just add the following two lines into your preamble:

\relpenalty=9999
\binoppenalty=9999

Now I will explain what we did. \relpenalty=[number parameter] the parameter specifies the penalty for breaking a math formula after a relation when the formula appears in a paragraph. Plain TEX sets \relpenalty to 500. \binoppenalty=[number parameter] the parameter specifies the penalty for breaking a math formula after a binary operator when the formula appears in a paragraph. Plain TEX sets \binoppenalty to 700. Both parameters can be set anywhere from 0 to 10000. If set to 10000 the inline formulas will never break even in extreme cases. Setting it a bit lower would prevent line breaking except where tex would encounter extreme cases which must have a line break because of the situation.

4 thoughts on “Prevent Line Breaking Inline Formula in Tex/Latex”

  1. Thanks. People connecting to people for help; ain’t that great?; saved me much time as well.

  2. Thanks!

    Though, for my specific case, i had to use 10000 instead of 9999, which should be some care, since 10000 effectively forces LaTeX to do what you want, even if it makes the page look stupid.

Leave a Reply

Your email address will not be published. Required fields are marked *