10.12.06

Prevent Line Breaking Inline Formula in Tex/Latex

Posted in LaTex at 11:29 pm by Guy

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.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • StumbleUpon
  • bodytext
  • Sphinn
  • Facebook
  • Mixx
  • Google

Leave a Comment