我用
\begin{equation}
\begin{aligned}
p(z_{di, dj} = t | w^{(k)}_{di} = w_i, z_{-di}, x_{-di}, w^{(k)}_{-di}, w^{(n)}_{dj} = w_j, z_{-dj}, w^{(n)}_{-dj}, A, \alpha^{(k)}, \alpha^{(n)}, \beta)
&\propto p(z_{di, dj} = t, w^{(k)}_{di} = w_i, w^{(n)}_{dj} = w_j | z_{-di}, x_{-di}, w^{(k)}_{-di}, z_{-dj}, w^{(n)}_{-dj}, A, \alpha^{(k)}, \alpha^{(n)}, \beta)\\
&= \frac{p(z, w^{(k)}, w^{(n)}| A, \alpha^{(k)}, \alpha^{(n)}, \beta)}{p(z_{-di}, w^{(k)}_{-di}, w^{(n)}_{-dj}| A, \alpha^{(k)}, \alpha^{(n)}, \beta)}\\
\end{aligned}
\end{equation}
但是公式太长了,所以有些结果在pdf文件中看不到。我想在对齐之前另起一行。我该怎么做才能让结果如下:
p(z,w......很长)
= p(…)
= p(…)
答案1
你的第一行太长了。也许你可以多拆分几行,这样更容易阅读和排版。但这就是你要求的。
% arara: pdflatex
\documentclass{article}
\usepackage{mathtools}
\usepackage{showframe} % just for demo
\begin{document}
\begin{align}
\MoveEqLeft[0]p(z_{di, dj} = t | w^{(k)}_{di} = w_i, z_{-di}, x_{-di}, w^{(k)}_{-di}, w^{(n)}_{dj} = w_j, z_{-dj}, w^{(n)}_{-dj}, A, \alpha^{(k)}, \alpha^{(n)}, \beta)\nonumber\\
&\propto p(z_{di, dj} = t, w^{(k)}_{di} = w_i, w^{(n)}_{dj} = w_j | z_{-di}, x_{-di}, w^{(k)}_{-di}, z_{-dj}, w^{(n)}_{-dj}, A, \alpha^{(k)}, \alpha^{(n)}, \beta)\nonumber\\
&= \frac{p(z, w^{(k)}, w^{(n)}| A, \alpha^{(k)}, \alpha^{(n)}, \beta)}{p(z_{-di}, w^{(k)}_{-di}, w^{(n)}_{-dj}| A, \alpha^{(k)}, \alpha^{(n)}, \beta)}
\end{align}
\end{document}
如果您可以缩短第一行,您可以增加 中的数字\MoveEqLeft[]
。如果您不想在右边出现数字,只需使用align*
即可(并删除\nonumber
不再需要的 s)。
答案2
这
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{aligned}
p(z_{di, dj} = t | w^{(k)}_{di} & = w_i, z_{-di}, x_{-di}, w^{(k)}_{-di}, w^{(n)}_{dj} \\
& = w_j, z_{-dj}, w^{(n)}_{-dj}, A, \alpha^{(k)}, \alpha^{(n)}, \beta) \\
& \propto p(z_{di, dj} = t, w^{(k)}_{di} = w_i, w^{(n)}_{dj} \\
& = w_j | z_{-di}, x_{-di}, w^{(k)}_{-di}, z_{-dj}, w^{(n)}_{-dj}, A, \alpha^{(k)}, \alpha^{(n)}, \beta) \\
& = \frac{p(z, w^{(k)}, w^{(n)}| A, \alpha^{(k)}, \alpha^{(n)}, \beta)}{p(z_{-di}, w^{(k)}_{-di}, w^{(n)}_{-dj}| A, \alpha^{(k)}, \alpha^{(n)}, \beta)}
\end{aligned}
\end{equation}
\end{document}
或者甚至这个
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{aligned}
p(z_{di, dj} & = t | w^{(k)}_{di} \\
& = w_i, z_{-di}, x_{-di}, w^{(k)}_{-di}, w^{(n)}_{dj} \\
& = w_j, z_{-dj}, w^{(n)}_{-dj}, A, \alpha^{(k)}, \alpha^{(n)}, \beta) \\
& \propto p(z_{di, dj} \\
& = t, w^{(k)}_{di} \\
& = w_i, w^{(n)}_{dj} \\
& = w_j | z_{-di}, x_{-di}, w^{(k)}_{-di}, z_{-dj}, w^{(n)}_{-dj}, A, \alpha^{(k)}, \alpha^{(n)}, \beta) \\
& = \frac{p(z, w^{(k)}, w^{(n)}| A, \alpha^{(k)}, \alpha^{(n)}, \beta)}{p(z_{-di}, w^{(k)}_{-di}, w^{(n)}_{-dj}| A, \alpha^{(k)}, \alpha^{(n)}, \beta)}
\end{aligned}
\end{equation}
\end{document}
在我看来会更加清晰易读。
答案3
我认为符号前后的表达式\propto
的形式是
Pr (X=x | Y=y, Z, W, U, V=v, ...)
和
Pr (X=x, Y=y, V=v | Z, W, U, ...)
分别。因此,选择符号=
来引入换行符并不是一个好主意。相反,换行符应该出现在逗号之一之后或条件符号之后|
。
为了强调等式的结构,我建议您(i)稍微扩大括号,(ii)替换|
为\bigm|
(以获得更好的间距以及更大的符号)和(iii)仅在逗号和或\bigm|
实例处引入换行符。
\documentclass{article}
\usepackage{amsmath} % for "aligned" environment
\begin{document}
\begin{equation}
\begin{aligned}
&p\bigl(\,z_{di, dj} = t \bigm| w^{(k)}_{di} = w_i,
z_{-di}, x_{-di}, w^{(k)}_{-di}, w^{(n)}_{dj} = w_j, \\
&\mkern110mu z_{-dj}, w^{(n)}_{-dj}, A, \alpha^{(k)} \alpha^{(n)}, \beta\, \bigr)\\
&\quad\propto p\bigl(\,z_{di, dj} = t, w^{(k)}_{di} = w_i, w^{(n)}_{dj} = w_j \bigm| \\
&\mkern110mu z_{-di}, x_{-di}, w^{(k)}_{-di}, z_{-dj}, w^{(n)}_{-dj}, A, \alpha^{(k)}, \alpha^{(n)}, \beta\,\bigr)\\
&\quad= \frac{p\bigl(\,z, w^{(k)}, w^{(n)}\bigm| A, \alpha^{(k)}, \alpha^{(n)}, \beta\,\bigr)}{
p\bigl(\,z_{-di}, w^{(k)}_{-di}, w^{(n)}_{-dj} \bigm| A, \alpha^{(k)}, \alpha^{(n)}, \beta\,\bigr)}
\end{aligned}
\end{equation}
\end{document}