TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I used an answer provided by Geoffrey Jones regarding how to create a Lexicon of sorts (unmodified code):

    \documentclass{article}
\newcommand*{\glossaryname}{Dictionary}
\usepackage[nonumberlist]{glossaries}
\newcommand{\dictentry}[2]{%
  \newglossaryentry{#1}{name=#1,description={#2}}%
  \glslink{#1}{}%
}
\makeglossaries

\begin{document}
\dictentry{aardvark}{an animal}%
\dictentry{lion}{another animal, but with
  a really long description that spills over many, many, many, many, many, 
  many, many, many, many, many, many, many, many, many, many, many, many, 
  many, many, many, many, many, many, many, many, many, many lines}
\dictentry{zebra}{yet another animal}%
\printglossary[style=list]%
\end{document}

My first question is: How would I add other fields (or is it possible), like the symbols field provided by glossaries in such a way that I only had to add a last bracket with the symbol, \dictentry{concept}{description}{symbol} (I'm not yet comfortable fiddling with the newcommand function, I tried but failed to add a symbol field)

The second question is: Is there a length limit in the description field, when using the glossaries package? I ask because using the setup described above, the entry doesn't seem to be added to the gls file when it's too large (ca. 8-9 lines of text in the outputted document.

share|improve this question
up vote 4 down vote accepted

I can only answer your second question - by quoting from the glossaries FAQ:

If you have a very long description, it is possible that you may exceed makeindex's buffer. In which case, try defining a command that stores the long description, and use that when you define the entry.

The complete information can be found here.

EDIT: Quoting p. 117 of the glossaries documentation:

Be careful not to make the description too long, because makeindex has a limited buffer. \@glo@desc is defined to be a short command to discourage lengthy descriptions for this reason. If you do have a very long description, or if you require paragraph breaks, define a separate command that contains the description, and use it as the value to the description key.

share|improve this answer
    
Ah, ok. This seems reasonable, as a very long description isn't as useful. It is good to know that it is possible to define a longer description elsewhere, were it to be needed (I ended up making my texts more concise :) ). – Jóhann Dec 6 '10 at 1:07

The glossaries package has been changed since this question and the other answer were posted. If you are still encountering this problem, update your version of glossaries. Note that \newglossaryentry is still a “short” command, so you can't have paragraph breaks (except through \glspar). \longnewglossaryentry allows explicit paragraph breaks.

It's best to define all entries in the preamble, so your MWE would be better written as:

\documentclass{article}
\newcommand*{\glossaryname}{Dictionary}
\usepackage[nonumberlist]{glossaries}
\newcommand{\dictentry}[2]{%
  \newglossaryentry{#1}{name=#1,description={#2}}%
  \glsadd{#1}%
}
\makeglossaries

\dictentry{aardvark}{an animal}%
\dictentry{lion}{another animal, but with
  a really long description that spills over many, many, many, many, many, 
  many, many, many, many, many, many, many, many, many, many, many, many, 
  many, many, many, many, many, many, many, many, many, many lines}
\dictentry{zebra}{yet another animal}%

\begin{document}
\printglossary[style=list]%
\end{document}

There's a symbol key that you can use to add a symbol, so you could change the definition of \dictentry to

\newcommand{\dictentry}[3]{%
  \newglossaryentry{#1}{name=#1,description={#2},symbol={#3}}%
  \glsadd{#1}%
}

Alternatively, add an optional argument and supply the symbol (and any other information through that):

\newcommand{\dictentry}[3][]{%
  \newglossaryentry{#2}{name=#2,description={#3},#1}%
  \glsadd{#2}%
}

Now you can do:

\dictentry[symbol={symbol here}]{aardvark}{an animal}

or

\dictentry[plural={geese}]{goose}{a bird}

You'll need a glossary style that displays the symbol. The list style doesn't, but the tree style does. The glossaries styles gallery shows sample images of all the predefined styles, or you can define a custom style. There are some examples in the main glossaries gallery.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.