我在 Overleaf 上有一个公式,它向右对齐而不是向左对齐。我按照此处找到的其他问题的说明操作,但不起作用。
{\setlength{\abovedisplayskip}{0pt}%
\begin{flalign}
-\frac{\tau}{2} \sum (x_n - \mu)^2 -b_0\tau -\frac{\lambda_0\tau}{2} (\mu - \mu_0)^2 \\
= -\frac{\tau}{2}\sum(x_n^2 + \mu^2 - 2x_n\mu) - b_0\tau - \frac{\lambda_0\tau}{2}(\mu^2 + \mu_0^2 - 2\mu\mu_0)\\
= -\frac{\tau}{2}(\sum x_n^2 + N\mu^2 - 2\mu\sum x_n) - b_0\tau - \frac{\lambda_0\tau}{2}(\mu^2 + \mu_0^2 - 2\mu\mu_0)
\end{flalign}%
}%
我怎样才能左对齐?
答案1
我猜你正在寻找以下内容:
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation}
\begin{split}
\MoveEqLeft
-\frac{\tau}{2}\sum (x_n-\mu)^2-b_0\tau
-\frac{\lambda_0\tau}{2}(\mu-\mu_0)^2 \\
& = - \frac{\tau}{2}\sum(x_n^2 + \mu^2 - 2x_n\mu) - b_0\tau -
\frac{\lambda_0\tau}{2}(\mu^2 + \mu_0^2 - 2\mu\mu_0)\\
& = -\frac{\tau}{2}\Bigl(\sum x_n^2 + N\mu^2 - 2\mu\sum x_n\Bigr) - b_0\tau -
\frac{\lambda_0\tau}{2}(\mu^2 + \mu_0^2 - 2\mu\mu_0))
\end{split}
\end{equation}
\end{document}
答案2
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{flalign}
-& \frac{\tau}{2}\sum (x_n-\mu)^2-b_0\tau -\frac{\lambda_0\tau}{2}(\mu-\mu_0)^2 \notag \\
&= -\frac{\tau}{2}\sum(x_n^2 + \mu^2 - 2x_n\mu) - b_0\tau -
\frac{\lambda_0\tau}{2}(\mu^2 + \mu_0^2 - 2\mu\mu_0) \\
&= -\frac{\tau}{2}\Bigl(\sum x_n^2 + N\mu^2 - 2\mu\sum x_n\Bigr) - b_0\tau -
\frac{\lambda_0\tau}{2}(\mu^2 + \mu_0^2 - 2\mu\mu_0)) \notag
\end{flalign}
\end{document}