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{$...$}
UnbreakEq{}
which internally puts its argument within anmbox
. But that would then require you to wrap each inline equation in\UnbreakEq{$f(x)=3x^2-2x+5+7$}
instead of\mbox{$f(x)=3x^2-2x+5+7$}
, which is hardly more convenient. Are you looking for a way that automatically wraps everything written as$...$
in anmbox
, without displaying this in the source-code?$...$
in an mbox, without displaying this in the source-code$ $
unbreakable.