2

I'm getting this error when I use the \gls command:

Package glossaries Error: Glossary entry `DCD' has already been defined.

These are how I my package:

\documentclass[12pt]{book}
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
\usepackage{upgreek}
\usepackage{float}
\usepackage{siunitx}
\usepackage{amsmath}
\usepackage{a4wide}
\usepackage{tabu}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{verbatim}
\usepackage{amssymb,mathtools}
\usepackage{pdfpages}
\usepackage{array}
\usepackage{braket}
\usepackage{multirow}
\usepackage{multicol}
\usepackage[bookmarks]{hyperref}
\usepackage[acronym]{glossaries}
\usepackage[numbers,sort&compress]{natbib}

\loadglsentries{Acronyms}
\makeglossaries
\loadglsentries[type=\acronymtype]{Acronyms}


\newacronym{DCD}{DCD}{Double Crystal Diffractometer}

It seems to work but I continuosly get the error (the red one in Overleaf).

1 Answer 1

2

There are a few mistakes:

  1. you must use \makeglossaries before creating any glossary or acronym
  2. you should create a Minimum Working Example that is compilable so that we can understand your issu ;)
  3. probably (I'm not sure as you did not write an MWE) you printed a glossary and not the acronyms
  4. you load a file Acronyms.text and you create an acronym also in your preamble, which is a bit weird

Proposed code:

\documentclass[12pt]{book}
\usepackage[bookmarks]{hyperref}
\usepackage[acronym]{glossaries}

%\loadglsentries{Acronyms} % ERROR: loaded before \makeglossaries
\makeglossaries
%\loadglsentries[type=\acronymtype]{Acronyms} % OK if you have an Acronyms.tex file

\newacronym{DCD}{DCD}{Double Crystal Diffractometer}

\begin{document}

    \gls{DCD}

%   \printglossary % NOT OK as you only defined acronyms
    \printacronyms

\end{document}
1
  • you where totally right! Loading twice and one even before the makeglossaries was the mistake.
    – jjvv
    Commented Oct 16, 2019 at 9:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .