4

I'm using the glossaries package for my list of acronyms with the following options:

\usepackage[acronyms,nopostdot,nogroupskip,nonumberlist,nomain,shortcuts]{glossaries}
\makeglossaries
\input{MyGlossary.tex}

and in the MyGlossary.tex I have the following entry:

\newacronym{np}{$\mathcal{NP}$}{Nondeterministic polynomial time}

Unfortunately, when I print the list with the following lines,

\setlist[description]{leftmargin=!, labelwidth=7em}
\printglossary[title=List of Abbreviations and Acronyms, type=\acronymtype]

it puts said entry at the top of the list, before "A", and not to "N". I kow that the glossaries package has the sort={} option for glossary entries. However, I couldn't find anything similar for acronyms in the glossaries manual.

Is there a quick fix option for this within glossaries, or do I have to switch to another package? I know this is not 100% the intended use of the acronym finction, but I'd like to make it work anyways. Thanks in advance!

1

1 Answer 1

6

You can add sort=... to the optional agrument of \newacronym:

enter image description here

\documentclass{article}

\usepackage[acronyms,nopostdot,nogroupskip,nonumberlist,nomain,shortcuts]{glossaries}
\makeglossaries

\newacronym[sort=np]{np}{$\mathcal{NP}$}{Nondeterministic polynomial time}
\newacronym{nq}{NQ}{NQ long form}
\newacronym{no}{NO}{NO long form}

\begin{document}

\glsaddall

\printglossary[title=List of Abbreviations and Acronyms, type=\acronymtype]

\end{document}

From the glossaries documentation:

\newacronym[〈key-val list〉]{〈label〉}{〈abbrv〉}{〈long〉}

The optional argument {〈key-val list〉} allows you to specify additional information. Any key that can be used in the second argument of \newglossaryentry can also be used here in 〈key-val list〉.

1
  • Ouch, it didn't come to my mind to at least first just try... Thanks heaps!
    – fjungplan
    Nov 21, 2020 at 21:15

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.