TransWikia.com

Glossaries: Can I have counters on a per glossary basis?

TeX - LaTeX Asked by Melchisedech on May 5, 2021

I know how to change the counter used for referencing occurrences in the glossaries package options. For instance, I know how to use sections instead of pages.

Thing is, I have several glossaries in my document, and the most relevant counter for each of them is not the same (IMHO).

Is it possible to set a different counter for each glossary? For instance, can I use pages as a counter for a glossary, and sections for another?

If yes, how can I achieve that?

2 Answers

Well, looking at the documentation once more gave me the answer. I don't get how I missed this part as I have read it quite a number of times…

p. 174

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

So, it is easy to have counters on a per glossary basis, as you just may set the counter you want to use when creating a new glossary.

Correct answer by Melchisedech on May 5, 2021

You could perhaps use this snippet from my "personal documentation" :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}

Answered by Plergux on May 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP