# [Tex/LaTex] Trouble making a glossary

glossaries

I have been trying to make a glossary using the package glossaries, I am clearly doing something wrong as I keep gettin errors when compiling the document.

I have the following:

1. Create a document (glosario.tex) with all the definitions, for me most of them are acronyms so I have defined them the following way: \acro{CCTV}{\emph{Close Circuit Television}}

2. Add the following commands to my preamble:

\usepackage[toc]{glossaries} % Load the package with the acronym option
\makeglossaries{glosario} % Generate the glossary
\printglossary[type=\acronymtype] % prints just the list of acronyms


Despite trying several thing this doesn't seem to work. Anyone know what I am doing wrong and how this can be solved?

#### Best Answer

Create a document (glosario.tex) with all the definitions, for me most of them are acronyms so I have defined them the following way: \acro{CCTV}{\emph{Close Circuit Television}}

You seem to be mixing up packages. glossaries doesn't define \acro.

\usepackage[toc]{glossaries} % Load the package with the acronym option

This isn't loading the package with the acronym option. It's loading it with the toc option.

\makeglossaries{glosario} % Generate the glossary

The \makeglossaries command doesn't have an argument

Your glosario.tex file needs to be loaded using \loadglsentries. Example glossario.tex:

\newacronym{CCTV}{CCTV}{Closed Circuit Television}


Main document:

\documentclass{article}

\usepackage[acronym,toc]{glossaries}

\makeglossaries

% Define a style the emphasizes the long form:

\newacronymstyle{em-long-short}
{%
\GlsUseAcrEntryDispStyle{long-short}%
}%
{%
\GlsUseAcrStyleDefs{long-short}%
\renewcommand*{\genacrfullformat}[2]{%
\emph{\glsentrylong{##1}}##2\space
(\firstacronymfont{\glsentryshort{##1}})%
}%
\renewcommand*{\Genacrfullformat}[2]{%
\emph{\Glsentrylong{##1}}##2\space
(\firstacronymfont{\glsentryshort{##1}})%
}%
\renewcommand*{\genplacrfullformat}[2]{%
\emph{\glsentrylongpl{##1}}##2\space
(\firstacronymfont{\glsentryshortpl{##1}})%
}%
\renewcommand*{\Genplacrfullformat}[2]{%
\emph{\Glsentrylongpl{##1}}##2\space
(\firstacronymfont{\Glsentryshortpl{##1}})%
}%
}

\setacronymstyle{em-long-short}

\loadglsentries{glosario}

\begin{document}
First use: \gls{CCTV}. Next use: \gls{CCTV}.

\printglossary[type=\acronymtype]
\end{document}


Steps to build this document: latex, makeglossaries, latex (or pdflatex instead of latex). If you can't work out how to run makeglossaries, just add automake to the package option list:

\usepackage[automake,toc,acronym]{glossaries}


This produces:

Alternatively:

File glosario.tex:

\newabbreviation{CCTV}{CCTV}{Closed Circuit Television}


Main file:

\documentclass{article}

\usepackage[automake,abbreviations]{glossaries-extra}

\makeglossaries

\setabbreviationstyle{long-short}

\renewcommand{\glsfirstlongdefaultfont}[1]{\emph{#1}}

\loadglsentries{glosario}

\begin{document}
First use: \gls{CCTV}. Next use: \gls{CCTV}.

\printabbreviations
\end{document}


This produces: