7

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.

\glsdefaulttype
l.50 }
The control sequence marked  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  for immediate help.
...
l.50 }
You need to define a new glossary type, before making entries in it
! Missing \endcsname inserted.

\glsdefaulttype
l.50 }
The control sequence marked  should
not appear between \csname and \endcsname.

Your answers will be welcome.

  • Shouldn't \acronymtype be used instead of \newacronym? – egreg Jan 7 '14 at 15:40
  • You are using nomain option so no default glossary type is defined... Did you mean to add the acronym option? – karlkoeller Jan 7 '14 at 15:42
  • 1
    I get ! Package glossaries Error: No default glossary type (have you used nomain'?)., and after removing nomain it works fine. – Torbjørn T. Jan 7 '14 at 15:42
  • 1
    Exactly, thank you very much. As I remove nomain option, I can compile succesfully. – sk001 Jan 7 '14 at 15:48
6

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 as acronym or explicitly using \newglossary).

It looks like you actually want the acronym option with \newacronym rather than \newglossaryentry. Like this:

\documentclass[11pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}

\author{sk001}
\title{My title}

\usepackage[style=long,nonumberlist,toc,xindy,acronym,nomain]{glossaries}

\makeglossaries

\newacronym{iai}{IAI}{Institut Africain d'Informatique}

\begin{document}

L'\gls{iai} est un établissement d'enseignement supérieur.
Next use: \gls{iai}.

\printglossary[type=\acronymtype]

\end{document}

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:

\documentclass[11pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}

\author{sk001}
\title{My title}

\usepackage[style=long,nonumberlist,toc,xindy,acronym,nomain]{glossaries}

\makeglossaries

\newacronym{iai}{IAI}{Institut Africain d'Informatique}

\begin{document}

L'\gls{iai} est un établissement d'enseignement supérieur.
Next use: \gls{iai}.

\printglossaries

\end{document}

Or, with at least version 4.0, you can use \printacronyms, which is the same as \printglossary[type=acronym].

Both the above examples produce:

Image of result

Other notes:

  1. You don't need section=chapter in the package option as that's the default for classes that define \chapter
  2. If you're just starting out with glossaries, I don't recommend using nowarn 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:

  • Thank you very much for your help. It is very clear and explicit. Thank very much @Nicola Talbot – sk001 Jan 8 '14 at 12:46

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.