如何以特定方式对齐两个方程式?

如何以特定方式对齐两个方程式?

我有以下等式:

\begin{center}
\begin{align}
p(\theta) = p(\alpha_{j[i]}, \beta_{j[i]}, \mu_{\alpha}, \sigma_{\alpha}, \mu_{\beta}, \sigma_{\beta}, \sigma ) \\
= p\giventhat{\alpha_{j[i]}}{\mu_{\alpha},\sigma^2_{\alpha}} \times p\giventhat{\beta_{j[i]}}{\mu_{\beta},\sigma^2_{\beta}} \times p(\mu_{\alpha}) \times p(\sigma_{\alpha}) \times p(\mu_{\beta}) \times p(\sigma_{\beta}) \times p(\sigma)
\end{align}
\end{center}

我怎样才能使等式的第二行(以等号开头)直接位于上面等式的等号下方?

答案1

由于您没有提供 MWE(最小工作示例,即小型完整文档),因此我只能猜测您的文档是什么样子以及如何\giventhat定义的。我想它\textwidth足够大,第二行中的公式可以放在文本区域中:

在此处输入图片描述

(红线表示文本边框)

\documentclass{article}
\usepackage{geometry}
\usepackage{mathtools}

\makeatletter
\newcommand{\@giventhatstar}[2]{\left(#1\middle\mid#2\right)}
\newcommand{\@giventhatnostar}[3][]{#1(#2#1\mid#3#1)}
\newcommand{\giventhat}{\@ifstar\@giventhatstar\@giventhatnostar}
\makeatother

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{align}
p(\theta) 
    & = p(\alpha_{j[i]}, \beta_{j[i]}, \mu_{\alpha}, \sigma_{\alpha}, \mu_{\beta}, \sigma_{\beta}, \sigma ) \\
    & = p\giventhat{\alpha_{j[i]}}{\mu_{\alpha},\sigma^2_{\alpha}} \times
        p\giventhat{\beta_{j[i]}}{\mu_{\beta},\sigma^2_{\beta}} \times   
        p(\mu_{\alpha}) \times p(\sigma_{\alpha}) \times 
        p(\mu_{\beta}) \times p(\sigma_{\beta}) \times p(\sigma)
    \end{align}
\end{document}

相关内容