Showing posts with label latex. Show all posts
Showing posts with label latex. Show all posts

Friday, August 02, 2024

TeXstudio under Ubuntu and equivs

Environment: Linux Mint and Ubuntu; separate TeXlive installation

The author of TeXstudio used to distribute deb files for each Linux distribution.  Understandably, that is laborious.  So now, only the PPA is given.  But if you add the PPA to your Linux "software sources" list and try to install TeXstudio, it had dependency links to the whole TeXlive system in the synaptic package library and tries to install all that too.  

The way round this is to create a dummy "TeXlive" installation without these dependencies using the "equivs" system.  (see here and here).

Steps:

  1. sudo apt-get install equivs
  2. Create a control file with this content:
    Section: tex
    Package: texlive-dummy
    Provides: tex-common, texlive-common, texlive-latex-base, texlive-metapost, texlive-xetex, texlive-base-bin, texlive-base-bin-doc, tex-common, tex-gyre, texlive-base, texlive-binaries, texlive-fonts-recommended, texlive-latex-base, texlive-latex-extra, texlive-latex-recommended, texlive-pictures
    Description: texlive dummy package This package provides dpkg with the information that there the texlive packages are already installed.
  3. Run the following:
    equivs-build texlive.ctl
    That produces the file texlive-dummy_1.0_all.deb  This is asudo dpkg -i texlive-dummy_1.0_all.deb "pretend" TeXlive (texlive-latex-base) package that contains no dependencies.
  4. Run
    sudo dpkg -i texlive-dummy_1.0_all.deb
    Now, your system believes it has installed texlive-latex-base, so dependencies on that will be satisfied.
  5. You can now install the TeXstudio PPA and install the TeXstudio program in the normal way.

Sunday, November 06, 2022

Making an Index of Plant Names

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

The Glossaries-extra (GE) package includes a subsystem that reads a BibTeX file and turns it into glossary entries.   My bib file is called plants.bib, and it lives in the same directory as all my BibTeX files (../localtexmf/bibtex/bib)
The BibTeX entry looks like this:
 
 The entries are called, er, @entry; and each entry has three fields, the 
  1. label, which is the Sanskrit name of the plant (with diacritical marks);
  2. description, which contains the Latin binomial and anything else I want to say about the Sanskrit plant name.
  3. 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.