# Glossaries: list of abbreviations (alphabetically ordered) and list of symbols (ordered by usage)

For my thesis, I would like to generate a list of abbreviations that is ordered alphabetically as well as list of symbols that is ordered by the first appearance of each symbol in the thesis. Having done some research, it seems to me that the glossaries package is the best package for this.

I can generate a list of abbreviations ordered alphabetically like this:

\documentclass[a4paper,twoside]{book}
\usepackage[acronym]{glossaries}

\newacronym{ny1}{NY}{New York}
\newacronym{la1}{LA}{Los Angeles}
\newacronym{un1}{UN}{United Nations}
\makeglossaries

\begin{document}
\printglossary[type=\acronymtype,title=Abbreviations]

\gls{ny1} \gls{la1} and \gls{un1} are abbreviations that should
appear alphabetically in the list of abbreviations.

\end{document}


I can also generate a list of symbols ordered by their first appearance in the document like this:

\documentclass[a4paper,twoside]{book}
\usepackage[symbols,nogroupskip,nonumberlist,sort=use]{glossaries-extra}

\glsxtrnewsymbol[description={position}]{x}{\ensuremath{x}}
\glsxtrnewsymbol[description={velocity}]{v}{\ensuremath{v}}
\glsxtrnewsymbol[description={acceleration}]{a}{\ensuremath{a}}
\glsxtrnewsymbol[description={time}]{t}{\ensuremath{t}}
\glsxtrnewsymbol[description={force}]{F}{\ensuremath{F}}
\makenoidxglossaries

\begin{document}
\printnoidxglossary[type=symbols,style=long,title={List of Symbols}]

Reference symbols: $\gls{F}$, $\gls{t}$, $\gls{x}$, $\gls{v}$, $\gls{a}$.

\end{document}


However, merging both lists into one document is not straightforward for me as there is a clash between \usepackage[acronym]{glossaries} and \usepackage[symbols,nogroupskip,nonumberlist,sort=use]{glossaries-extra} when I try to load both packages. What is the best way to merge both lists into one document (abbreviations, alphabetically ordered and symbols, ordered by first appearance)?

Thank you

• I suspect the clash came from loading glossaries-extra (which loads glossaries with appropriate options) followed by trying to load glossaries with a different option list. You will always get an error if you try to load the same package twice with different options. (\usepackage[bar]{foo} \usepackage[baz]{foo}) Aug 22, 2018 at 11:03

The glossaries-extra package internally loads glossaries so you don't need to load both. The "noidx" method is quick for order of use/definition but slow and inefficient for alphabetic sorting, so glossaries-extra provides a hybrid method where you can use makeindex/xindy for the glossaries that need alphabetical ordering and \printnoidxglossary for order of use/definition. With glossaries-extra, there's an optional argument to \makeglossaries that's a comma-separated list of glossary labels indicating which glossaries need processing by makeindex/xindy. These ones are displayed with \printglossary and the others are displayed with \printnoidxglossary. (Note that there's no \makenoidxglossary.)

\documentclass[a4paper,twoside]{book}
\usepackage[abbreviations,symbols,nogroupskip,nonumberlist]{glossaries-extra}

\makeglossaries[abbreviations]

\glsxtrnewsymbol[description={position}]{x}{\ensuremath{x}}
\glsxtrnewsymbol[description={velocity}]{v}{\ensuremath{v}}
\glsxtrnewsymbol[description={acceleration}]{a}{\ensuremath{a}}
\glsxtrnewsymbol[description={time}]{t}{\ensuremath{t}}
\glsxtrnewsymbol[description={force}]{F}{\ensuremath{F}}

\newabbreviation{ny1}{NY}{New York}
\newabbreviation{la1}{LA}{Los Angeles}
\newabbreviation{un1}{UN}{United Nations}

\begin{document}
\printnoidxglossary[type=symbols,sort=use,style=long,title={List of Symbols}]
\printglossary[type=abbreviations]

Reference symbols: $\gls{F}$, $\gls{t}$, $\gls{x}$, $\gls{v}$, $\gls{a}$.

