I am wondering whether it is possible to define an inline equation environment in which equations do not break when they reach document margins. Here is a MWE in which my equation breaks (prob, you need to add/remove some o)
\documentclass{article}
\begin{document}
looooooooooooooooooooooooooooooooooooooooong text $f(x)=3x^2-2x+5+7$
\end{document}
One can claim that it is proper to use a display
environment. However, sometimes, i want my equations to be in an inline-mode. Further, I know that i can achieve the desire outcome if i use \mbox{}
command. More precise,
\documentclass{article}
\begin{document}
looooooooooooooooooooooooooooooooooooooooong text \mbox{$f(x)=3x^2-2x+5+7$}
\end{document}
So, my question is if it is possible to define an environment in which \mbox{}
is loaded automatically instead of manually (as in the 2nd MWE). That is, $..$
=\mbox{$...$}
Best Answer
By setting
\relpenalty
and\binoppenalty
to 10000, no inline formula can be broken across lines, unless a specific penalty item is issued: by a hard-coded rule in TeX, breaks in inline formulas can only happen after binary operation or relation symbols, with the penalty (that measures the desirability of a break) stated by those parameters' value, or at an explicit penalty.