I'm translating a Sanskrit text full of plant names. In a previous project of this type, I created a simple bilingual index, Sanskrit-English and English-Sanskrit. I did not include Latin binomials and, most regrettable, I didn't include any of the source-referencing and thought that went into my translation choices. I had compiled all this material, but I didn't share it with the public. With the current project, I want to use a database to collect the information about each plant cumulatively and in a single place, and I want to have a straightforward way of presenting this complex data in the book.
The answer is the LaTeX package Glossaries. Glossaries is one of those packages, like BibLaTeX, that is extremely powerful and flexible, and therefore complex to learn. The reference manual of glossaries-extra is over a thousand pages long.
Objectives:
- Simple input system in the body of the translation;
- Alphabetical glossary by plant name, with page index, for the back of the book. Like this:
I have achieved this with the following system.
BibTeX and bib2gls
- label, which is the Sanskrit name of the plant (with diacritical marks);
- description, which contains the Latin binomial and anything else I want to say about the Sanskrit plant name.
- name, which is the English common name of the plant, that will appear in the translation.
Note that I'm using BibLateX citations in the description field, to cite the botanical literature that I want to refer to.
What you write in the main text
In the text of my translation, I use the \gls{} command to cite the Sanskrit plant name, like this:
And so, he should burn \gls{dhava} and ...
After running LaTeX foobar and bib2gls foobar, I get the output,
and at the back of the book, by using the command \printunsrtglossaries, I get
TLDR: as I write, I just use the Sanskrit name of the plant, and the GE package replaces it with the English translation from my bib file and also constructs the alphabetical glossary entries at the back of the book.
Close readers will have seen that the word "axlewood" in the translation is in a different colour: it's a clickable hot link to the right page of the index. The index entries have clickable page-references back to the body of the text. The glossary has clickable links to the bibliography.
The TeX macros that make this happen are in the package xelatex-glossaries.sty that you are most welcome to copy from GitHub. Documentation for this style file is available at the same place, as file wujastyk-local-documentation.pdf.
Special thanks to Nicola L. C. Talbot, author of the remarkable Glossaries package.