# How do I sort two glossaries differently? list of acronyms(sort=standard) and list of symbols(sort=use)

I'm using the glossaries package to create a list of acronyms and a list of symbols.

I have to do a list of acronyms sorted alphabetically (sort=standard) and a list of symbols ordered by appearance (sort=use). Both lists have to be displayed before the ToC. I read the user manual for glossaries.sty v4.02 where there is a similar example in which acronyms are ordered alphabetically and notations are sorted in the order in which they were defined but I could not adapt it to my needs.

Is it possible to do this? Because according with some readings, I have to define the entries before print the glossaries, which means, before I use them in the text.

For now, I'm cheating and forcing the correct order by putting sort={001}, sort={002}, ...,sort={XXX} at the glossary entries and setting the glossaries option sort=standard so both acronyms and the main glossary are being ordered alphabetically.

\documentclass[12pt,openright,twoside,a4paper,english,french,spanish,brazil]{abntex2}
\makeglossaries
\newglossaryentry{pi}{
name={\ensuremath{\pi}},
description={ratio of circumference of circle to its diameter},
sort={003} }
\newglossaryentry{real number}{
name={\ensuremath{\mathbb{R}}},
description={include both rational numbers and irrational numbers,
a real number can be given by an infinite decimal
representation, the real numbers may be thought of as points on an infinitely
long number line},
sort={002} }
\newglossaryentry{sigma}{
name={\ensuremath{\sigma}},
description={greek symbol},
sort={001} }
\renewcommand*{\glsseeformat}[3][\seename]{\textit{#1} \glsseelist{#2}}


The different sort mechanisms aren't compatible with each other. In particular, since sort=use doesn't set the sort key until the entry is actually used in the document, you can't use the method given in the sampleSort.tex example file. It is however possible to modify the underlying sort macros for this particular case, but it involves using internals, which I'd prefer to avoid:

\documentclass{article}

\usepackage[acronym]{glossaries}
\usepackage{amsfonts}

\makeglossaries

% First define entries with sort=standard:

\newacronym{zfc}{ZFC}{Zermelo-Fraenkel set theory}

\newacronym{nf}{NF}{new foundations}

% Modify the sort macro to use sort=def just for "main" glossary
\makeatletter
\setupglossaries{sort=use}

\@gls@defsortcount{main}
\let\orgsetsort\@gls@setsort

\renewcommand{\@gls@setsort}[1]{%
\ifdefstring{\gls@type}{main}{\orgsetsort{#1}}{}%
}
\makeatother

\newglossaryentry{pi}%
{
name={\ensuremath{\pi}},
description={ratio of circumference of circle to its diameter}%
}

\newglossaryentry{real number}%
{
name={\ensuremath{\mathbb{R}}},
description={include both rational numbers and
irrational numbers, a real number can be given
by an infinite decimal representation, the real
numbers may be thought of as points on an infinitely
long number line}%
}

\newglossaryentry{sigma}%
{
name={\ensuremath{\sigma}},
description={greek symbol}%
}

\begin{document}

Reference the acronyms: \gls{zfc}, \gls{ad}, \gls{nf}.

Reference the symbols: \gls{sigma}, \gls{real number}, \gls{pi}.

\printglossaries

\end{document}


This produces: