LaTeX 中的标记常量
我有几个引理,在其中指定常量 $C_1$、$C_2$ 等,以供以后参考。当然,当我后来在中间插入一个新的常量定义时,这很烦人。我想要的是一个宏,它可以让我为常量分配标签并为我处理编号。我在想
%% Pseudocode
\begin{lemma}
\newconstant{important-bound}
We will show that $f(x) \le \ref{important-bound} g(x)$ for all $x$.
\end{lemma}
这可能吗?
I have several lemmas in which I specify constants $C_1$, $C_2$, and so forth for later reference. Naturally, this is annoying when I later insert a new constant definition in the middle. What I'd like is a macro that lets me assign labels to constants and handles the numbering for me. I'm thinking something along the lines of
%% Pseudocode
\begin{lemma}
\newconstant{important-bound}
We will show that $f(x) \le \ref{important-bound} g(x)$ for all $x$.
\end{lemma}
Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
扩展 rcollyer 使用计数器的建议:(
编辑此代码以允许标签长度超过一个字符)
下面是一个似乎有效的代码片段:
Expanding on rcollyer's suggestions of using a counter:
(This code was edited to allow labels longer than one character)
And here is a code snippet that seems to work:
您需要创建自己的计数器。
What you're looking for is to create your own counter.
扩展 Aniko 的答案,我用了
这个分层宏,以便它创建一个简写标签,
因此要使用它,您需要小心
不要覆盖现有命令(我确信它无论如何都会警告您)
Expanding on Aniko's answer, I used
this layered macro so that it created a shorthand for the label,
So to use this, you would then do
careful not to overwrite existing commands (i'm sure it would warn you anyhow)