Stop LaTeX from breaking an inline math equation
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}
As other answers have mentioned you may use an extra set of {}
however this is essentially equivalent to using \mbox{......}
and like all such boxing does two things. It prevents line breaking but it also freezes all white space at its natural size and prevents stretching or shrinking, this makes it even harder to fit the unbreakable box into the paragraph.
It is usually better to prevent line breaks without freezing the white space. TeX will break after binary operators and relations and the penalty for breaking in those places are set by default in LaTeX to
\binoppenalty=700
\relpenalty=500
So if you set
\binoppenalty=\maxdimen
\relpenalty=\maxdimen
Then Line breaking will be prevented for the rest of the document (or environment) without needing to add markup to each inline expression and allowing TeX to stretch or shrink white space to fit the expression into the surrounding paragraph.
Line breaking will not occur inside a part of a formula that is enclosed in braces:
${v_{initial} = \SI{1000}{m/s}}$