I have some quite long lines of maths I have to put into a two-colum document format, so the maths often needs to be split between multiple lines.
In the example below, I'd like to align the open parentheses in the last line with that in the line above.
\begin{align}
P(&\mathcal{X},\mathcal{C},\xi|\alpha,\beta,\theta^0) \notag\\
&= \prod_d P(\mathcal{X}_d|\beta)P(\mathcal{C}_d|\alpha,\xi) \prod_c P(\xi^c|\theta^0) \notag\\
&\propto\prod_d \beta^d_c \left(F(\mathcal{C}_d)\prod_t (\mathcal{C}_{dt})^{\alpha\xi_t}\right) \notag\\
& \left( \prod_c F(\xi^c)\prod_t(\xi_t)^{\theta^0_t} \right)
\end{align}
Adding another alignment mark pushes the last parts to the right (see below):
\begin{align}
P(&\mathcal{X},\mathcal{C},\xi|\alpha,&\beta,\theta^0) \notag\\
&= \prod_d P(&\mathcal{X}_d|\beta)P(\mathcal{C}_d|\alpha,\xi) \prod_c P(\xi^c|\theta^0) \notag\\
&\propto\prod_d \beta^d_c &\left(F(\mathcal{C}_d)\prod_t (\mathcal{C}_{dt})^{\alpha\xi_t}\right) \notag\\
& &\left( \prod_c F(\xi^c)\prod_t(\xi_t)^{\theta^0_t} \right)
\end{align}
I tried a command called \shoveleft
to shove them to the left, but it didn'nt work:
\begin{align}
P(&\mathcal{X},\mathcal{C},\xi|\alpha,&\shoveleft{\beta,\theta^0)} \notag\\
&= \prod_d P(&\shoveleft{\mathcal{X}_d|\beta)P(\mathcal{C}_d|\alpha,\xi) \prod_c P(\xi^c|\theta^0)} \notag\\
&\propto\prod_d \beta^d_c &\shoveleft{\left(F(\mathcal{C}_d)\prod_t (\mathcal{C}_{dt})^{\alpha\xi_t}\right)} \notag\\
& &\left( \prod_c F(\xi^c)\prod_t(\xi_t)^{\theta^0_t} \right) \notag\\
\end{align}
Both the previous two attempts produce something like the image below. I also tried a split
environment with bizzare results.
Even if \shoveleft
worked, this wouldn't be ideal, as it'd mess with the internal spacing of the first two lines. Ideally, I'd like the first two lines to ignore the &
position markers in the last two lines (something like \multicolumn
in a table).
Best Answer
With
amsmath
there is thealigned
environment you can use inside other building blocks; it inserts a tiny space before it which may be undone with\!
.If you use the combination of
split
insideequation
instead onealign
, then only one equation number is attached and you avoid writing\notag
many times. By default the number is centered, but thetbtags
option will place it on the final line.If you load
mathtools
, which loadsamsmath
, you can shove the first line left easily with\MoveEqLeft
, rather than having to find specify a unusual alignment point in that line. The command takes an optional argument, a number specifying how manyem
s to move left, the default is2
.I illustrate two different ways of including an
aligned
block, they give different vertical spacing to the equation number.