排列多个较长的方程式,并在方程式之间添加文字

排列多个较长的方程式,并在方程式之间添加文字

我已按以下方式对齐方程式,但使用了多个\qquad。我认为这样做不是一个好习惯。此外,方程式应适合文档的宽度。我真正需要的是类似的东西\multline,但在这种情况下,我如何使用它来处理多个方程式和它们之间的文本。文本后的方程式也应该与之前的方程式处于相同的位置(我已\!在代码中使用了它)。我真的不想为此使用更多的包,如果有必要,我更愿意坚持使用amsmathmathtools

\documentclass{article}
\usepackage{amsmath}
\usepackage{braket}
\begin{document}
\begin{equation*}
\begin{split}
&\delta\mathcal{S}(\psi)=\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\frac{\partial}{\partial t}-\hat{H}|\psi(t)}dt+\int_{t_{1}}^{t_{2}}\braket{\psi(t)|i\frac{\partial}{\partial t}|\delta\psi(t)}dt\\&\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad-\int_{t_{1}}^{t_{2}}\braket{\psi(t)|\hat{H}|\delta\psi(t)}dt\\
&=\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\frac{\partial}{\partial t}-\hat{H}|\psi(t)}dt-i\int_{t_{1}}^{t_{2}}\braket{\psi(t)|\delta\dot{\psi}(t)}dt-\int_{t_{1}}^{t_{2}}\braket{\psi(t)|\hat{H}|\delta\psi}dt\\
&=\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\frac{\partial}{\partial t}-\hat{H}|\psi(t)}dt-\int_{t_{1}}^{t_{2}}\left[\frac{d}{dt}\braket{\psi(t)|\delta\psi(t)}-\braket{\dot{\psi(t)}|\delta\psi}\right]dt\\&\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad-\int_{t_{1}}^{t_{2}}\braket{\psi(t)|\hat{H}|\delta\psi(t)}dt\\
&=\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\frac{\partial}{\partial t}-\hat{H}|\psi(t)}dt-i\braket{\psi(t)|\delta\psi(t)}   -i\int_{t_{1}}^{t_{2}}\braket{\dot{\psi}(t)|\delta\psi(t)}dt\\&\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad-\int_{t_{1}}^{t_{2}}\braket{\psi(t)|\hat{H}|\delta\psi(t)}dt\\
&\text{Since } \delta\psi(t_{1})=\delta\psi(t_{2})=0\\
&=\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\frac{\partial}{\partial t}|\psi(t)}dt-i\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|\dot{\psi(t)}}^{*}dt-\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|\hat{H}|\psi(t)}^{*}dt
\end{split}
\end{equation*}
\begin{equation*}
\braket{\beta|\hat{H}|\alpha}={\braket{\alpha|\hat{H}^{\dagger}|\beta}}^{*}
\end{equation*}
\begin{equation*}
\begin{split}
\!&\quad=\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\frac{\partial}{\partial t}-\hat{H}|\psi(t)}dt-i\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|-{\frac{\partial}{\partial t}|\psi}}^{*}dt-\int_{t_{1}}^{t_{2}}{\braket{\delta\psi(t)|\hat{H}|\psi(t)}}^{*}dt\\
\!&\quad=\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\frac{\partial}{\partial t}-\hat{H}|\psi(t)}dt-\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i{\frac{\partial}{\partial t}-\hat{H}|\psi(t)}}^{*}dt
\end{split}
\end{equation*}
\end{document}
\end{article}

答案1

您可以使用align*and multlined(需要mathtools);为了进行解释和保持一致,请使用\intertext

我提供了更好的定义,\braket即不将星号放在随机位置;用于\braket[*]{x|y}上标星号。还添加了更好的微分符号和微分算子的缩写。

\documentclass{article}
\usepackage{amsmath,mathtools,xparse}
\usepackage{braket}

\newcommand\diff{\mathop{}\!d}
\newcommand{\pdert}{\frac{\partial}{\partial t}}
\RenewDocumentCommand\braket{om}{%
  \mathinner{\langle{#2}\rangle\IfValueT{#1}{^{#1}}}%
}

\begin{document}

\begin{align*}
&\delta\mathcal{S}(\psi)=
  \begin{multlined}[t]
    \int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\pdert-\hat{H}|\psi(t)}\diff t+
    \int_{t_{1}}^{t_{2}}\braket{\psi(t)|i\pdert|\delta\psi(t)}\diff t\\
    -\int_{t_{1}}^{t_{2}}\braket{\psi(t)|\hat{H}|\delta\psi(t)}\diff t
  \end{multlined}
\\
&=
  \int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\pdert-\hat{H}|\psi(t)}\diff t-
  i\int_{t_{1}}^{t_{2}}\braket{\psi(t)|\delta\dot{\psi}(t)}\diff t-
  \int_{t_{1}}^{t_{2}}\braket{\psi(t)|\hat{H}|\delta\psi}\diff t
