0

I am using glossaries package to print glossaries. Is it possible to have glossaries in order of their occurrences and not alphabetically?

MWE -

\documentclass{book}
\usepackage[xindy]{glossaries}
\makeglossaries
\newglossaryentry{1}{name={7},description={abcd}}
\newglossaryentry{2}{name={4},description={pqrs}}
\newglossaryentry{3}{name={2},description={wxyz}}

\begin{document}
This is \gls{1}.\\
This is \gls{2}.\\
This is \gls{3}.\\
\printglossaries    
\end{document}

This will arrange the glossaries in alphabetical order and 2, 4, 7 will be the sequence of glossaries. I want them to be 7, 4, 2 as they are in the document. Is there any glossary style available for this?

1

There are various options for sorting the list using the sort=<method> package option, as described on page 75 of the manual. For sorting according to the order of the \newglossaryentry commands you can use sort=def. For sorting according to the order of the \gls commands in the main text you can use sort=use.

MWE:

\documentclass{article}
\usepackage[xindy,sort=def]{glossaries}
\makeglossaries
\newglossaryentry{1}{name={7},description={abcd}}
\newglossaryentry{2}{name={4},description={pqrs}}
\newglossaryentry{3}{name={2},description={wxyz}}

\begin{document}
This is \gls{1}.\\
This is \gls{2}.\\
This is \gls{3}.\\
\printglossaries    
\end{document}

Result:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.