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
Best Answer
The
glossaries-extra
package internally loadsglossaries
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, soglossaries-extra
provides a hybrid method where you can usemakeindex
/xindy
for the glossaries that need alphabetical ordering and\printnoidxglossary
for order of use/definition. Withglossaries-extra
, there's an optional argument to\makeglossaries
that's a comma-separated list of glossary labels indicating which glossaries need processing bymakeindex
/xindy
. These ones are displayed with\printglossary
and the others are displayed with\printnoidxglossary
. (Note that there's no\makenoidxglossary
.)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 theabbreviations
package option withacronyms
(oracronym
) and set the abbreviation style:Here's a completely different approach where the terms are defined in
.bib
files.abbreviations.bib
:If you already have an existing file containing
\newabbreviation
(or\newacronym
) you can convert it to a.bib
withconvertgls2bib
, which is supplied withbib2gls
.symbols.bib
:Again, if you already have an existing file containing
\glsxtrnewsymbol
you can convert it to a.bib
file withconvertgls2bib
.Document (
test.tex
):The document build is:
By default
bib2gls
doesn't form letter groups, so there's no need for thenogroupskip
option now. If you decide that you do actually want letter groups you need to add the--group
or-g
switch: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 baseglossaries
package as in the other answer, but withglossaries-extra
you can still use\glsxtrnewsymbol
if you have thesymbols
package option as that command has been available since the first release ofglossaries-extra
:The advantage is that the code is a bit more compact.