I am writing few acronyms in my text and I don't want to cross reference them. But just want to have their list printed in the pdf (pdfLatex
) output .
I tried with \acro
and [acronym]{glossaries}
packages but didn't get an acronyms list. I just got the text "NY and LA are in US."
Suggestion please?
Here is a compilable example:
\documentclass[
fontsize=11pt, % Schriftgröße
paper=a4
%......
]{scrbook}
\usepackage[acronym]{glossaries}
\begin{document}
\newacronym{ny}{NY}{New York}
\newacronym{la}{LA}{Los Angeles}
\newacronym{us}{US}{United States}
\section{A}
NY and LA are in US.
\printglossary[type=\acronymtype,title=Abbreviations]
\end{document}
Best Answer
The
glossaries
package (and its extensionglossaries-extra
) provides commands to index and reference terms or abbreviations. This is done by first defining the entries and then using markup commands like\gls
within the document.Here's the modified MWE (thank you for providing one!)
In order to make the glossary (list of abbreviations) appear. You need the following build sequence:
pdflatex
makeglossaries
(a Perl script that automatically runsmakeindex
orxindy
according to the document settings)pdflatex
The second step sometimes causes confusion, so there's an
automake
package option, which will use TeX's shell escape to automatically runmakeindex
orxindy
for you.If those steps are successful, the above produces:
on the first page and
on the last page.
Note I've moved the
\newacronym
definitions to the preamble. If you want them in the document use the following instead:Alternatively:
Note that only those entries that have been explicitly marked with commands like
\gls
are added to the list.If you get the error message:
then your version of
glossaries
is too old. If you don't get this message and you are usingautomake
but your list of abbreviations is still missing, check the log file for lines starting withrunsystem
. If it hasdisabled
at the end of the line then the shell escape has been disabled, in which case you'll need to find a way to runmakeindex
ormakeglossaries
. Related resources:If you're not interested in the indexing and referencing commands provided by
glossaries
(such as\gls
), then you don't actually needglossaries
. For example:This only requires one run of
pdflatex
and no extra applications. This produces: