0
\documentclass{scrartcl}

\usepackage[ngerman]{babel}
\usepackage{lipsum}
\usepackage[toc,nomain,acronym,automake]{glossaries-extra}

\newglossary[tmg]{mygloss}{tms}{tmo}{My Glossy}

\makeglossaries

\begin{document}

\newglossaryentry{test}{
    name=test,
    description={Some text},
    type=mygloss
}

% I EXPECT TO SHOW ALSO ENTRIES FROM BELOW, i.e. test2
\glsaddall[types={mygloss}]
\printglossary[type=mygloss,title=My Weird Glossary]

\section{Something}

\lipsum[1]

\newglossaryentry{test2}{
    name=test2,
    description={Some text 2},
    type=mygloss
}

Text immediately after newglossaryentry.

\end{document}

yields a glossary missing the glossary entry test2. Why?

enter image description here

Markus W.
  • 272

1 Answers1

1

Because by default in glossaries-extra the macro \newglossaryentry isn't allowed to be used inside the document body. See the documentation of the docdef option:

docdef={⟨value⟩} (glossaries-extra.sty)

This option governs the use of \newglossaryentry. Available values:

false \newglossaryentry is not permitted in the document environment (default with glossaries-extra and for Option 1 with just the base glossaries package);

restricted \newglossaryentry is only permitted in the document environment if it occurs before \printglossary (not available for some indexing options);

atom as restricted but creates the docdefs file for use by atom (without the limitations of docdef=true);

true \newglossaryentry is permitted in the document environment where it would normally be permitted by the base glossaries package. This will create the docdefs file

(from the glossaries-user.pdf, page 65, subsection 2.1)

So if you're using glossaries-extra you'll have to use either \usepackage[docdef=restricted]{glossaries-extra} or \usepackage[docdef=true]{glossaries-extra} for this to work.

Skillmon
  • 60,462