[Tex/LaTex] Creating a standalone glossary

dictionariesglossaries

As a followup to this question, I would like to ask how can I use the glossaries package just for the creation of a glossary. I do not want it to be part of a document rather a standalone document where there's a list of terms and their definitions.

Edit (1): I guess that what I want, is often called a lexicon, or a dictionary.

Edit (2): In order to clarify what I'm after, let me add few remarks. First, it may well be that glossaries is not what I'm looking for. I am looking for a tool which will enable me to edit entries which will include text, figure, diagrams, links between different entries etc. and then to typeset it in an alphabetic order. Maybe something like an encyclopedia is a better description of what I want to obtain. I hope it is cleared now.

Edit (3): Finally I found an example of what I want to have at the end. Consider this book. I clearly want something way simpler, but this is the spirit. Namely, each term/entry can contain math, figures etc. in it. The compilation process should take care of the alphabetic order. Is glossaries the right package to use?

Best Answer

Here's the bare bones of what you'll need (see Notes below the 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}

NOTES:

  1. Define \glossaryname before loading the glossaries package
  2. Load the glossaries package with the nonumberslist option to suppress links/hyperlinks to non-existent pages
  3. Choose whatever \printglossary[style=...] best suits your needs (I usually go with style=long, preceded by \setlength{\glsdescwidth}{...} to configure the associated longtable width).
  4. Tack on a % to each end-of-line to prevent any spurious text creeping into the output stream before the \printglossary command.
  5. Run the makeglossaries command when rendering to make the glossary appear