在这里,我想创建三行方程,以便它们对所有三个方程都具有相同的方程编号。但是,当我使用aligned
或 时split
,我得到了意外的缩进。我希望第二行与第一行和第三行对齐。
\documentclass[twoside]{article}
\usepackage{amsmath}
\begin{document}
We recall the Bellman equation
\begin{equation}
\begin{split} \label{eq:bellman-eq}
Q^{\pi}_{h}(s, a) &= (r_h + \mathbb{P}_h V^{\pi}_{h+1})(s, a),\\
V^{\pi}_{h}(s) &= \langle Q^{\pi}_{h}(s,\cdot), \pi_h(\cdot \mid s) \rangle,\\
V^{\pi}_{H+1}(s) &= 0
\end{split}
\end{equation}
\end{document}
以下是屏幕截图:
答案1
如果你想让符号左边的材料都=
左对齐和符号=
也要垂直对齐,您应该使用alignedat
环境而不是split
环境。
\documentclass[twoside]{article}
\usepackage{amsmath,amssymb}
\begin{document}
We recall the Bellman equation
\begin{equation} \label{eq:bellman-eq}
\begin{alignedat}{2}
&Q^{\pi}_{h}(s, a) &&= (r_h + \mathbb{P}_h V^{\pi}_{h+1})(s, a),\\
&V^{\pi}_{h}(s) &&= \langle Q^{\pi}_{h}(s,\cdot), \pi_h(\cdot \mid s) \rangle,\\
&V^{\pi}_{H+1}(s) &&= 0
\end{alignedat}
\end{equation}
\end{document}
答案2
\documentclass[twoside]{article}
\usepackage{amsmath, amssymb}
\begin{document}
We recall the Bellman equation
\begin{align} \label{eq:bellman-eq}
&Q^{\pi}_{h}(s, a) = (r_h + \mathbb{P}_h V^{\pi}_{h+1})(s, a),\notag \\
&V^{\pi}_{h}(s) = \langle Q^{\pi}_{h}(s,\cdot), \pi_h(\cdot \mid s) \rangle,\\
&V^{\pi}_{H+1}(s) = 0 \notag
\end{align}
\end{document}
此外,split
还aligned
可以使用:
\begin{equation}
\begin{split} \label{eq:bellman-eq}
&Q^{\pi}_{h}(s, a) = (r_h + \mathbb{P}_h V^{\pi}_{h+1})(s, a),\\
&V^{\pi}_{h}(s) = \langle Q^{\pi}_{h}(s,\cdot), \pi_h(\cdot \mid s) \rangle,\\
&V^{\pi}_{H+1}(s) = 0
\end{split}
\end{equation}