\gls{ny1} \gls{la1} and \gls{un1} are abbreviations that should
appear alphabetically in the list of abbreviations.

\end{document}


The build process still uses the makeglossaries script, which picks up from the .aux file which glossaries need processing, so in this case it will skip the list of symbols.

The list of symbols is in the order of use:

The list of abbreviations is in alphabetical order:

If you prefer to use \newacronym instead of \newabbreviation you need to replace the abbreviations package option with acronyms (or acronym) and set the abbreviation style:

\documentclass[a4paper,twoside]{book}
\usepackage[acronym,symbols,nogroupskip,nonumberlist]{glossaries-extra}

\makeglossaries[\acronymtype]

\glsxtrnewsymbol[description={position}]{x}{\ensuremath{x}}
\glsxtrnewsymbol[description={velocity}]{v}{\ensuremath{v}}
\glsxtrnewsymbol[description={acceleration}]{a}{\ensuremath{a}}
\glsxtrnewsymbol[description={time}]{t}{\ensuremath{t}}
\glsxtrnewsymbol[description={force}]{F}{\ensuremath{F}}

\setabbreviationstyle[acronym]{long-short}

\newacronym{ny1}{NY}{New York}
\newacronym{la1}{LA}{Los Angeles}
\newacronym{un1}{UN}{United Nations}

\begin{document}
\printnoidxglossary[type=symbols,sort=use,style=long,title={List of Symbols}]
\printglossary[type=\acronymtype]

Reference symbols: $\gls{F}$, $\gls{t}$, $\gls{x}$, $\gls{v}$, $\gls{a}$.

\gls{ny1} \gls{la1} and \gls{un1} are abbreviations that should
appear alphabetically in the list of abbreviations.

\end{document}


Here's a completely different approach where the terms are defined in .bib files.

abbreviations.bib:

% Encoding: UTF-8

@abbreviation{ny1,
short = {NY},
long = {New York}
}

@abbreviation{la1,
short = {LA},
long = {Los Angeles}
}

@abbreviation{un1,
short = {UN},
long = {United Nations}
}


If you already have an existing file containing \newabbreviation (or \newacronym) you can convert it to a .bib with convertgls2bib, which is supplied with bib2gls.

symbols.bib:

% Encoding: UTF-8

@symbol{x,
name = {\ensuremath{x}},
description = {position}
}

@symbol{v,
name = {\ensuremath{v}},
description = {velocity}
}

@symbol{a,
name = {\ensuremath{a}},
description = {acceleration}
}

@symbol{t,
name = {\ensuremath{t}},
description = {time}
}

@symbol{F,
name = {\ensuremath{F}},
description = {force}
}


Again, if you already have an existing file containing \glsxtrnewsymbol you can convert it to a .bib file with convertgls2bib.

Document (test.tex):

\documentclass[a4paper,twoside]{book}
\usepackage[record,% using bib2gls
abbreviations,symbols]{glossaries-extra}

src={abbreviations},% data in abbreviations.bib
sort={en}, % sort by this language tag (en = English)
type=abbreviations, % put the entries in this glossary
save-locations=false % no number list required
]

src={symbols}, % data in symbols.bib
sort={use}, % sort by order of use
type=symbols, % put the entries in this glossary
save-locations=false % no number list required
]

\begin{document}
\printunsrtglossary[type=symbols,style=long,title={List of Symbols}]
\printunsrtglossary[type=abbreviations]

Reference symbols: $\gls{F}$, $\gls{t}$, $\gls{x}$, $\gls{v}$, $\gls{a}$.

\gls{ny1} \gls{la1} and \gls{un1} are abbreviations that should
appear alphabetically in the list of abbreviations.

\end{document}


The document build is:

pdflatex test
bib2gls test
pdflatex test


By default bib2gls doesn't form letter groups, so there's no need for the nogroupskip option now. If you decide that you do actually want letter groups you need to add the --group or -g switch:

bib2gls -g test


The list of symbols is as before:

and the list of abbreviations is again in alphabetical order:

This provides a more flexible way of applying different ordering to different glossaries.

