2

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?

  • glossaries doesn't define \acro. Also, \makeglossaries doesn't have an argument. You need to load glosario.tex with \loadglsentries. Try the beginner's guide for some examples. – Nicola Talbot Apr 21 '16 at 9:20
3

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:

image of document

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:

image of document

  • The 1st example above gives me the following, No pdf file. Why? (C:\Full_TeX\texmf\tex\generic\xkeyval\xkeyval.tex \XKV@toks=\toks14 \XKV@tempa@toks=\toks15 \XKV@depth=\count87 File: xkeyval.tex 2012/10/14 v2.6b key=value parser (HA) (C:\Full_TeX\texmf\tex\generic\xkeyval\keyval.tex))) ! LaTeX Error: File mfirstuc.sty' not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: sty) Enter file name: ! Emergency stop. l.46 \RequirePackage {textcase}` – Olga K Apr 21 '16 at 9:53
  • @OlgaK You need to install the mfirstuc package. You should be able to do this through your TeX package manager. – Nicola Talbot Apr 21 '16 at 9:58
  • I have MikTex Options - Refresh bases on fly, and normally it downloads and install all packages listed in preambula itself. But not for this case – Olga K Apr 21 '16 at 10:15
  • I've tried to add \usepackage{mfirstuc}, still no result – Olga K Apr 21 '16 at 10:17
  • @NicolaTalbot I am using the second option which seems to be working a bit better as the first one didn't add the glossary to my document. When using the secon option a new page is added to document saying: "This document is incomplete. The external file associated with the glossaty 'abbreviations' (which should be called JCG_TFG.gls-abr) hasn't been created." – Neptune Apr 21 '16 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.