当我在笔记中写一些长公式时,我会这样写
\begin{align}
a & = a \cdot 1 \nonumber % this not numbered \\
& = a \cdot (1+0) \nonumber % this not numbered \\
& = a \cdot 1+a\cdot 0 % say, I do want this numbered \\
& = a +a\cdot 0 \nonumber % this not numbered
\end{align}
是否存在一种双重align
命令(比如说),它比更alignsinglenumbered
接近于,在某种意义上align*
align
\begin{alignsinglenumbered}
a & = a \cdot 1 % this not numbered \\
& = a \cdot (1+0) % this not numbered \\
& = a \cdot 1+a\cdot 0 \numbered % say, I do want this numbered \\
& = a +a\cdot 0 % this not numbered
\end{alignsinglenumbered}
产生与上面相同的输出align
?由于这些方程很长,人们希望allowdisplaybreaks
工作,但如果写成
\begin{align}
\begin{split}
a & = a \cdot 1 \\
& = a \cdot (1+0) \\
& = a \cdot 1+a\cdot 0 \\
& = a +a\cdot 0
\end{split}
\end{align}
答案1
对于方程式集合的编号,你可以使用以下组合
\begin{equation}
\begin{aligned}
% <your equations here)
\end{aligned}
\end{equation}
或者,如果您对 -like 环境内的单个方程感兴趣,该align
环境作为 s 字符串的补充\nonumber
,则可以使用以下定义:
\documentclass{article}
\usepackage{amsmath}
\newcommand{\numbered}{\refstepcounter{equation}\tag{\theequation}}
\newenvironment{alignsinglenumbered}
{\csname align*\endcsname}
{\csname endalign*\endcsname}
\begin{document}
\begin{align}
a & = a \cdot 1 \nonumber \\ % this is not numbered
& = a \cdot (1 + 0) \nonumber \\ % this is not numbered
& = a \cdot 1 + a \cdot 0 \\ % say, I do want this numbered
& = a \cdot 1 + 0 \nonumber \\ % this is not numbered
& = a \cdot 1 \nonumber \\ % this is not numbered
& = a \nonumber
\end{align}
\noindent\hrulefill
\begin{alignsinglenumbered}
a & = a \cdot 1 \\
& = a \cdot (1 + 0) \\
& = a \cdot 1 + a \cdot 0 \numbered \\ % say, I do want this numbered
& = a \cdot 1 + 0 \\
& = a \cdot 1 \\
& = a
\end{alignsinglenumbered}
\end{document}