If your TeX distribution is too old to support either the hybrid method or the bib2gls method, you can use the \makenoidxglossaries method with just the base glossaries package as in the other answer, but with glossaries-extra you can still use \glsxtrnewsymbol if you have the symbols package option as that command has been available since the first release of glossaries-extra:

\documentclass[a4paper,twoside]{book}
\usepackage[abbreviations,symbols,nogroupskip,nonumberlist]{glossaries-extra}

\makenoidxglossaries

\glsxtrnewsymbol[description={position}]{x}{\ensuremath{x}}
\glsxtrnewsymbol[description={velocity}]{v}{\ensuremath{v}}
\glsxtrnewsymbol[description={acceleration}]{a}{\ensuremath{a}}
\glsxtrnewsymbol[description={time}]{t}{\ensuremath{t}}
\glsxtrnewsymbol[description={force}]{F}{\ensuremath{F}}

\newabbreviation{ny1}{NY}{New York}
\newabbreviation{la1}{LA}{Los Angeles}
\newabbreviation{un1}{UN}{United Nations}

\begin{document}
\printnoidxglossary[type=symbols,sort=use,style=long,title={List of Symbols}]
\printnoidxglossary[type=abbreviations]

Reference symbols: $\gls{F}$, $\gls{t}$, $\gls{x}$, $\gls{v}$, $\gls{a}$.

\gls{ny1} \gls{la1} and \gls{un1} are abbreviations that should
appear alphabetically in the list of abbreviations.

\end{document}


The advantage is that the code is a bit more compact.

• Thank you, but, using Overleaf, I can't compile the first two examples you gave. It doesn't like \printnoidxglossary[type=symbols,sort=use,style=long,title={List of Symbols}].The error message is LaTeX Error: \@glo@assign@sortkey undefined. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.55 ...rt=use,style=long,title={List of Symbols}] Aug 22, 2018 at 12:25
• @BJPrim It seems that Overleaf has an old version of glossaries-extra (2016/08/15 v1.07). The latest version is currently 1.36 2018-08-18. The Overleaf version is also too old for the bib2gls example (and I'm guessing bib2gls isn't installed on Overleaf). Aug 22, 2018 at 12:42
• Oh OK, that's a shame. I will go with NBur's option then but still accept your answer as the best one due to the comprehensive documentation. Aug 22, 2018 at 12:44
• @BJPrim Yes, it's a shame. They could really do with updating their TeX distribution. (And thanks :-) ) Aug 22, 2018 at 12:48

Adapted from this answer by @Grimler: I removed the filecontents and changed the sort type for symbols

\documentclass{article}
\usepackage[acronyms,toc,nonumberlist,nogroupskip]{glossaries}
\newglossary{symbols}{sym}{sbl}{List of Symbols}
%\usepackage{filecontents}
%\begin{filecontents}{gloss.tex}
%================ACRONYMS=================%
\newacronym{ny1}{NY}{New York}
\newacronym{la1}{LA}{Los Angeles}
\newacronym{un1}{UN}{United Nations}
%================SYMBOLS=================%
\newglossaryentry{x}{type=symbols,name=\ensuremath{x},sort=x,description={position}}
\newglossaryentry{v}{type=symbols,name=\ensuremath{v},sort=v,description={velocity}}
\newglossaryentry{a}{type=symbols,name=\ensuremath{a},sort=a,description={acceleration}}
\newglossaryentry{t}{type=symbols,name=\ensuremath{t},sort=t,description={time}}
\newglossaryentry{F}{type=symbols,name=\ensuremath{F},sort=F,description={force}}
%\end{filecontents}
\makenoidxglossaries
\glsnoexpandfields
\begin{document}
\gls{ny1} \gls{la1} and \gls{un1} are abbreviations that should
appear alphabetically in the list of abbreviations.

Reference symbols: $\gls{F}$, $\gls{t}$, $\gls{x}$, $\gls{v}$, $\gls{a}$.


• In case you use \printnoidxglossary[type=symbols,sort=letter], you can force your \newglossaryentry to be sorted in the right way. For instance, sort $$\vec{A}$$ as A.