after reading the manual of the glossaries packages I was under the impression that when you use the sort key that it would be sorted alphabetically according to the text given in this sort key. However, this MWE does not achieve this (in reality of course I have much more symbols so I really need the automatic sorting and it would take to long to define them in the correct order when I define them)
\documentclass{report}
\usepackage{lipsum}
\usepackage[]{hyperref}
\usepackage[acronym,nogroupskip,nonumberlist,nopostdot,toc]{glossaries}
\makenoidxglossaries
\newglossaryentry{thetab}
{%
name={$\Theta_{b}$},
description={temperature coefficient for b},
sort=temperature coefficient for b ,
}
\newglossaryentry{thetaa}
{%
name={$\Theta_{a}$},
description={temperature coefficient for a},
sort=temperature coefficient for a,
}
\newglossaryentry{thetade}
{%
name={$\Theta_{de}$},
description={temperature coefficient for de},
sort=temperature coefficient for de,
}
\newglossaryentry{thetaOP}
{%
name={$\Theta_{OP}$},
description={temperature coefficient for OP},
sort=temperature coefficient for op,
}
\begin{document}
\printnoidxglossary[sort=standard,title={List of Symbols}]
\chapter{first chapter}
\lipsum
testing \gls{thetab} and \gls{thetaa}
some more references \gls{thetade} and \gls{thetaOP}
\end{document}
which gives this result:
where I would have expected this order if sorted alphabetically:
temperature coeffcient for a
temperature coeffcient for b
temperature coeffcient for de
temperature coeffcient for OP
what am I doing wrong?
Best Answer
I'm not sure why the
standard
sort order isn't working, but it works fine if you switch toletter
:This produces:
Incidentally, if you want to sort by a different field (the
description
in this case), you can redefine the hook that sets the value of thesort
key. For example:Edit:
A better redefinition of
\glsprestandardsort
is:(This no longer needs the
\makeatletter
...\makeatother
part.)The
\glssanitizesorttrue
bit will make\glsdosanitizesort
apply\@onelevel@sanitize
to the sort field, which will allow commands like\si
to appear in the description (but it will apply the same logic asmakeindex
and treat\si
as the sequence of characters\
,s
andi
).The second argument of
\glsprestandardsort
is the glossary type, so you can test it to vary the way thesort
field is set according to the glossary. For example: