|
可能以前也讲过,不管了。
我们都知道在多行公式环境(如 align)中可以用 \nonumber(或 \notag)来禁止某行生成编号,像这样- \begin{align}
- a &= a,\\
- b &= b,\\
- c &= c, \nonumber \\
- d &= d,
- \end{align}
复制代码 \begin{align}
a &= a,\\
b &= b,\\
c &= c, \nonumber \\
d &= d,
\end{align}
但如果行数多而需要编号的行却很少时,那就要加很多个 \nonumber 了,经常遇到的情况就是只有最后一行才编号,结果代码就像这样- \begin{align}
- a &= b \nonumber \\
- &= \cdots \nonumber \\
- &= \cdots \nonumber \\
- &= x,
- \end{align}
复制代码 \begin{align}
a &= b \nonumber \\
&= \cdots \nonumber \\
&= \cdots \nonumber \\
&= x,
\end{align}
这显然不方便,理应有一个与 \nonumber 相反的命令——即能对无编号的 align* 环境中的某些行编号(并且号码是自动增加的)才是,但 amsmath 并未提供,尽管定义它并不难:- \newcommand\addtag{\refstepcounter{equation}\tag{\theequation}}
复制代码 这样,上面的就可以这样输了- \begin{align*}
- a &= b \\
- &= \cdots \\
- &= \cdots \\
- &= x, \addtag
- \end{align*}
复制代码 同样可以加 \label,不过要放在 \addtag 后面,像这样- \begin{align*}
- a &= a,\\
- b &= b,\\
- c &= c, \addtag\label{eqx}\\
- d &= d, \addtag\label{eqy}\\
- e &= e,
- \end{align*}
复制代码 然后用 eqref 来引用它们。
测试文档:texide.com/project/5946b41c5c818003306ed73e(已挂) |
|