You can use the section
package option to change the sectioning command used by the glossaries. For example:
\documentclass{book}
\usepackage[acronym,section]{glossaries}
\makeglossaries
\newglossaryentry{sample}{name={sample},
description={a sample entry}}
\newacronym{aca}{aca}{a contrived acronym}
\begin{document}
\chapter{Sample}
A \gls{sample} entry and \gls{aca}. Second use: \gls{aca}.
Plurals: \glspl{sample}. Reset acronym\glsreset{aca}.
First use: \glspl{aca}. Second use: \glspl{aca}.
\chapter*{List of Terms and Acronyms}
\printglossaries
\end{document}
Result:
Or you can just combine the main glossary with the list of acronyms by removing the acronym
package option:
\documentclass{book}
\usepackage{glossaries}
\makeglossaries
\newglossaryentry{sample}{name={sample},
description={a sample entry}}
\newacronym{aca}{aca}{a contrived acronym}
\begin{document}
\chapter{Sample}
A \gls{sample} entry and \gls{aca}. Second use: \gls{aca}.
Plurals: \glspl{sample}. Reset acronym\glsreset{aca}.
First use: \glspl{aca}. Second use: \glspl{aca}.
\printglossary[title={List of Terms and Acronyms}]
\end{document}
Result:
Creating a list of acronyms (or glossary) is a three stage process (at least):
- Typeset the document using LaTeX (or PDFLaTeX or XeLaTeX or LuaLaTeX, as appropriate)
- Run the
makeglossaries
Perl script or the makeglossaries-lite
Lua script.
- Typeset the document again.
(You may need to repeat step 3.) Every time you modify the document in a way that alters the list (for example, adding or deleting instances of \gls
, or removing or inserting text that results in a change in the associated page numbers) then you need to repeat all three steps in order to update the list.
The command \makeglossaries
in your document creates some glossary-related files (.glo
or .acn
) and each time you use commands like \gls
an entry is added to the relevant file when the document is typeset (in step 1).
In step 2 a special indexing application is run that reads in those glossary-related files and writes another file (.gls
or .acr
) with the LaTeX code required to typeset the glossary or list of acronyms. This file is then input in your document in step 3.
Step 2 causes the most confusion as it requires running a command line script. However, most front-ends have a button or menu item you can click that will run the script for you. Most front-ends need to be configured to run makeglossaries
or makeglossaries-lite
. The following TeX.SE answers provide instructions for integrating makeglossaries
on various front-ends.
For WinEdt, have a look at the comp.text.tex thread Executing Glossaries' makeindex from a WinEdt macro.
For other front-ends, see Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build.
In each of the above cases, you need to have Perl installed if you use makeglossaries
(but not makeglossaries-lite
) or if you want to use xindy
instead of the default makeindex
.
Since makeglossaries-lite
is a Lua script, you should already have a Lua interpreter if you have a modern TeX distribution with LuaTeX. If you want to use makeglossaries-lite
instead, you should just be able to replace all references to makeglossaries
with makeglossaries-lite
, although it has fewer options and doesn't provide diagnostic tools, so it's not as useful if things go wrong. (Note that makeglossaries-lite
was added to glossaries
version 4.16, so it won't be available for older versions.)
Another possibility if you are having difficulty with step 2 is to add the package option automake
to glossaries
:
\usepackage[automake]{glossaries}
(Introduced in glossaries
version 4.08.) This will try to get TeX to run the external applications (step 3 is still required) but this won't work if the shell escape is disabled. This option also won't work with xindy
in the restricted mode, since xindy
isn't on the list of trusted applications.¹ With both xindy
and automake
, you would need the less secure unrestricted mode, which I don't recommend for security reasons.
Alternatively, there's a GUI approach that uses Java rather than Perl. See also What can interfere with glossaries to prevent printing?
¹This is the case with TeX Live. I don't know about MiKTeX.
Best Answer
If
makeindex
is used and notxindy
, there's a little bit more to do.makeindex
uses.ist
(index style files) in which the precise setup forglossaries
is written byglossaries
on-the-fly, unless an explicit different file is given.Here is the file that is generated for the jobname
glossariespageorder.tex
:The crucial point for this issue about the page order is the
page_precedence
key which is by default "rRnaA", not "rnR" as requested by the O.P.As far as I know there's no easy way to use
glossaries
to write user-defined settings into this\jobname.ist
file.Here's a hack that sets the
page_precedence
to "rnRAa", i.e. lower case Roman numbers, arabic numbers, upper case Roman numbers, uppercase letters and lower case lettersby writing into the
\glswrite` file.Improved version