# Package doc and glossaries together cause problem

If I comment out \RecordChanges below it compiles and works, otherwise I get:

    Package glossaries Warning: No file defined for glossary [' on input line 13.

! Extra \endcsname.
\@@do@wrglossary ...\csname glo@#1@type\endcsname
]{\string \glossaryentry {...
l.13 A \gls{sample}
entry


Here is the minimum example:

\documentclass{article}
\usepackage{doc}
\usepackage{glossaries}

\RecordChanges

\makeglossaries
\newglossaryentry{sample}{name={sample}, description={a sample entry}}

\begin{document}

A \gls{sample} entry

Plurals: \glspl{sample}.

\printglossaries

\end{document}

-
Welcome to TeX.SX! While the glossaries package states to be compatible with doc (provided it's loaded before glossaries, as you do), it seems that \RecordChanges confuses \@wrglossary. –  egreg Oct 3 '13 at 21:36
It seems that moving also \RecordChanges before loading glossaries fixes the problem. –  egreg Oct 3 '13 at 21:54

The command \RecordChanges is simply \makeglossary. But issuing it after loading glossaries puts the system into an unstable state.

So the correct method for making the two package go along together is not only loading doc before glossaries as stated in the documentation of the latter package, but also issue \RecordChanges before loading glossaries.

I'd also load hyperref after doc. So here's a working combination:

\documentclass{article}

\usepackage{doc}
\RecordChanges

\usepackage{glossaries}

\makeglossaries
\newglossaryentry{sample}{name={sample}, description={a sample entry}}

\begin{document}

A \gls{sample} entry

Plurals: \glspl{sample}.

\printglossaries

\end{document}


Maybe glossaries could some other tricks to allow issuing \RecordChanges before or after loading it, but I'll leave this as an exercise for Nicola Talbot. ;-)

-
ooh an exercise for the reader, I mean, for the package writer. :) –  Paulo Cereda Oct 4 '13 at 0:54
glossaries does a check for doc` near the start of the package, so I could add in some code there to fix this. –  Nicola Talbot Oct 4 '13 at 7:54