\\
&=
  \begin{multlined}[t]
    \int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\pdert-\hat{H}|\psi(t)}\diff t-
    \int_{t_{1}}^{t_{2}}\left[\frac{d}{\diff t}\braket{\psi(t)|\delta\psi(t)}-
                              \braket{\dot{\psi(t)}|\delta\psi}\right]\diff t\\
    -\int_{t_{1}}^{t_{2}}\braket{\psi(t)|\hat{H}|\delta\psi(t)}\diff t
  \end{multlined}
\\
&=
  \begin{multlined}[t]
    \int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\pdert-\hat{H}|\psi(t)}\diff t-
    i\braket{\psi(t)|\delta\psi(t)}
    -i\int_{t_{1}}^{t_{2}}\braket{\dot{\psi}(t)|\delta\psi(t)}\diff t\\
    -\int_{t_{1}}^{t_{2}}\braket{\psi(t)|\hat{H}|\delta\psi(t)}\diff t
  \end{multlined}
\\
\intertext{Since $\delta\psi(t_{1})=\delta\psi(t_{2})=0$}
&=
  \int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\pdert|\psi(t)}\diff t-
  i\int_{t_{1}}^{t_{2}}\braket[*]{\delta\psi(t)|\dot{\psi(t)}}\diff t-
  \int_{t_{1}}^{t_{2}}\braket[*]{\delta\psi(t)|\hat{H}|\psi(t)}\diff t
\\
\intertext{Using $\braket{\beta|\hat{H}|\alpha}=\braket[*]{\alpha|\hat{H}^{\dagger}|\beta}$}
&=
  \int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\pdert-\hat{H}|\psi(t)}\diff t-
  i\int_{t_{1}}^{t_{2}}\braket[*]{\delta\psi(t)|-{\pdert|\psi}}\diff t-
  \int_{t_{1}}^{t_{2}}{\braket[*]{\delta\psi(t)|\hat{H}|\psi(t)}}\diff t
\\
&=
  \int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\pdert-\hat{H}|\psi(t)}\diff t-
  \int_{t_{1}}^{t_{2}}\braket[*]{\delta\psi(t)|i{\pdert-\hat{H}|\psi(t)}}\diff t
\end{align*}
\end{document}

在此处输入图片描述

答案2

由于\qquad插入了36mu水平空格,11 个连续的\qquad指令可以更简洁地写为\mkern396mu

这是一个使用单身的 align*环境,以及几个\intertext指令和三个\mkern396mu说明。我\allowdisplaybreaks也使用,以防需要分页。我还建议将所有\frac指令替换为\tfrac。最后,两个实例\dot{\psi(t)}可能应该写成\dot{\psi}(t),对吗?

在此处输入图片描述

