I am compiling a .tex
file with TeXmaker, but it's still generating errors.
In fact, I use the glossaries
package but when I add a newglossaryentry
, the compilation ends with errors.
This is my code:
\documentclass[11pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\author{sk001}
\title{My title}
\usepackage[style=long, nonumberlist, toc, xindy, nowarn, nomain, section=chapter]{glossaries}
\makeglossaries
\newglossaryentry{iai}{%
name={IAI},%
description={Institut Africain d'Informatique}%
type=\newacronym
}
\begin{document}
\titlepage
\newpage
L'Institut Africain d'Informatique(\gls{iai}) est un établissement d'enseignement supérieur.
\printglossary
\end{document}
This is the displayed error in the log:
! Missing \endcsname inserted.
<to be read again>
\glsdefaulttype
l.50 }
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Package glossaries Error: Glossary type '\glsdefaulttype ' has not been defin
ed.
See the glossaries package documentation for explanation.
Type H <return> for immediate help.
...
l.50 }
You need to define a new glossary type, before making entries in it
! Missing \endcsname inserted.
<to be read again>
\glsdefaulttype
l.50 }
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
Best Answer
As others have pointed out the problem comes from using
nomain
(which prevents the main glossary from being created) but you haven't provided an alternative glossary (via package options such asacronym
or explicitly using\newglossary
).It looks like you actually want the
acronym
option with\newacronym
rather than\newglossaryentry
. Like this:Note that since you're not using the main glossary, you need to specify the glossary in the optional argument of
\printglossary
. Alternatively you can just use\printglossaries
, like this:Or, with at least version 4.0, you can use
\printacronyms
, which is the same as\printglossary[type=acronym]
.Both the above examples produce:
Other notes:
section=chapter
in the package option as that's the default for classes that define\chapter
glossaries
, I don't recommend usingnowarn
as it will suppress warnings that occur with some common new user mistakes. If you read those warnings, it may save you having to come back for more help.Other resources: