带案例的多个方程的三重对齐

带案例的多个方程的三重对齐

我正在尝试对涉及cases环境的方程进行三重比对

\begin{alignat*}{3}
\gamma_t(i,j) &= f(s_t = i, s_{t+1} = j \mid X, \lambda) \quad && = \sum\limits_k \chi_t(i,j,k),  \quad && 1 \leq t \leq T-1\\[1.5ex]
\gamma_t(i) &= f(s_t = i \mid X, \lambda) \quad &&= \begin{cases} \sum\limits_j \gamma_t(i,j),  \quad && 1 \leq  t \leq T-1 \\ \dfrac{\alpha_T(i)\beta_T(i)}{\sum_l \alpha_T(l)}, \quad && t = T\end{cases}\\[1.5ex]
\xi_t(i,k) &= f(s_t = i, x_t \sim v_k \mid X, \lambda) \quad &&= \begin{cases} \sum\limits_j \chi_{t-1}(j,i,k),  \quad && 1 < t \leq T \\ \dfrac{\pi_ib_i(k)f(x_1\mid v_k)\beta_1(i)}{f(X\mid \lambda)}, \quad && t = 1\end{cases}\\[1.5ex]
\xi_t(k) &= f(x_t \sim v_k \mid X, \lambda) \quad &&= \sum\limits_i \xi_t(i,k),  \quad && 1 \leq  t \leq T\\[1.5ex]
\end{alignat*}

输出如下所示:

在此处输入图片描述

问题是,用红色突出显示的表达式(在 内cases)与用绿色突出显示的表达式不对齐。此外,右侧的表达式在 上也不对齐t。如何修复?

答案1

在此处输入图片描述

使用外部对齐和一些 vphantom 来确保内部对齐匹配。

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{alignat*}{3}
\gamma_t(i,j) &= f(s_t = i, s_{t+1} = j \mid X, \lambda) \quad && = \sum\limits_k \chi_t(i,j,k),  \quad & 1 \leq t \leq T-1\\[1.5ex]
\gamma_t(i) &= f(s_t = i \mid X, \lambda) \quad &&= 
\begin{cases} \sum\limits_j \gamma_t(i,j),  \quad\\ 
\dfrac{\alpha_T(i)\beta_T(i)}{\sum_l \alpha_T(l)}w, \quad \end{cases}
&
\begin{aligned}
\vphantom{\sum\limits_j \gamma_t(i,j)}  1 \leq  t \leq T-1\\
\vphantom{\sum\limits_j \gamma_t(i,j)}  t = T
\end{aligned}
\\[1.5ex]
\xi_t(i,k) &= f(s_t = i, x_t \sim v_k \mid X, \lambda) \quad &&= 
\begin{cases} \sum\limits_j \chi_{t-1}(j,i,k),  \quad \\ \dfrac{\pi_ib_i(k)f(x_1\mid v_k)\beta_1(i)}{f(X\mid \lambda)}, \quad\end{cases}
\hspace{-20pt}
&
\begin{aligned}
\vphantom{\sum\limits_j \chi_{t-1}(j,i,k),}    1 < t \leq T\\
\vphantom{\dfrac{\pi_ib_i(k)f(x_1\mid v_k)\beta_1(i)}{f(X\mid \lambda)}}   t = 1
\end{aligned}\\[1.5ex]
\xi_t(k) &= f(x_t \sim v_k \mid X, \lambda) \quad &&= \sum\limits_i \xi_t(i,k),  \quad & 1 \leq  t \leq T\\[1.5ex]
\end{alignat*}
\end{document}

相关内容