I used the acronym
package (usepackage{acronym}
) to create acronyms in my thesis. In the beginning of the document, I define the acronym as, for example, \acrodef{USA}{United States of America}
. And then later to use this abbreviation I call it as \ac{USA}
. How do we generate a list of Abbreviations (acronyms) as a list of figures and list of tables in LaTeX?
2 Answers
From the acronym
package documentation:
Acronyms can either defined from an environment specifically introduced for that purpose or by direct definitions.The acronym environment allows one to define all the acronyms needed by a document at a single place and is self-documenting, since a table of acronyms is automatically produced.
And
If one does not want an acronym list to be produced at all, acronyms can bedefined directly thanks to the two commands
\newacro{〈acronym〉}[〈short name〉]{〈full> name〉}
\acrodef{〈acronym〉}[〈short name〉]{〈full name〉}
Therefore, use the acronym
environment and the \acro
command instead of \acrodef
if you want to have a list of acronyms
.
\documentclass{article}
\usepackage[colorlinks]{hyperref}
\usepackage[printonlyused,withpage]{acronym}
\begin{document}
Some text \ac{USA}
\section{List of Acronyms}
\begin{acronym}
\acro{USA}{United States of America}
\end{acronym}
\end{document}
Compiling twice, you will get the following result:
For automated sorting and a lot more (formating) options, I'd recommend the glossaries
or the glossaries-extra
package.
-
Thank you for your answer but why did you use
\begin{acronym} \acro{USA}{United States of America} \end{acronym}
? Can't we useacrodef
as I included in my question? yes, I have also readglossaries
is powerful but how can we use it together withacronym
? Because I have a huge document and all my abbreviations have been defined usingacrodef
and used with\ac{}
command.– BrownCommented May 22, 2019 at 20:33 -
@Brown: As the quoted parts of the
acronym
manual show, the\acrodef
command can be used if you don't want to have a list of abbreviations. In order to create the MWE in my answer, I just followed the example file on page 7 of the documentation where thearconym
environment and the\acro
command are used. Commented May 22, 2019 at 20:43 -
Ok thank you again. But is it common to use page numbers with acronyms?– BrownCommented May 22, 2019 at 20:46
-
@Brown: I don't know, but you can remove the page numbers form the list of acronyms if you remove the
withpage
option from theacronym
package. Commented May 22, 2019 at 20:48
I suggest the powerful acro
package.
\documentclass{article}
\usepackage{acro}
\DeclareAcronym{usa}{
short=USA,
long=United States of America,
}
\DeclareAcronym{eu}{
short=EU,
long=European Union,
}
\DeclareAcronym{ussr}{
short=USSR,
long=Union of Soviet Socialist Republics,
}
\begin{document}
\ac{usa}, \ac{usa}
\ac{eu}, \ac{eu}
\ac{ussr}, \ac{ussr}
\printacronyms
\end{document}