[Tex/LaTex] Stop LaTeX from breaking an inline math equation

inline()line-breakingmath-mode

I hope this question was not asked before. At least I haven't found it. I have an inline math equation and LaTeX is breaking it into two parts. In this case I'd prefer to have the whole and short equation in one line. Is there any way I can do that? I already tried to put it into a \mbox but that destroyed the whole layout. Here is an example:

\documentclass{minimal}
\usepackage{siunitx}
\begin{document}
A text with an inline equation which is broken in to two parts
but is not wanted right here $v_{initial} = \SI{1000}{m/s}$.
\end{document}

Here the result would be:

A text with an inline equation which is broken in to two parts but is not wanted right here v_{initial} =
1000m/s.

Best Answer

Put the math expression into braces {...}, then it will be a math atom and not broken at the end of the line.

${v_{initial} = \SI{1000}{m/s}}$

to prevent an overfull box use \sloppy or better the sloppypar environment:

\documentclass{article}
\usepackage{siunitx}
\begin{document}

\begin{sloppypar}
A text with an inline equation which is broken in to two parts
but is not wanted right here ${v_{initial} = \SI{1000}{m/s}}$.
\end{sloppypar}

\end{document}
Related Question