\documentclass{article}
\usepackage{mathtools}
\usepackage{braket}
\allowdisplaybreaks
\begin{document}
\begin{align*}
\delta\mathcal{S}(\psi)
&=\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\tfrac{\partial}{\partial t}-\hat{H}|\psi(t)}dt+\int_{t_{1}}^{t_{2}}\braket{\psi(t)|i\tfrac{\partial}{\partial t}|\delta\psi(t)}dt\\
&\mkern396mu-\int_{t_{1}}^{t_{2}}\braket{\psi(t)|\hat{H}|\delta\psi(t)}dt\\
&=\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\tfrac{\partial}{\partial t}-\hat{H}|\psi(t)}dt-i\int_{t_{1}}^{t_{2}}\braket{\psi(t)|\delta\dot{\psi}(t)}dt-\int_{t_{1}}^{t_{2}}\braket{\psi(t)|\hat{H}|\delta\psi}dt\\
&=\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\tfrac{\partial}{\partial t}-\hat{H}|\psi(t)}dt-\int_{t_{1}}^{t_{2}}\left[\tfrac{d}{dt}\braket{\psi(t)|\delta\psi(t)}-\braket{\dot{\psi}(t)|\delta\psi}\right]dt\\
&\mkern396mu-\int_{t_{1}}^{t_{2}}\braket{\psi(t)|\hat{H}|\delta\psi(t)}dt\\
&=\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\tfrac{\partial}{\partial t}-\hat{H}|\psi(t)}dt-i\braket{\psi(t)|\delta\psi(t)}   -i\int_{t_{1}}^{t_{2}}\braket{\dot{\psi}(t)|\delta\psi(t)}dt\\
&\mkern396mu-\int_{t_{1}}^{t_{2}}\braket{\psi(t)|\hat{H}|\delta\psi(t)}dt\\
\intertext{Since $\delta\psi(t_{1})= \delta\psi(t_{2})=0$}
&=\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\tfrac{\partial}{\partial t}|\psi(t)}dt-i\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|\dot{\psi}(t)}^{*}dt-\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|\hat{H}|\psi(t)}^{*}dt\\
\intertext{And since $\braket{\beta|\hat{H}|\alpha}={\braket{\alpha|\hat{H}^{\dagger}|\beta}}^{*}$}
&=\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\tfrac{\partial}{\partial t}-\hat{H}|\psi(t)}dt-i\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|-{\tfrac{\partial}{\partial t}|\psi}}^{*}dt-\int_{t_{1}}^{t_{2}}{\braket{\delta\psi(t)|\hat{H}|\psi(t)}}^{*}dt\\
&=\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i\tfrac{\partial}{\partial t}-\hat{H}|\psi(t)}dt-\int_{t_{1}}^{t_{2}}\braket{\delta\psi(t)|i{\tfrac{\partial}{\partial t}-\hat{H}|\psi(t)}}^{*}dt
\end{align*}
\end{document}

答案3

我建议使用两种不同的对齐方式来代替多行对齐方式。我还\braket利用\mathtools和重新定义了命令xparse,使其具有简单的语法,接近手写的语法,即:\braket{a|b|c}

还要注意,如果您使用几何包(不进行任何更改),则许多方程式不必跨行拆分。

\documentclass{article}
\usepackage{mathtools}

