
How to make a glossary with XINDY
---------------------------------
Here are my experiences. It is not a perfect solution (some might call
it a hack) but it does work. After all, we don't live in a perfect
world...
1. Generate a suitable parser
- Edit the file src/tex2xindy.l
Change the line
KEYWORD \\indexentry to KEYWORD \\glossaryentry
and the line
LEVEL ! to LEVEL :
Alternatively, apply the following patch:
---------------------
--- tex2xindy-orig.l Tue Mar 31 20:45:22 1998
+++ tex2xindy.l Tue Mar 31 21:03:32 1998
@@ -58,11 +58,11 @@
%}
-KEYWORD \\indexentry
+KEYWORD \\glossaryentry
ENCAP \|
ACTUAL @
ESCAPE \\
-LEVEL !
+LEVEL :
QUOTE \"
ROPEN \(
RCLOSE \)
---------------------
- Next, "make tex2xindy".
- Install tex2xindy as "/usr/local/bin/glos2xindy" or similar.
2. Write a XINDY style file (name it glossary.xdy)
- It should contain *at least* the following:
---------------------
(require "tex/makeidx.xdy")
(markup-index :open "\begin{description}"
:close "~n\end{description}~n"
:tree)
(markup-letter-group-list :sep "")
(markup-indexentry :open "~n \item[" :depth 0)
(markup-indexentry :open "] " :depth 1)
(markup-locclass-list :open " % " :sep ", ")
---------------------
Instead of "description" you may want to use another list environment.
I prefer the "labeling" environment from the KOMA-Script classes (by
Markus Kohm and Frank Neukam).
3. Write your document(s)
- For example (German text, but you get the picture):
---------------------
...
\makeglossary
\begin{document}
... etwas über Sepulken\glossary{Sepulken:wichtiges Element in
der Zivilisation der Ardriten (s.\,d.) auf dem Planeten Enteropia
(s.\,d.); s.\,Sepulkaria.}.
...
\glossary{Sepulkaria:zum Sepulieren (s.\,d.) dienende Objekte.}
...nachschlagen\glossary{Sepulieren:Tätigkeit der Ardriten
(s.\,d.) auf dem Planeten Enteropia (s.\,d.); s.\,a.\,Sepulken.}
...
\end{document}
---------------------
- LaTeX will make a .glo file which might look like this:
---------------------
\glossaryentry{Sepulken:wichtiges Element in der Zivilisation der
Ardriten (s.\,d.) auf dem Planeten Enteropia (s.\,d.);
s.\,Sepulkaria.}{1}
\glossaryentry{Sepulkaria:zum Sepulieren (s.\,d.) dienende Objekte.}{2}
\glossaryentry{Sepulieren:T\"atigkeit der Ardriten (s.\,d.) auf dem
Planeten Enteropia (s.\,d.); s.\,a.\,Sepulken.}{3}
---------------------
4. Prepare the glossary
- run "xindy -f glos2xindy -o MY_FILE.gls glossary.xdy MY_FILE.glo"
or do the same thing in 2 steps:
- "glos2xindy <MY_FILE.glo >MY_FILE.raw"
- "xindy -o MY_FILE.gls glossary.xdy MY_FILE.raw"
- You'll get the file MY_FILE.gls which contains the complete glossary
environment. In our example:
---------------------
\begin{description}
\item[Sepulieren] T\"atigkeit der Ardriten (s.\,d.) auf dem Planeten
Enteropia (s.\,d.); s.\,a.\,Sepulken. % 3
\item[Sepulkaria] zum Sepulieren (s.\,d.) dienende Objekte. % 2
\item[Sepulken] wichtiges Element in der Zivilisation der Ardriten
(s.\,d.) auf dem Planeten Enteropia (s.\,d.); s.\,Sepulkaria. % 1
\end{description}
---------------------
5. Insert the glossary into your document
(You can probably figure it out yourself, but anyway, here's how:)
---------------------
\addcontentsline{toc}{chapter}{Glossary}
\chapter*{Glossary}
\input{MY_FILE.gls}
---------------------
- If you like, define a command \printglossary to do this.
- The End -
--
Thomas Henlich