如何对齐两列中的方程式?

如何对齐两列中的方程式?

好吧,我的问题是,我试图找到一种方法来编写许多方程式,并将它们分成几列,就像在纸上书写一样,剪切某些部分并继续。我几乎已经使用 amsmath 包的对齐函数实现了这一点。我只是希望它们不垂直居中显示,而是像我在两列中写入文本一样继续显示。

这是我的代码

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{equation*}
\begin{aligned}
\frac{\partial l(\mu, \sigma|\mathbf{y})}{\partial  \mu} & = -\frac{1}      {2\sigma^{2}}\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}(y_{ij}-\mu)=0 \\
 & = -\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}y_{ij}+n\mu=0\\
 & \Rightarrow \sum_{i=1}^{a}\sum_{j=1}^{n_{i}}y_{ij}=n\mu\\
 & \Rightarrow     \tilde{\mu}=\frac{\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}y_{ij}}{n}=\bar{y}_{..} \\
\end{aligned}
\qquad \qquad
\begin{aligned}[c]
\frac{\partial l(\mu, \sigma|\mathbf{y})}{\partial  \sigma^{2}} &     =\frac{-n}{2\sigma^{2}}+\frac{1}   {2(\sigma^{2})^{2}}\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}(y_{ij}-\mu)^{2}=0 \\ 
 & \Rightarrow    \tilde{\sigma}^{2}=\frac{\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}(y_{ij}-\mu)^{2}}{n}  \\ 
 & \Rightarrow   \tilde{\sigma}^{2}=\frac{\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}(y_{ij}-  \bar{y}_{..})^{2}}{n}
 \end{aligned}
 \end{equation*}
\end{document}

在此处输入图片描述

答案1

很简单,只需使用构造[t]的选项即可aligned

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{equation*}
\begin{aligned}[t]
\frac{\partial l(\mu, \sigma|\mathbf{y})}{\partial  \mu} & = -\frac{1}      {2\sigma^{2}}\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}(y_{ij}-\mu)=0 \\
 & = -\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}y_{ij}+n\mu=0\\
 & \Rightarrow \sum_{i=1}^{a}\sum_{j=1}^{n_{i}}y_{ij}=n\mu\\
 & \Rightarrow     \tilde{\mu}=\frac{\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}y_{ij}}{n}=\bar{y}_{..} \\
\end{aligned}
\qquad 
\begin{aligned}[t]
\frac{\partial l(\mu, \sigma|\mathbf{y})}{\partial  \sigma^{2}} &     =\frac{-n}{2\sigma^{2}}+\frac{1}   {2(\sigma^{2})^{2}}\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}(y_{ij}-\mu)^{2}=0 \\ 
& \Rightarrow    \tilde{\sigma}^{2}=\frac{\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}(y_{ij}-\mu)^{2}}{n}  \\ 
& \Rightarrow   \tilde{\sigma}^{2}=\frac{\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}(y_{ij}-  \bar{y}_{..})^{2}}{n}
\end{aligned}
\end{equation*}

\end{document}

在此处输入图片描述

答案2

据我了解,您想要的东西最好通过alignat环境获得,来自amsmath

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{alignat*}{2}
  \frac{\partial l(\mu, \sigma|\mathbf{y})}{\partial \mu} & = -\frac{1} {2\sigma^{2}} \sum_{i=1}^{a}\sum_{j=1}^{n_{i}}(y_{ij}-\mu)=0
  & \qquad\qquad \frac{\partial l(\mu, \sigma|\mathbf{y})}{\partial \sigma^{2}} & =\frac{-n}{2\sigma^{2}}+\frac{1} {2(\sigma^{2})^{2}}\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}(y_{ij}-\mu)^{2}=0 \\
  & = -\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}y_{ij}+n\mu=0
  & & \Rightarrow \tilde{\sigma}^{2}=\frac{\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}(y_{ij}-\mu)^{2}}{n}\\
    & \Rightarrow \sum_{i=1}^{a}\sum_{j=1}^{n_{i}}y_{ij}=n\mu & & \Rightarrow \tilde{\sigma}^{2}=\frac{\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}(y_{ij}- \bar{y}_{..})^{2}}{n} \\
  & \Rightarrow \tilde{\mu}=\frac{\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}y_{ij}}{n}=\bar{y}_{..} \\
\end{alignat*}

\end{document}

在此处输入图片描述

答案3

您可以这样做以避免必须“并行”输入步骤,但是它太宽,无法容纳在两列中,因此我将一些行分开,也许是您的线宽,所以现在看起来有点间隔。但基本思想是使用\allowdisplaybreaksmulticols 在此处输入图片描述

\documentclass{article}
\usepackage{amsmath,multicol}
\allowdisplaybreaks
\begin{document}

\section{Zzzz}

Some text some text  some text  some text.
Some text some text  some text  some text.
\begin{multicols}{2}
\begin{align*}
\frac{\partial l(\mu, \sigma|\mathbf{y})}{\partial  \mu} &
 = -\frac{1}      {2\sigma^{2}}\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}(y_{ij}-\mu)\\
&=0 
\\
 & = -\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}y_{ij}+n\mu\\
&=0\\
 & \Rightarrow \sum_{i=1}^{a}\sum_{j=1}^{n_{i}}y_{ij}=n\mu\\
 & \Rightarrow     \tilde{\mu}\\
&=\frac{\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}y_{ij}}{n}=\bar{y}_{..} \\
\frac{\partial l(\mu, \sigma|\mathbf{y})}{\partial  \sigma^{2}} &=\frac{-n}{2\sigma^{2}}+\\
&\shoveright{\frac{1}   {2(\sigma^{2})^{2}}\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}(y_{ij}-\mu)^{2}}\\
&=0 \\ 
 & \Rightarrow    \tilde{\sigma}^{2}\\
&=\frac{\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}(y_{ij}-\mu)^{2}}{n}  \\ 
 & \Rightarrow   \tilde{\sigma}^{2}\\
&=\frac{\sum_{i=1}^{a}\sum_{j=1}^{n_{i}}(y_{ij}-  \bar{y}_{..})^{2}}{n}\\
\mbox{}\\ % help balance
\mbox{}
 \end{align*}
\end{multicols}
 Some text some text  some text  some text.
Some text some text  some text  some text.
Some text some text  some text  some text.
Some text some text  some text  some text.
Some text some text  some text  some text.
Some text some text  some text  some text.
Some text some text  some text  some text.
Some text some text  some text  some text.
Some text some text  some text  some text.
Some text some text  some text  some text.
\end{document}

相关内容