# Description length limit with glossaries

Some of my glossarie entries have a rather long description. After a certain number of carracters they stop being displayed by the printglossaries command. Here is an exemple producing this problem :

\documentclass{article}
\usepackage[shortcuts]{glossaries}

\makeglossaries

\newglossaryentry{short}{name={short},
description={a short entry}}

\newglossaryentry{long}{name={long},
description={
a long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry
}}

\begin{document}
This one works : \gls{short}.
This one does not : \gls{long}

\printglossaries

\end{document}


How can I sidestep this issue?

-

In the glossary log file you will see

!! Input index error (file = gl55.glo, line = 2):
-- First argument too long (max 1024).


Fortunately TeX is a macro processor so it is easy to have short texts standing in for long ones:

\newglossaryentry{long}{name={long},
description={\longdesc}}

\def\longdesc{a long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry}

-

I would like to present more automatic solution to this problem:

\documentclass{article}
\usepackage[shortcuts]{glossaries}
\usepackage{etoolbox}
\makeatletter
%define new glossary entry key, description with no size limit
\define@key{glossentry}{description}{\def\@glo@ldesc{#1}}

%overwrite standard description key with new long description
%it also makes description key not mandatory when long description is defined
\renewcommand{\@newglossaryentryprehook}{
\def\@glo@ldesc{}
\def\@glo@desc{\@glo@ldesc}
}
\renewcommand{\@newglossaryentryposthook}{
%save the content of new ldesc variable and prevent it from expanding. Its important if we want to use fancy latex commands description
\protected@csxdef{glo@\@glo@label @ldesc}{\expandonce{\@glo@ldesc}}
%overide description field for this glossary entry. By using csexpandonce and csuse we prevent expansion and take into account that \@glo@label may have white spacess in it.
\protected@csxdef{glo@\@glo@label @desc}{\csexpandonce{csuse{glo@\@glo@label @ldesc}}}
%because \@newglossaryentryprehook is invoked after \do@glo@storeentry in glossaries.sty we need to save it all again ;(
\do@glo@storeentry{\@glo@label}
}
\makeatother

\makeglossaries

\newglossaryentry{short}{name={short},
description={a short entry}}

\newglossaryentry{long}{name={long},
description={
a long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry
}}

\begin{document}
This one works : \gls{short}.
This one does not : \gls{long}

\printglossaries

\end{document}

-
Welcome to TeX.sx! – Andrew Swann May 7 '13 at 13:05
Thanks, hope my approach will be useful to somebody :) – groundnuty May 7 '13 at 13:51

(I realise the question is old, but in case anyone is still interested I'm adding this.)

This isn't a problem with newer versions (4.0 and above) of glossaries as the description is no longer written to the file processed by makeindex. Now you're only likely to overflow makeindex's buffer by having an extremely long label.

So your minimal example now works without any error from makeindex. If anyone else is encountering the same problem, the best solution is to update their version of glossaries.

Multi-paragraph descriptions are also now possible with \longnewglossaryentry:

\documentclass{article}
\usepackage[shortcuts]{glossaries}

\makeglossaries

\newglossaryentry{short}{name={short},
description={a short entry}}

\longnewglossaryentry{long}{name={long}}
{a long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
paragraph break

long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry a long entry a long entry a long entry a
long entry a long entry
}

\begin{document}
This one works : \gls{short}.
This also works : \gls{long}

\printglossaries

\end{document}

-