# How to break inline formulas?

I would like to obtain a split formula like this: Latex example on Wikipedia, that is to say with a sort of tab after the "equals" sign, but for an inline formula (between $$ and $$ ). Or, as an alternative, I'd like to align a formula like this on the left (when I use suggestions into that Wikipedia example, I always get a centered formula). Thank you in advance.

-
Thank you both! The second part of Werner's answer was helpful for me. I wanted something like what he put after "some more text". –  Luigi Jan 21 '12 at 14:03

For inline math split formulas, you can always use the array environment. Here's a minimal example duplicating the amsmath output (via align and friends):

\documentclass{article}
%\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
Here is some text
$$\begin{array}{@{}r@{\mskip\thickmuskip}l@{}} 10xy^2+15x^2y-5xy & = 5\left(2xy^2+3x^2y-xy\right) \\[\jot] & = 5x\left(2y^2+3xy-y\right) \\[\jot] & = 5xy\left(2y+3x-1\right) \end{array}$$
and here is some more text.

\bigskip

\noindent$$\begin{array}{@{}r@{\mskip\thickmuskip}l@{}} 10xy^2+15x^2y-5xy & = 5\left(2xy^2+3x^2y-xy\right) \\[\jot] & = 5x\left(2y^2+3xy-y\right) \\[\jot] & = 5xy\left(2y+3x-1\right) \end{array}$$

\end{document}​​​​​​​​​​​​​​​​


Correct alignment is obtained by using the following array column specifications:

• @{} on either end removed any addition horizontal padding between array and the surrounding text;
• @{\muskip\thickmuskip} ensures correct spacing around the = operator; and
• r..l ensures the traditional right/left alignment.

Also, \jot is a defined TeX length of 3pt, adding a little extra vertical space between equations.

You could also specify an additional (optional) parameter to array for aligning it with surrounding text. For example, [t]op or [b]ottom.

-

Not sure why you would wnat to, but if you want to have an inline formula with a space after the =, you can use \quad, \qquad, or even something like \hspace{1.0cm} to insert the space:

But for equations like what you linked to at Wikipedia, it is better to use a display mode environment such as flalign, and adding a & at the end yields the desired results aligned with the left margin (as shown by the [showframe] option of the geometry package):

If you want to use this entire formula in inline mode you could use Werner's solution, or place the flalign within a minipage. I personally think this looks horrible:

## Note:

• The code linked to in the question contain extra = signs on the right hand side. IMHO, these should not be there, and I have removed them from the example here.

## Code:

\documentclass{article}
\usepackage{amsmath}
\usepackage[showframe]{geometry}

\begin{document}
In line you cnan use \verb|\quad| to add a space $10xy^2+15x^2y-5xy =\quad 5\left(2xy^2+3x^2y-xy\right)$:
%
\begin{flalign*}
10xy^2+15x^2y-5xy & =  5\left(2xy^2+3x^2y-xy\right) &\\
& = 5x\left(2y^2+3xy-y\right)\\
& = 5xy\left(2y+3x-1\right)
\end{flalign*}

\noindent
If you want to use the above output in inline mode, you can place it within a minipage, and include [t] to have it aligned
\begin{minipage}[t]{7.0cm}
\setlength{\abovedisplayskip}{-\baselineskip}
\begin{flalign*}
10xy^2+15x^2y-5xy & =  5\left(2xy^2+3x^2y-xy\right)\\
& = 5x\left(2y^2+3xy-y\right)\\
& = 5xy\left(2y+3x-1\right)
\end{flalign*}
\end{minipage}
and here is some more text that continues on after the end of the minipage.
Note that this required setting\verb|\abovedisplayskip}| to eliminate the usual spacing added above the \verb|align| environment.
\end{document}

-