# Sorting an Acronym entry with \mathcal{} with Glossaries package

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!

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

\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}

\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〉.

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