繁體
|
簡體
Sclub交友聊天~加入聊天室當版主
(檢舉)
分享
新浪微博
QQ空间
人人网
腾讯微博
Facebook
Google+
Plurk
Twitter
Line
标题:
\nonumber 的「反」
[打印本页]
作者:
kuing
时间:
2017-6-19 01:32
标题:
\nonumber 的「反」
可能以前也讲过,不管了。
我们都知道在多行公式环境(如 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 来引用它们。
测试文档:
https://www.texide.com/project/5946b41c5c818003306ed73e
(已挂)
作者:
kuing
时间:
2021-12-14 14:15
网址:
https://www.zhihu.com/question/505455777
标题:Latex 中的公式编号怎么在保持自动编号的数字后加下标字母?
类似
x^2+y^2=1 (1)_m
用类似于楼上的方法解决,
我的回答:
\documentclass{article}
\usepackage{amsmath}
\newcommand\tagsub[1]{%
\refstepcounter{equation}\tag*{(\theequation)$_{#1}$}}
\begin{document}
\begin{align}
a &= b \\
&= c \tagsub{m} \\
&= d \tagsub{n} \label{eqn}\\
&= e
\end{align}
ref test: \ref{eqn}
\end{document}
复制代码
效果如下:
2021-12-14 14:15
编辑于 2021-12-13 14:16
图片附件:
v2-2e2d3356c690f3c40c67011557307deb_r.jpg
(2021-12-14 14:15, 11.26 KB) / 下载次数 252
http://kuing.orzweb.net/attachment.php?aid=10713&k=09678a125274b6342c9b47fa3d4e74f8&t=1711622585&sid=1rvX8H
欢迎光临 悠闲数学娱乐论坛(第2版) (http://kuing.orzweb.net/)
Powered by Discuz! 7.2