# Creating a standalone glossary

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?

-

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}}%
}
\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
-
I guess this is what I was asking about. Nevertheless, it is not exactly what I'm after. For example, I tried and failed, to add figures to an entry. What I want is the possibility to typeset what ever I want in each and every entry. Consider a setting where each section for example is an entry and the system sorts and typeset all the section. Is 'glossaries' the right tool? –  Dror Nov 23 '10 at 15:11
@Dror (said in the kindest and most well-meaning way): please take care of the way you ask your questions. Nobody likes to spend time sorting things out exactly per your stated requirements, only to have you casually rescind them followed on equally as casually by a reconfigured set. –  Geoffrey Jones Nov 23 '10 at 15:25
The original question was not posted before I spent some time trying to find the solution by myself. Once I got your reply I tried to implement it, and only then realized that it may be the wrong path to use for my needs. I'm clearly thankful for your time and helpfulness. I hope you would consider my comment as a followup, and a focusing one, rather then anything offending. –  Dror Nov 23 '10 at 16:13
I have just tested your suggestion again, and discovered that it is impossible to have a new line (i.e. an empty line space). I want to make sure I'm not missing something here: it is only possible to have one paragraph as the entry's text. This paragraph should contain nothing but plain text. Am I right? Thanks in advance! –  Dror Nov 24 '10 at 18:00
How does this work? I can't get it to print anything out using the code above verbatim. –  EthanSpitz Jan 29 '14 at 6:16

You can use \glspar to get a \par in the description key. But if you have long texts, it is better to store them e.g. in a command

\dictentry{lion}{\liontext}%
\newcommand\liontext{a large animal\par some facts:
\ begin{itemize}
\item Image: \includegraphics[width=1cm]{tiger}
\item Lives in africa
\end{itemize}}

-

First let me thank Ulrike Fischer and Geoffrey Jones for their nice answers. However, I'm afraid that using glossaries will be too complicated to adjust to fit with what I'm after. Therefore, I will try the following solution: I'll generate a _first.tex file, and a zzzEnd.tex file which will contain the preamble and the \end{document} respectively.

Then, for each entry I'll have a separate file. For example: lion.tex, tiger.tex, cow.tex etc. Each such file will start with \section{Lion} for example, and then the text, figures, tables etc. of the entry.

Finally, I'll use cat *.tex > tmp.tex to generate the whole .tex file, which will be compiled.

I hope that this way I'll be able to achieve my goal.

Of course, later , I could change the title Section into Definition for example. I will try to automize the process. I hope this will solve my problem. I just ran a simple example, and it seems to do the trick for me.

Comment, improvements and other suggestions are still clearly welcome!

Edit (1): Here's a small script I wrote to automize the compilation process:

#! /bin/bash

#Create a tmp directory
mkdir tmp

#Concatenate the different entries into one .tex file in the tmp dir.
cat *.tex > tmp/glossary.tex
# make a copy of the bibTeX
cp ref.bib tmp/

cd tmp
# Complie the document
pdflatex glossary.tex
bibtex glossary
pdflatex glossary.tex
pdflatex glossary.tex

# Extract the resulting .pdf
cd ..
cp tmp/glossary.pdf .

# Clean the mess.
rm -rf tmp


So far it seems to work fine for me. I can add whatever I want to an entry.

-