我有一个align
问题。基本上是以下代码:
\begin{align}
\nonumber & \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_1)\right)\exp(-\mu-1) + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_2)\right)\exp(-\mu-1) \\
\nonumber & \cdots + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_k)\right)\exp(-\mu-1) = 1 \\
\nonumber & \sum_{i=1}^k \exp\left(-\sum_{t=1}^T \lambda_t f_t(x_i) \right) = \exp(\mu+1) \\
& \exp(-\mu-1) = \frac{1}{\displaystyle{\sum_{i=1}^k} \exp\left(-\displaystyle{\sum_{t=1}^T} \lambda_t f_t(x_i) \right)}
\end{align}
产生以下内容:
但是我想让第 2、3 和 4 行的等号全部对齐,我该怎么做?(第 2 行是第 1 行的延续)。
答案1
一些想法:
代码
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation}
\begin{split}
\exp\left(-\sum_{t=1}^T\lambda_t f_t(x_1)\right)\exp(-\mu-1) & + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_2)\right)\exp(-\mu-1) \\
\cdots + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_k)\right)\exp(-\mu-1) & = 1 \\
\sum_{i=1}^k \exp\left(-\sum_{t=1}^T \lambda_t f_t(x_i) \right) & = \exp(\mu+1) \\
\exp(-\mu-1) & = \frac{1}{\displaystyle{\sum_{i=1}^k} \exp\left(-\displaystyle{\sum_{t=1}^T} \lambda_t f_t(x_i) \right)}
\end{split}
\end{equation}
\begin{alignat}{6}
\mathrlap{\exp\left(-\sum_{t=1}^T\lambda_t f_t(x_1)\right)\exp(-\mu-1) + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_2)\right)\exp(-\mu-1)} \nonumber\\
&&\dots + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_k)\right)\exp(-\mu-1) & = 1 \nonumber\\
&&\sum_{i=1}^k \exp\left(-\sum_{t=1}^T \lambda_t f_t(x_i) \right) & = \exp(\mu+1) \nonumber\\
&&\exp(-\mu-1) & = \frac{1}{\displaystyle{\sum_{i=1}^k} \exp\left(-\displaystyle{\sum_{t=1}^T} \lambda_t f_t(x_i) \right)}
\end{alignat}
\begin{multline}
\exp\left(-\sum_{t=1}^T\lambda_t f_t(x_1)\right)\exp(-\mu-1) + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_2)\right)\exp(-\mu-1) \\
\begin{aligned}
\cdots + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_k)\right)\exp(-\mu-1) & = 1 \\
\sum_{i=1}^k \exp\left(-\sum_{t=1}^T \lambda_t f_t(x_i) \right) & = \exp(\mu+1) \\
\exp(-\mu-1) & = \frac{1}{\displaystyle{\sum_{i=1}^k} \exp\left(-\displaystyle{\sum_{t=1}^T} \lambda_t f_t(x_i) \right)}
\end{aligned}
\end{multline}
\end{document}
输出
答案2
这也许能满足你的要求:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{multline}
\exp\left(-\sum_{t=1}^T\lambda_t f_t(x_1)\right)\exp(-\mu-1) + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_2)\right)\exp(-\mu-1) \\
\begin{aligned}
\cdots + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_k)\right)\exp(-\mu-1) &= 1 \\
\sum_{i=1}^k \exp\left(-\sum_{t=1}^T \lambda_t f_t(x_i) \right) &= \exp(\mu+1) \\
\exp(-\mu-1) &= \frac{1}{\displaystyle{\sum_{i=1}^k} \exp\left(-\displaystyle{\sum_{t=1}^T} \lambda_t f_t(x_i) \right)}
\end{aligned}
\end{multline}
\end{document}
答案3
\documentclass[preview,border=12pt]{standalone}
\usepackage{amsmath}
\begin{document}
\begin{gather}
\exp\left(-\sum_{t=1}^T\lambda_t f_t(x_1)\right)\exp(-\mu-1) + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_2)\right)\exp(-\mu-1) \notag\\
\begin{aligned}
\cdots + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_k)\right)\exp(-\mu-1) &= 1 \\
\sum_{i=1}^k \exp\left(-\sum_{t=1}^T \lambda_t f_t(x_i) \right) &= \exp(\mu+1) \\
\exp(-\mu-1) &= \frac{1}{\displaystyle{\sum_{i=1}^k} \exp\left(-\displaystyle{\sum_{t=1}^T} \lambda_t f_t(x_i) \right)}
\end{aligned}
\end{gather}
\end{document}