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