你好,
我想紧凑地列出几个数学恒等式。目前,我使用 enumerate 环境与 align 结合使用,但这占用了太多空间。首先,枚举符号(我也想将其更改为 i、ii、iii、iv 等)后的换行符似乎没有必要,只会不必要地增加大小。我还想在
a b
c
但是,如果不对枚举符号进行硬编码,我就无法做到这一点。
梅威瑟:
\documentclass{scrartcl}
\usepackage{amsmath,amssymb}
\usepackage{physics}
\usepackage{braket}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\newcommand{\an}{\hat{a}}
\newcommand{\cre}{\hat{a}^\dagger}
\begin{document}
\begin{enumerate}
\item \begin{align}
\comm{\an}{\cre} \ket{n} &= \an \cre \ket{n} - \cre \an \ket{n} \nonumber \\
&= \left( n + 1 \right) \ket{n} - n \ket{n} \nonumber \\
&= \ket{n} \nonumber \\
\Rightarrow \comm{\an}{\cre}= 1
\end{align}
\item \begin{align}
\comm{\hat{N}}{\an} \ket{n} &= \hat{N} \an \ket{n} - \an \hat{N} \ket{N} \nonumber \\
&= \left( n - 1 \right) \sqrt{n} \ket{n-1} - n \sqrt{n} \ket{n-1} \nonumber \\
&= - \sqrt{n} \ket{n-1} \nonumber \\
&= - \an \ket{n} \nonumber \\
\Rightarrow \comm{\hat{N}}{\an} &= - \an
\end{align}
\item \begin{align}
\comm{\hat{N}}{\cre} \ket{n} &= \hat{N} \cre \ket{n} - \cre \hat{N} \ket{n} \nonumber \\
&= \left( n+1 \right) \sqrt{n+1} \ket{n+1} - n \sqrt{n+1} \ket{n+1} \nonumber \\
&= \sqrt{n+1} \ket{n+1} \nonumber \\
& \cre \ket{n} \nonumber \\
\Rightarrow \comm{\hat{N}}{\cre} &= \cre
\end{align}
\end{enumerate}
\end{document}
编辑:
通过使用对齐的环境,我得到了这个:
\begin{enumerate}
\item $\begin{aligned}[t]
\comm{\an}{\cre} \ket{n} &= \an \cre \ket{n} - \cre \an \ket{n} \\
&= \left( n + 1 \right) \ket{n} - n \ket{n} \\
&= \ket{n} \\
\Rightarrow \comm{\an}{\cre} &= 1
\end{aligned}$ \label{one}
\item $\begin{aligned}[t]
\comm{\hat{N}}{\an} \ket{n} &= \hat{N} \an \ket{n} - \an \hat{N} \ket{N} \\
&= \left( n - 1 \right) \sqrt{n} \ket{n-1} - n \sqrt{n} \ket{n-1} \\
&= - \sqrt{n} \ket{n-1} \\
&= - \an \ket{n} \\
\Rightarrow \comm{\hat{N}}{\an} &= - \an
\end{aligned}$
\item $\begin{aligned}[t]
\comm{\hat{N}}{\cre} \ket{n} &= \hat{N} \cre \ket{n} - \cre \hat{N} \ket{n} \\
&= \left( n+1 \right) \sqrt{n+1} \ket{n+1} - n \sqrt{n+1} \ket{n+1}\\
&= \sqrt{n+1} \ket{n+1} \\
& \cre \ket{n} \\
\Rightarrow \comm{\hat{N}}{\cre} &= \cre
\end{aligned}$
\end{enumerate}
答案1
我建议用包来解决tasks
。
t
正如 Zarko 所建议的,通过环境选项aligned
,您还可以在顶部进行编号。
\documentclass{scrartcl}
\usepackage{amsmath,amssymb}
\usepackage{physics}
\usepackage{braket}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\newcommand{\an}{\hat{a}}
\newcommand{\cre}{\hat{a}^\dagger}
\usepackage{tasks}
\settasks{
counter-format={tsk[r])},% lowcase roman number
label-offset={0pt},% distance between label and item
label-width={1.1em},%width of the item label
item-indent={1.1em},% horizontal space available for both label and label-offset
column-sep={0em},
%debug=true
}
%\usepackage{showframe}
\begin{document}
The \verb|tasks| package
creates lists in columns counting horizontally rather than vertically.
Here you can find the first \ref{eq:first} and the second \ref{eq:second} equations side by side, and the third \ref{eq:third} centered
with a \verb|minipage|.
\begin{center}
\footnotesize
%\scriptsize% otherwise you go out of the page margins
\begin{tasks}(2)
\task\label{eq:first}
$\begin{aligned}
\comm{\an}{\cre} \ket{n} &= \an \cre \ket{n} - \cre \an \ket{n} \nonumber \\
&= \left( n + 1 \right) \ket{n} - n \ket{n} \nonumber \\
&= \ket{n} \nonumber \\
\Rightarrow \comm{\an}{\cre} &= 1
\end{aligned}$
\task\label{eq:second}
$\begin{aligned}
\comm{\hat{N}}{\an} \ket{n} &= \hat{N} \an \ket{n} - \an \hat{N} \ket{N} \nonumber \\
&= \left( n - 1 \right) \sqrt{n} \ket{n-1} - n \sqrt{n} \ket{n-1} \nonumber \\
&= - \sqrt{n} \ket{n-1} \nonumber \\
&= - \an \ket{n} \nonumber \\
\Rightarrow \comm{\hat{N}}{\an} &= - \an
\end{aligned}$
\end{tasks}
\begin{minipage}{.56\linewidth}%.56 to avoid overfull hbox
\begin{tasks}[resume=true]% resume=true to continue the enumeration from the previous task
\task\label{eq:third}
$\begin{aligned}
\comm{\hat{N}}{\cre} \ket{n} &= \hat{N} \cre \ket{n} - \cre \hat{N} \ket{n} \nonumber \\
&= \left( n+1 \right) \sqrt{n+1} \ket{n+1} - n \sqrt{n+1} \ket{n+1} \nonumber \\
&= \sqrt{n+1} \ket{n+1} \nonumber \\
& \cre \ket{n} \nonumber \\
\Rightarrow \comm{\hat{N}}{\cre} &= \cre
\end{aligned}$
\end{tasks}
\end{minipage}
\end{center}
Or with option \verb|t|, as Zarko suggested, with \ref{eq:zfirst}, \ref{eq:zsecond} and the third \ref{eq:zthird} at the top:
\begin{center}
\footnotesize
%\scriptsize% otherwise you go out of the page margins
\begin{tasks}(2)
\task\label{eq:zfirst}
$\begin{aligned}[t]
\comm{\an}{\cre} \ket{n} &= \an \cre \ket{n} - \cre \an \ket{n} \nonumber \\
&= \left( n + 1 \right) \ket{n} - n \ket{n} \nonumber \\
&= \ket{n} \nonumber \\
\Rightarrow \comm{\an}{\cre} &= 1
\end{aligned}$
\task\label{eq:zsecond}
$\begin{aligned}[t]
\comm{\hat{N}}{\an} \ket{n} &= \hat{N} \an \ket{n} - \an \hat{N} \ket{N} \nonumber \\
&= \left( n - 1 \right) \sqrt{n} \ket{n-1} - n \sqrt{n} \ket{n-1} \nonumber \\
&= - \sqrt{n} \ket{n-1} \nonumber \\
&= - \an \ket{n} \nonumber \\
\Rightarrow \comm{\hat{N}}{\an} &= - \an
\end{aligned}$
\end{tasks}
\begin{minipage}{.56\linewidth}%.56 to avoid overfull hbox
\begin{tasks}[resume=true]% resume=true to continue the enumeration from the previous task
\task\label{eq:zthird}
$\begin{aligned}[t]
\comm{\hat{N}}{\cre} \ket{n} &= \hat{N} \cre \ket{n} - \cre \hat{N} \ket{n} \nonumber \\
&= \left( n+1 \right) \sqrt{n+1} \ket{n+1} - n \sqrt{n+1} \ket{n+1} \nonumber \\
&= \sqrt{n+1} \ket{n+1} \nonumber \\
& \cre \ket{n} \nonumber \\
\Rightarrow \comm{\hat{N}}{\cre} &= \cre
\end{aligned}$
\end{tasks}
\end{minipage}
\end{center}
\end{document}