是否可以在整个文档中使用两组标签来编号化合物?目前,我使用chemnum
以下标签来制作标签:1,2,3a等等。我想引入一个新的数字序列,比如说,TS1,TS2...我唯一的想法是在引入新标签之前重置计数器,如下所示:
\documentclass[b5paper,12pt]{article}
\usepackage{chemnum}
\cmpdinit[init-sub = true]{1,2,3.{a,b}}
\newcommand*{\cmpdTS}[1]{\cmpd[cmpd-prefix=\bfseries{TS},cmpd-space={}]{#1}}
\begin{document}
Here are two compounds: \cmpd{1} and \cmpd{2}.
\cmpdreset
Here are two transition states: \cmpdTS{TS1.a} and \cmpdTS{TS2}.
Which of these two transition states is involved in transformation of \cmpd{1} to \cmpd{2}?
What about \cmpd{3.a}? It is formed from \cmpd{2} via \cmpdTS{TS3.a}.
\end{document}
但这是一个坏主意,因为在输出中我得到:“那3a? 它由2通过TS4a。”而不是:“那3a? 它由2通过TS3a”。因为计数器重置了。
答案1
原始答案
线路
\cmpdinit[init-sub = true]{1,2,3{a,b}}
启动三个标签:1
、2
和3{a,b}
。文本中使用的每个其他标签仍将被创建(并在日志中写入警告,表示尚未启动)。因此编号如下:
Here are two compounds: \cmpd{1} and \cmpd{2}.% numbers 1 and 2
\cmpdreset% new numbers will start at 1 again
Here are two transition states: \cmpdTS{TS1.a} and \cmpdTS{TS2}.
% 1a and 2
Which of these two transition states is involved in transformation of \cmpd{1} to \cmpd{2}?
% 1 and 2 again
What about \cmpd{3.a}? It is formed from \cmpd{2} via \cmpdTS{TS3.a}
% `3' was never declared but gives `3' as this is the next number to be declared,
%`TS3' consequently gives `4`
所以你想要的是这个:
\cmpdinit[init-sub = true]{1,2,3.{a,b}}
它启动标签1
、2
和3
以及子标签3.a
和3.b
。
通过使用选项,您可以更轻松地看到这一点init-strict
,如果使用未启动的标签,则会导致错误。我的建议是执行以下操作,即在序言中同时声明每个标签init-strict
:
\documentclass[b5paper,12pt]{article}
\usepackage{chemnum}
\cmpdsetup{init-strict,init-sub}% error if unititialized label is used
% regular labels
\cmpdinit{1,2,3.a}
% transition states
\newcommand*{\cmpdTS}[1]{\cmpd[cmpd-prefix=\textbf{TS},cmpd-space={}]{#1}}
\cmpdreset
\cmpdinit{TS1.a,TS2,TS3.a}
\begin{document}
Here are two compounds: \cmpd{1} and \cmpd{2}.
Here are two transition states: \cmpdTS{TS1.a} and \cmpdTS{TS2}.
Which of these two transition states is involved in transformation of \cmpd{1} to \cmpd{2}?
What about \cmpd{3.a}? It is formed from \cmpd{2} via \cmpdTS{TS3.a}.
\end{document}
编辑 2014/03/14
自 2014/03/12 起,1.0 版本chemnum
已发布。此新版本在许多方面有所变化,我也想给出新版本的解决方案:
\documentclass[b5paper,12pt]{article}
\usepackage{chemnum}[2014/03/12]
\setchemnum{init,log=verbose}
% regular labels
\initcmpd{1,2,3.a}
% transition states
\resetcmpd
\initcmpd[pre-label-code=\textbf{TS}]{TS1.a,TS2,TS3.a}
\begin{document}
Here are two compounds: \cmpd{1} and \cmpd{2}.
Here are two transition states: \cmpd{TS1.a} and \cmpd{TS2}.
Which of these two transition states is involved in transformation of \cmpd{1}
to \cmpd{2}?
What about \cmpd{3.a}? It is formed from \cmpd{2} via \cmpd{TS3.a}.
\end{document}