[Tex/LaTex] How to keep a string of text together without it doing a line break

displaystyleequationsformattinginline()line-breaking

I'm writing up a long paper, in which in prose I have various equations. However, I do not want a line break to occur within the equation – I want the equation to stick together. I want to do this without displaying the equation, though. Is there a way to do this?

Best Answer

Anything you enclose within an \hbox or the equivalent LaTeX \mbox will not break. However overflowing into the margins is not a good idea. In the minimal below you can see the effect by using the geometry package to show a border around the normal text area.

\documentclass{octavo}
\usepackage[showframe=true]{geometry}
\begin{document}
\mbox{This is an extremely long line. This is extremely long. $a^2+c^2=42$ }
\end{document}

For long equations rather use the breqn package to break them at an appropriate point.

Related Question