在多行中写出带有多个 =、-、+ 的等式

在多行中写出带有多个 =、-、+ 的等式

我有这个等式

\documentclass{article}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{breqn}
\usepackage{amsmath}
\usepackage{comment}
\usepackage{xfrac}

\begin{equation}
 \begin{split}
     g(z; \mu, b) & = KL(\widetilde{p}(z^{(1)}) \vert \vert \widetilde{q}(z^{(1)}))\\
     & = \int_{z}\widetilde{p}(z^{(1)}) \log (\frac{\widetilde{p}(z^{(1)})}{\widetilde{q}(z^{(1)})}) dz \\
     & = \int_{z} \widetilde{p}(z^{(1)}) \log (\widetilde{p}(z^{(1)})) dz - \int_{z} \widetilde{p}(z^{(1)}) \log (\widetilde{q}(z^{(1)})) dz \\
     & = \int_{z} \widetilde{p}(z^{(1)}) \log (\widetilde{p}(z^{(1)})) dz \\
     & = \int_{z}p(z^{(1)}|z^{(0)})q(z^{(0)})\log(p(z^{(1)}|z^{(0)})q(z^{(0)})) dz- \int_{z}p(z^{(1)}|z^{(0)})q(z^{(0)})\log(\widetilde{q}(z^{(1)}))dz \\
     & = \int_{z}p(z^{(1)}|z^{(0)})q(z^{(0)}) \log(p(z^{(1)}|z^{(0)})) dz + \int_{z}p(z^{(1)}|z^{(0)})q(z^{(0)})\log (q(z^{(0)})) dz \\
     & - \int_{z}p(z^{(1)}|z^{(0)})q(z^{(0)})\log(\widetilde{q}(z^{(1)}))dz \\
     
 \end{split}
 \end{equation}

编译时,- 符号(最后一行)直接放在 = 符号下面。我想把它放在右边一点。有这种可能吗?

我也尝试使用 \begin{dmath} 。

\begin{dmath}
       g(z; \mu, b)  
       = KL(\widetilde{p}(z^{(1)}) \vert \vert \widetilde{q}(z^{(1)}))
      = \int_{z}\widetilde{p}(z^{(1)}) \log (\frac{\widetilde{p}(z^{(1)})}{\widetilde{q}(z^{(1)})}) dz 
      = \int_{z} \widetilde{p}(z^{(1)}) \log (\widetilde{p}(z^{(1)})) dz - \int_{z} \widetilde{p}(z^{(1)}) \log (\widetilde{q}(z^{(1)})) dz 
      = \int_{z} \widetilde{p}(z^{(1)}) \log (\widetilde{p}(z^{(1)})) dz 
      = \int_{z}p(z^{(1)}|z^{(0)})q(z^{(0)})\log(p(z^{(1)}|z^{(0)})q(z^{(0)})) dz- \int_{z}p(z^{(1)}|z^{(0)})q(z^{(0)})\log(\widetilde{q}(z^{(1)}))dz 
      = \int_{z}p(z^{(1)}|z^{(0)})q(z^{(0)}) \log(p(z^{(1)}|z^{(0)})) dz + \int_{z}p(z^{(1)}|z^{(0)})q(z^{(0)})\log (q(z^{(0)})) dz 
      - \int_{z}p(z^{(1)}|z^{(0)})q(z^{(0)})\log(\widetilde{q}(z^{(1)}))dz 
      
\end{dmath}

但出于某种原因,它无法按预期进行编译!我前一天用过它,它能用,但今天就不行了!

非常感谢您的帮助:)

答案1

对于需要稍微缩进的行,您可以将其更改&为。&\qquad

在此处输入图片描述

\documentclass{article}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{split}
     g(z; \mu, b) 
     & = KL(\tilde{p}(z^{(1)}) \,\Vert\, \tilde{q}(z^{(1)}))\\
     & = \int_{z}\tilde{p}(z^{(1)}) \log \Bigl(\frac{\tilde{p}(z^{(1)})}{\tilde{q}(z^{(1)})}\Bigr)\, dz \\
     & = \int_{z} \tilde{p}(z^{(1)}) \log (\tilde{p}(z^{(1)}))\, dz \\
     &\qquad - \int_{z} \tilde{p}(z^{(1)}) \log (\tilde{q}(z^{(1)}))\, dz \\
     & = \int_{z} \tilde{p}(z^{(1)}) \log (\tilde{p}(z^{(1)}))\, dz \\
     & = \int_{z}p(z^{(1)}\mid z^{(0)})q(z^{(0)})\log(p(z^{(1)}\mid z^{(0)})q(z^{(0)}))\, dz \\
     &\qquad - \int_{z}p(z^{(1)}\mid z^{(0)})q(z^{(0)})\log(\tilde{q}(z^{(1)}))dz \\
     & = \int_{z}p(z^{(1)}\mid z^{(0)})q(z^{(0)}) \log(p(z^{(1)}\mid z^{(0)}))\, dz \\
     &\qquad + \int_{z}p(z^{(1)}\mid z^{(0)})q(z^{(0)})\log (q(z^{(0)}))\, dz \\
     &\qquad - \int_{z}p(z^{(1)}\mid z^{(0)})q(z^{(0)})\log(\tilde{q}(z^{(1)}))dz \\    
\end{split}
\end{equation}
\end{document}

相关内容