\usepackage{xparse}
\DeclarePairedDelimiterX\braket[1]{\langle}{\rangle}{\braketargs{#1}}%
\NewDocumentCommand{\braketargs}{ >{\SplitArgument{2}{|}}m }
{\braketargsaux#1}
\NewDocumentCommand{\braketargsaux}{ m m m}%
{\IfNoValueTF{#3}{\IfNoValueTF{#2}{#1}{#1\,\delimsize\vert\,\mathopen{}#2}}%
{#1\,\delimsize\vert\,\mathopen{}#2\,\delimsize\vert\,\mathopen{}#3}}%

\begin{document}
\begin{align*}
  \delta\mathcal{S}(\psi)&=
  \! \begin{aligned}[t]\int_{t_{1}}^{t_{2}}\braket[\Big]{\delta\psi(t)|i\frac{\partial}{\partial t}-\hat{H}|\psi(t)}dt +\int_{t_{1}}^{t_{2}}\braket[\Big]{\psi(t)|i\frac{\partial}{\partial t}|\delta\psi(t)}dt&\\
  -\int_{t_{1}}^{t_{2}}\braket[\big]{\psi(t)|\hat{H}|\delta\psi(t)}dt&
  \end{aligned}\\
    & = \! \begin{aligned}[t]\int_{t_{1}}^{t_{2}}\braket[\Big]{\delta\psi(t)| i\frac{\partial}{\partial t}-\hat{H}| \psi(t)}dt-i\int_{t_{1}}^{t_{2}}\braket[\big]{\psi(t)|\delta\dot{\psi}(t)}dt & \\-\int_{t_{1}}^{t_{2}}\braket[\big]{\psi(t)|\hat{H}|\delta\psi}dt &
  \end{aligned}\\
  &= \! \begin{aligned}[t]\int_{t_{1}}^{t_{2}}\braket[\Big]{\delta\psi(t)|i\frac{\partial}{\partial t}-\hat{H}|\psi(t)}dt-\int_{t_{1}}^{t_{2}}\left[\frac{d}{dt}\braket[\big]{\psi(t)|\delta\psi(t)}-\braket[\big]{\dot{\psi(t)}|\delta\psi}\right]dt & \\
  \smash[t]{-\int_{t_{1}}^{t_{2}}}\braket[\big]{\psi(t)|\hat{H}|\delta\psi(t)}dt &
  \end{aligned}\\
    & = \! \begin{aligned}[t]\int_{t_{1}}^{t_{2}}\braket[\Big]{\delta\psi(t)|i\frac{\partial}{\partial t}-\hat{H}|\psi(t)}dt-i\braket[\big]{\psi(t)|\delta\psi(t)} -i\int_{t_{1}}^{t_{2}}\braket[\big]{\dot{\psi}(t)|\delta\psi(t)}dt & \\ -\int_{t_{1}}^{t_{2}}\braket[\big]{\psi(t)|\hat{H}|\delta\psi(t)}dt &
  \end{aligned}\\
  \intertext{Since $ \delta\psi(t_{1})=\delta\psi(t_{2})=0 $}
    & = \! \begin{aligned}[t]\int_{t_{1}}^{t_{2}}\braket[\Big]{\delta\psi(t)|i\frac{\partial}{\partial t}|\psi(t)}dt-i\int_{t_{1}}^{t_{2}}\braket[\big]{\delta\psi(t)|\dot{\psi(t)}}^{*}dt & \\-\int_{t_{1}}^{t_{2}}\braket[\big]{\delta\psi(t)|\hat{H}|\psi(t)}^{*}dt &
  \end{aligned}\\
  \braket[\big]{\beta|\hat{H}|\alpha} & \! \begin{aligned}[t]={\braket[\big]{\alpha|\hat{H}^{\dagger}|\beta}}^{*}
  =\int_{t_{1}}^{t_{2}}\braket[\Big]{\delta\psi(t)|i\frac{\partial}{\partial t}-\hat{H}|\psi(t)}dt-i\int_{t_{1}}^{t_{2}}\braket[\Big]{\delta\psi(t)|-{\frac{\partial}{\partial t}|\psi}}^{*}dt & \\ -\int_{t_{1}}^{t_{2}}{\braket[\big]{\delta\psi(t)|\hat{H}|\psi(t)}}^{*}dt &
  \end{aligned}\\
  &=\int_{t_{1}}^{t_{2}}\braket[\Big]{\delta\psi(t)|i\frac{\partial}{\partial t}-\hat{H}|\psi(t)}dt-\int_{t_{1}}^{t_{2}}\braket[\Big]{\delta\psi(t)|i{\frac{\partial}{\partial t}-\hat{H}|\psi(t)}}^{*}dt
\end{align*}
\newpage
\allowdisplaybreaks
\begin{align*}
  \delta\mathcal{S}(\psi) & =
  \int_{t_{1}}^{t_{2}}\braket[\Big]{\delta\psi(t)|i\frac{\partial}{\partial t}-\hat{H}|\psi(t)}dt +\int_{t_{1}}^{t_{2}}\braket[\Big]{\psi(t)|i\frac{\partial}{\partial t}|\delta\psi(t)}dt \\ \MoveEqLeft[-3]-\smash[t]{\int_{t_{1}}^{t_{2}}}\braket[\big]{\psi(t)|\hat{H}|\delta\psi(t)}dt\\ \MoveEqLeft[-3]\smash[t]{-\int_{t_{1}}^{t_{2}}}\braket[\big]{\psi(t)|\hat{H}|\delta\psi(t)}dt\\
  \intertext{Since $ \delta\psi(t_{1})=\delta\psi(t_{2})=0 $: } \\
  \MoveEqLeft[-3]-\smash[t]{\int_{t_{1}}^{t_{2}}}\braket[\big]{\delta\psi(t)|\hat{H}|\psi(t)}^{*}dt\\
  \braket[\big]{\beta|\hat{H}|\alpha} & ={\braket[\big]{\alpha|\hat{H}^{\dagger}|\beta}}^{*}
  =\int_{t_{1}}^{t_{2}}\braket[\Big]{\delta\psi(t)|i\frac{\partial}{\partial t}-\hat{H}|\psi(t)}dt-i\int_{t_{1}}^{t_{2}}\braket[\Big]{\delta\psi(t)|-{\frac{\partial}{\partial t}|\psi}}^{*}dt & \\
  \MoveEqLeft[-3]-\smash[t]{\int_{t_{1}}^{t_{2}}}{\braket[\big]{\delta\psi(t)|\hat{H}|\psi(t)}}^{*}dt\\ t}-\hat{H}|\psi(t)}}^{*}dt
\end{align*}

\end{document} 

在此处输入图片描述

在此处输入图片描述

相关内容