词汇表:我可以根据每个词汇表设置计数器吗?

词汇表:我可以根据每个词汇表设置计数器吗?

我知道如何更改词汇表包选项中用于引用出现的计数器。例如,我知道如何使用章节而不是页面。

问题是,我的文档中有几个词汇表,并且每个词汇表最相关的计数器并不相同(IMHO)。

是否可以为每个词汇表设置不同的计数器?例如,我可以使用页面作为词汇表的计数器,使用章节作为另一个词汇表的计数器吗?

如果是,我该如何实现?

答案1

好吧,再次查看文档让我找到了答案。我不明白我怎么会错过这部分,因为我已经读过好几遍了……

第 174 页

\newglossary[〈log-ext〉]{〈name〉}{〈in-ext〉}{〈out-ext〉}{〈title〉}[〈counter〉]

因此,很容易根据每个词汇表设置计数器,因为您只需在创建新词汇表时设置要使用的计数器。

答案2

您或许可以使用我的“个人文档”中的这段代码:p

\documentclass{article}
\begin{document}

\section{New Counter}

You could use \verb!\newcounter{}! to  create a new counting thing. For example if you wanted to create a thing called \textit{Crap} and count how many craps I have you can do: \\

\verb!\newcounter{Crap}! \newcounter{Crap} and then use \verb!\stepcounter{Crap}! to move these forward: \\

\noindent
\stepcounter{Crap}\arabic{Crap}{.} One crap \\
\stepcounter{Crap}\arabic{Crap}{.} Two crap \\
\stepcounter{Crap}\arabic{Crap}{.} Three crap \\

Then if you might want to step these up a notch (or down) you can use \verb!\addtocounter{Name}{number}! \addtocounter{Crap}{3} to  reset the count: \\

\noindent
\stepcounter{Crap}\arabic{Crap}{.} Some crap which has been jumped up by 3. \\

To print the numbers of these craps you use labeling definitions like \verb!\arabic{Crap}! or \verb!\alph{Crap}! where you want the numbering to appear: \\

\noindent
\stepcounter{Crap} More crap (\alph{Crap}). \\
\stepcounter{Crap} Even more crap (\alph{Crap}). \\

To get the section/chapter numbers with it simply add a counter definition for the desired document part and what you want to separate, like \verb!\arabic{section}.\alph{Crap}! \\

\noindent
\stepcounter{Crap} This is the last crap: \arabic{section}.\alph{Crap} \\

To get a dot or a semicolon or some such thing after a nude counter label just add the symbol in curly brackets after the numbering definition like \verb!\arabic{Crap}{.}!. 

\end{document}

相关内容