[Tex/LaTex] Writing an equation in a new line

line-breakingmath-mode

I wish to write an inline equation using $%math...$, but the current line is too long, so the equation is broken into two parts, first one in the original line, and the other in a new line. I don't want this situation; I want a whole line, and after it the equation. I don't want to use \newline{} or something like that, because it stops the line in the middle and doesn't do the indenting (the spacing which makes all the lines to end on the same vertical line). What can I do?

Best Answer

LaTeX can break inline formulas after a relational or a binary symbol. If you don't want this to happen you can explicitly prevent it by setting:

\relpenalty=10000
\binoppenalty=10000

LaTeX will then always try to keep the $...$ within one line, but as a result you may end up with overfull hboxes if the paragraph doesn't have enough flexibility to allow for some acceptable line breaking. In that case xou then have to place an explicit linebreak (or an optional one) manually into the formula using \linebreak (with or without an optional argument).

The alternative (as a one-time change) is that you place an explicit linebreak just before the formula (via \linebreak) which will then force a linebreak at that point with a justified line in fron of the formula. Again this only works with enough flexibility in the paragraph.

The other possibility for a one-time change is to put the above parameter settings inside the $...$in which case they only apply to that equation.

What you should not do (normally) is to surround the whole equation by, say an \mbox. In practive this will also prevent LaTeX from breaking it over a line, but it has the additional effect of making the spacing within the formula rigid, i.e., the formula will not be queezed or spread in line with the rest of the paragraph material.

The only other alternative is to go for displayed formula as mentioned in the comment.

Related Question