[Tex/LaTex] Multiple alignment in math mode – a math equivalent to `\multicolumn`

alignhorizontal alignmentmath-modemulticolumn

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}

enter image description here

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.

enter image description here

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 the aligned 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 inside equation instead one align, then only one equation number is attached and you avoid writing \notag many times. By default the number is centered, but the tbtags option will place it on the final line.

If you load mathtools, which loads amsmath, 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 many ems to move left, the default is 2.

I illustrate two different ways of including an aligned block, they give different vertical spacing to the equation number.

Sample output

\documentclass{article}

\usepackage[tbtags]{mathtools}

\begin{document}

\begin{equation}
  \begin{split}
    \MoveEqLeft
    P(\mathcal{X},\mathcal{C},\xi|\alpha,\beta,\theta^0) \\
    &= \prod_d P(\mathcal{X}_d|\beta)P(\mathcal{C}_d|\alpha,\xi)
    \prod_c P(\xi^c|\theta^0) \\ 
    &\propto\prod_d \beta^d_c\!\begin{aligned}[t]
      &\left(F(\mathcal{C}_d)\prod_t
        (\mathcal{C}_{dt})^{\alpha\xi_t}\right)\\
      & \left( \prod_c F(\xi^c)\prod_t(\xi_t)^{\theta^0_t} \right)
    \end{aligned}\\
  \end{split}
\end{equation}
or
\begin{equation}
  \begin{split}
    \MoveEqLeft
    P(\mathcal{X},\mathcal{C},\xi|\alpha,\beta,\theta^0) \\
    &= \prod_d P(\mathcal{X}_d|\beta)P(\mathcal{C}_d|\alpha,\xi)
    \prod_c P(\xi^c|\theta^0) \\ 
    &\,\begin{aligned}[b]\propto\prod_d \beta^d_c
      &\left(F(\mathcal{C}_d)\prod_t
        (\mathcal{C}_{dt})^{\alpha\xi_t}\right)\\
      & \left( \prod_c F(\xi^c)\prod_t(\xi_t)^{\theta^0_t} \right)
    \end{aligned}
  \end{split}
\end{equation}

\end{document}
Related Question