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.

Special thanks to Nicola L. C. Talbot, author of the remarkable Glossaries package.

 

 


 

 

 

Tuesday, July 05, 2022

Good writing: transparency is the new objectivity

I care deeply about good writing, which I believe to be indistinguishable from good thinking.  As an undergraduate, I was lucky enough to get and read two texts that turned into life-long influences:
  • C. S. Lewis, "At the Fringe of Language", in Studies in Words
  • George Orwell, "Politics and the English Language," in Collected Essays.
As a student, I internalized Orwell's six rules:
  1. Never use a metaphor, simile or other figure of speech which you are used to seeing in print.
  2. Never use a long word where a short one will do (see Short words).
  3. If it is possible to cut out a word, always cut it out (see Unnecessary words).
  4. Never use the Passive where you can use the active.
  5. Never use a foreign phrase, a scientific word or a Jargon word if you can think of an everyday English equivalent.
  6. Break any of these rules sooner than say anything outright barbarous (see Iconoclasm).
My professor, Richard Gombrich, also cares about good writing, and impressed that belief upon us students.  Some of his remarks on this topic appear in his lecture "On Being Sanskritic" (p.27).  For example, his ringing indictment,
The so-called `literal translation' -- an intellectual fallacy and an aesthetic monstrosity -- is still widespread;
As a result of my interest in the forms and sins of self-expression, I have developed a kind of radar, pinging for materials that support this interest and take it further.  The Economist Style Guide is one such resource that showed up on the screen long ago. (The full Economist Style Guide seems to have vanished from their website, but the 11th edition (2015) is at archive.org)

Today, I was reading the WikiPedia article about Timothy Leary, and I saw that an unsubstantiated claim ("Others have said") was tagged as a "weasel word".  I didn't know this expression.

Weasel words are described under "unsupported attributions" and are amongst several strategies that I see regrettably often in academic prose.  As WikiPedia says:
Weasel words.svg
Weasel words are words and phrases aimed at creating an impression that something specific and meaningful has been said, when in fact only a vague or ambiguous claim has been communicated. A common form of weasel wording is through vague attribution, where a statement is dressed with authority, yet has no substantial basis. Phrases such as those above present the appearance of support for statements but can deny the reader the opportunity to assess the source of the viewpoint.
Another major technique for avoiding attribution is to use the passive grammatical voice.  To the WikiPedia "weasel words" examples, I could add (and probably will) a category of what might be called "cooercives," words and phrases designed to prevent the reader from thinking too much, by suggesting that thinking isn't going to be worthwhile in this particular case.  Thus, "clearly," "of course," "naturally," "it goes without saying." (Several of these are referenced in WikiPedia's "Editorializing" section, see below.) 

Following the WP link, I stumbled into a wonderful collection of notes about how to write better and avoid writing (and thinking) badly.  "Words to Watch" has the following headings (mid-2014):

 WikiPedia's Manual of Style is excellent, as a whole.  But this section "Words to Watch" is a treasure chest.

A classic work in this area is

 

Monday, May 30, 2022

Further notes on the Rasendramaṅgala and Rasaratnākara

This is an addendum to my article "An Alchemical Ghost" in Ambix (1984: 70--83). DOI: 10.1179/amb.1984.31.2.70.

The chapters of the Rasendrakhaṇḍa 

In 1984, I was not able to list the names of all the chapters of part 2 of the work, the Rasendrakhaṇḍa.  Chapters 17-19 were missing from all the sources available to me.  The name of chapter 20 was derived from a catalogue entry for a manuscript in Germany

  1. On p. 82, discussing the Rasendrakhaṇḍa, I referred to the edition of Y. T. Ācārya (1913) as being unavailable to me. 
    Details: 
    Ācārya, Yādavaśarma Trivikrama, ed. śrīnityanāthasiddhaviracito Rasaratnākarāntargataś Caturtho Rasāyanakhaṇḍaḥ .. Saṃśodhitaḥ Prakāśitaś Ca = Rasayanakhanda, Fourth Part of Rasaratnâkara by Shri Nityanâthasiddha Edited by Jadavjî Tricumjî Âchârya Āyurvedīya Granthamālā (Bombay: The editor, at the Nirnayasagar Press, 1913).

    A scan of that edition is now available at http://n2t.net/ark:/13960/t0005h71h

    For the record, a reprint of this book, falsely calling itself a first edition (prathamaṃ saṃskaraṇam), was published by Caukhambā in Banāras in 1939.  A scan of that second edition is available at http://n2t.net/ark:/13960/t9285md2b.

    Ācārya's edition was based on two manuscripts owned by his friends:
    1. Bombay, property of Vaidya Dāmodara Viṭṭhala Damaṇakara,
    2. Barodara, property of Amṛta Vināyaka Jāmbekar.

    This book does not give a list of the chapters of the Rasendrakhaṇḍa.

  2. Jīvānanda Vidyāsāgara Bhaṭṭācārya's Calcutta edition of 1878.  I can find no online scan of this volume.  It is described as edition "a in HIML IIB, page 702, footnote 169.  This edition ascribes the Rasaratnākara to Nityānanda Siddhānta (sic). The final colophon of MS Jammu Raghunatha 4904 also makes this attribution.

  3. My other source for the twentieth Rasendrakhaṇḍa chapter name, viṣacikitsā, was taken from Janert and Poti, VOHD 2.2 (1970), no. 953:

MS Kathmandu NAK 4-1537

This MS, microfilmed by the NGMPP as A219/4 is available to me for study.  It contains the Rasendrakhaṇḍa.  The chapter titles up to 16 match almost exactly those published in Wujastyk 1984: 72. In addition there are the following chapter names: 

17. vātapittaśleṣmādīnā cikitsā

18. sthaulyādikārśyāṇivāraṇam

19. śirorogacikitsā

20. [but called 25] karṇarāgādivakṣuroganivāraṇam

21. nāsyarogādichardinivāraṇam

22. vātarogādikāngranthinivāraṇam

23. hṛdrogādidīpanānta

24. ajīrṇādichādarogāṃtacikitsā

25. apasmārādisarvabhūtanivāraṇam

26. vṛścikāviṣādisaṃyogajānam

27. agnidagdhādibālagrahanivāraṇam

28. cikitsā

Thus, according to this manuscript, the Rasendrakhaṇḍa has not 20 but 28 chapters.  Chapter 26 is on poisoning by scorpions etc.

MS Kathmandu NAK 5-3089, dated to 1648 CE

This MS, microfilmed by the NGMPP as A216/15 is available to me for study.  Dated saṃvat 1705.  It contains the Rasendrakhaṇḍa.  The chapter titles up to 16 match almost exactly those published in Wujastyk 1984: 72. The additional chapter titles 17-28 match MS Kathmandu NAK 4-1537 exactly. 


Friday, April 22, 2022

Linux Mint Cinnamon problem and fix

 I recently installed and used a Python program, internetarchive.  Somewhere along the line of installing it with pip, the Python setup on my machine got changed, not in a good way.  Lots of Python programs are apparently very sensitive to Python version numbers.  

The symptom was that sound stopped working on my system (except in Zoom, which evidently handles its own sound subsystem).  Then, sound menu wouldn't come up.  Then the Cinnamon system settings control centre, cinnamon-settings, wouldn't come up. It generated an error saying that it couldn't find "requests."   At another time, it couldn't find "urllib3".  

Cut a long story short, running

sudo apt reinstall requests urllib3

fixed the problem.



Wednesday, April 13, 2022

Essay-writing support

For those of you who are writing essays for the first time, here are some guidelines.

There are many guides available to help you with essay-writing.  Here are some that are easy to get:
  • The Modern Humanities Research Association puts out an excellent booklet on writing: The MHRA Style Guide. You can buy it in print (cheap), read it online, or download their free PDF version. Unlike the other guides mentioned here, the MHRA guide is only about the mechanics of writing, spelling, punctuation, footnotes, and bibliographies.  It does not help with how to assemble your ideas, or plan an essay.  But since it's free as a PDF, just get it. It will help you organize your writing and answer questions about silly details like what English words should have capital letters, or how to put together your bibliography.
  • One of my other favourites is the long-established students' guide published by the UK's Open University,
    • The Arts Good Study Guide by Chambers and Northledge (2nd ed., 2008).  It's clearly printed, well-written, and realistic.  See the copy at archive.org (first ed., but still good). 
    • The sister volume, The Good Study Guide (2005), was also excellent, but it's hard to get now (amazon). At archive.org.  Or the epub torrent.
  • The University of Southampton has a Study Skills Handbook by Barbara Allan that addresses essay-writing in chapter 7.  Chapter 13 on Reflection is unusual and rather good, I think.   Free online PDF.
  • Two more very short ones:
    • Ashman & Creme, How to Write Essays (1976). PDF
    • Ashman & Creme, Reading for Study (1976). PDF
  • Many students whose mother tongue isn't International English have difficulty with "a" and "the", the definite and indefinite articles.  There is some excellent online help here at englishpage.com.

It doesn't matter which

There are many other writing guides, each with their own genuine virtues.  For example, the Oxford Essential Guide to Writing or The Economist Style Guide, or Kate Turabian's famous A Guide for Writers of Research Papers, Theses, and Dissertations. They're all excellent.  The most important thing is not which one you get, but that you get one, absorb its messages and put them into practice. 

How to begin

Many guides to writing suggest that you should begin by having a question, and then doing some research, organising your notes, and then writing your essay.  Or some variant of this procedure.  I am not sure I agree.  

I think it's important to start with a question, yes.  But sometimes the best way to begin can be to actually sit down and start writing or typing.  Write a sentence, or two, or a paragraph, about the question.  Then you will begin to feel how much you know and can say, and how much you need to go and read in order to be able to write the next sentence.

The great cultural historian Peter Burke made some interesting remarks about his own process of thinking and writing in this 2004 interview (from 3min 11sec).  He goes to his desk in the morning and writes.  No preliminary reading.  Then, in the afternoon, he goes to the library.  For Burke, writing precedes reading.

Friday, September 25, 2020

Simple example of using XeLaTeX for Devanagari with Velthuis transliteration as input

In earlier posts I addressed this issue, but I think my examples were much too complicated.  Here's a minimum working example.

 

\documentclass{article}
\usepackage{polyglossia}

\setmainlanguage{sanskrit}
\newfontfamily\sanskritfont[Mapping=velthuis-sanskrit] {Sanskrit 2003}

\begin{document}

\Huge
\noindent
dharmak.setre kuruk.setre samavetaa yuyutsava.h| \\
maamakaa.h paa.n.davaa"scaiva kimakurvata sa.mjaya||

\end{document}


And here's the PDF output:

 

This was done with the TeXlive distribution of 2020 and XeLaTeX, running on Linux Mint. I have Sanskrit 2003 font installed in my system (and XeLaTeX can see it: see installation instructions 3.4.4).  Nothing special was required.  Everything is nowadays provided in the TeXlive distribution. The magic happens because of Polyglossia and Fontspec.  The manuals for these two packages explains the \setmainlanguage and \newfontfamily commands.

Wednesday, June 03, 2020

The demise of gksudo from Ubuntu-based distributions and what to do about it

I gather that there were good security-related reasons for discontinuing gksudo. But it's quite inconvenient not having it, for example when you are adding new items to the Linux Mint main menu (using menulibre, for example).

Here's what I do:
  • install ssh-askpass

  • add this line
    SUDO_ASKPASS=/usr/bin/ssh-askpass
    to the file
    /etc/environment
  • Then, in menu or batch commands that you want to pop-up a graphical p/w prompt, say
    sudo -A <command>

Thursday, February 06, 2020

Automounting google-drive-ocamlfuse: getting Google Drive to appear as a Linux folder

This is well documented elsewhere, but just for clarity, here are my settings, that work. I.e., the Google drive appears automatically mounted after a fresh boot.

1. Install google-drive-ocamlfuse

2. Line in /etc/fstab (all one line):
gdfuse#default  /home/dom/GoogleDriveUofA    fuse    uid=1000,gid=1000,allow_other,user,_netdev     0       0

3. Contents of executable /usr/bin/gdfuse
#!/bin/bash
su dom -l -c "google-drive-ocamlfuse -label $1 $*"
exit 0

Friday, May 03, 2019

Cyavana and the motif of the tormented meditator

Years ago I wrote an article called "The Spikes in the Ears of the Ascetic."  I examined a story that occurs in early Buddhist and Jain texts, and is illustrated on the cave walls in Ajanta and in early Pala and Jaina manuscripts.
The story tells of an ascetic who is absorbed in meditation while walking.  Village lads (pāṃśupiśācas "dust-goblins" in some versions) pelt the ascetic with mud or worse.  Eventually they drive spikes into his ears.  Nothing disturbs the meditation.  But later, on waking, the sage curses the naughty boys.
It is only this year that I have discovered that the earliest version of the story occurs in the Śatapathabrāhmaṇa (thanks to my student Faried Nasir, who wrote an essay on Cyavana). 

The tale of Cyavana, SB 4.1.5 contains the antecedent of the "spikes in the ears" theme.  In the SB, Śaryāta the Mānava, while wandering, has a clan of juniors who pelt Cyavana with clods believing him to be something valueless (verses 2, 5):

4.1.5.[2] śaryāto ha vā idam mānavo grāmeṇa cacāra | sa tadeva prativeśo niviviśe tasya kumārāḥ krīḍanta imaṃ jīrṇiṃ kṛtyārūpam anarthyam manyamānā loṣṭair vipipiṣuḥ

4.1.5.[3] sa śāryātebhyaścukrodha | tebhyo 'saṃjñāṃ cakāra pitaiva putreṇa yuyudhe bhrātā bhrātrā

4.1.5.[4] śaryāto ha vā īkṣāṃ cakre | yatkimakaraṃ tasmād idam āpadīti sa gopālāṃś cāvipālāṃś ca saṃhvayitavā uvāca

4.1.5.[5] sa hovāca | ko vo 'dyeva kiṃcid adrākṣīd iti te hocuḥ puruṣa evāyaṃ jīrṇiḥ kṛtyārūpaḥ śete tam anarthyam manyamānāḥ kumārā loṣṭair vyapikṣanniti sa vidāṃ cakāra sa vai cyavana iti

References

Eggeling, Julius. 1882–1900. The Śatapatha-Brāhmaṇa According to the Text of the Mādhyandina School. The Sacred Books of the East. Oxford: The Clarendon Press.

Leslie, Julia. 2003. Authority and Meaning in Indian Religions. Hinduism and the Case of Valmiki. Aldershot: Ashgate. doi:10.4324/9781315198439. Pages 130 et passim.

Wujastyk, Dominik. 1984. "The Spikes in the Ears of the Ascetic: An Illustrated Tale in Buddhism and Jainism." Oriental Art 2: 189–94.
 





Tuesday, April 30, 2019

Linux Mint 19.1 Cinnamon and display flickering

When I upgraded to Linux Mint 19.1 with Cinnamon, I encountered a problem that my screen flickered immediately after logging in.  Others encountered the same problem (here).
I found that the solution proposed there, i.e., to delete the line
CLUTTER_PAINT=disable-clipped-redraws:disable-culling
from the file
/etc/environment
worked for me.  Logging out and back in after that change gave me a stable display.

Saturday, November 17, 2018

APN problem and mobile data

Returning from a trip abroad, my Canadian Public Mobile service stopped providing mobile data.  The problem was that the APN parameters for Public Mobile had been erased. And the "edit" and "add" options for APNs was now disabled.  Only entries for TELUS and Koodoo appeared, and neither were suitable.
I found this solution,
and it worked.

NB: on the phone
  • turn "USB tethering" off
  • enable developer mode (system/aboutphone/7 taps) and switch on USB debugging
  • make sure you use a good USB cable 
 

Wednesday, October 17, 2018

Counting on base sixteen and four, as seen in the introductions to some early Bengali printed books

/o
//o
///o
|o
|/o
|//o
|///o
||o
||/o
||//o
||///o
|||o
|||/o
|||//o
|||///o
1J
1/o
1//o
1///o
1|o
1|/o
1|//o
1|///o
1||o
1||/o
1||//o
1||///o
1|||o
1|||/o
1|||//o
1|||///o
2J
2/o
2//o
2///o

Friday, August 31, 2018

Medical e-texts available from the National Institute for Indian Medical Heritage, Hyderabad

It is not easy to find these books at the NIIMH website, so here are the links:
  • Carakasaṃhitā
  • Suśrutasaṃhitā
  • Mādhavanidānam
  • Nighaṇṭavaḥ (including   
    • abhidhānamañjarī 
    • abhidhānaratnamālā 
    • amarakōśa 
    • aṣṭāṅganighaṇṭu 
    • kaiyadēvanighaṇṭu 
    • camatkāranighaṇṭu 
    • dravyaguṇasaṅgraha    
    • dhanvantarinighaṇṭu 
    • nighaṇṭuśēṣa 
    • paryāyaratnamālā 
    • bhāvaprakāśanighaṇṭu 
    • madanapālanighaṇṭu 
    • madanādinighaṇṭu 
    • mādhavadravyaguṇa 
    • rājanighaṇṭu 
    • rājavallabhanighaṇṭu 
    • laghunighaṇṭu 
    • śabdacandrikā 
    • śivakōṣa 
    • sarasvatīnighaṇṭu 
    • siddhamantra 
    • siddhasāranighaṇṭu 
    • sōḍhalanighaṇṭu 
    • sauśrutanighaṇṭu and 
    • hr̥dayadīpakanighaṇṭu)

A melancholy reflection from the online documentation:

...  किन्तु वर्तमान वैज्ञानिक युग में संस्कृत भाषा के प्रति पाठकों की अत्यल्प रुचि के कारण ...
"But in this scientific age there is little inclination towards reading in the Sanskrit language, and therefore ..."

Thursday, August 23, 2018

Fetching multiple files from an internet site as a batch job


Sometimes one encounters a website that displays a book or manuscript page-by-page as individual jpeg files.  But what you need for your research is to have a single PDF of the item, so that you can move about it easily, and consult it offline.

There are several quick ways of getting these images as a batch job: here's one.   

  • First you have to identify the URL of one of the images.  I use Firefox, so I 
    • first bring up a page that displays the first folio of the MS. 
    • Then I press ctrl+I to get the "page info" (or Firefox menu Tools/Page Info).  
    • Then I select "Media" on the top line of the Info window.  
    • Then scroll down to the graphics file of the whole page, right click and ctrl+c to copy the URL.

      You now have a URL that looks like this:

      http://awebsite.net/uploads/manuscripts/miscellaneous/sometext/001.jpg

There may be a more direct way of getting this URL, but this is good enough for me.

The next bit is the nice bit.  Drop to the command line and use the utility "curl".  Here's the syntax ($ is my command prompt):

$ curl -O http://awebsite.net/uploads/manuscripts/miscellaneous/sometext/[001-268].jpg
  • Hit "enter" and several hundred jpeg files will be transferred to your directory.  It takes a couple of minutes, depending on your bandwidth.
    The bit in square brackets, "[001-268]" is curl's syntax for "please fetch 001.jpg, 002.jpg, ... 267.jpg, and 268.jpg".  Curl is one of the few tools with this simple ability to fetch lots of different files with a single simple command.

To convert them to a single PDF, I use ImageMagick:

$ convert *.jpg Hayanaratna.pdf
and wait for ten seconds.

(I was taught about curl by Patrick McAllister - thanks Patrick!)

A quite different approach is to use wget to fetch a whole website in a single gulp.   That's what I use for GRETIL, for example, so that I have the whole archive on my hard drive.

Monday, July 09, 2018

Tweaking the Thinkpad's TrackPoint settings in Linux Mint 19

With the update to Linux Mint 19 Cinnamon, the sliders controlling the trackpoint's accelleration and speed on my Thinkpad T560 and T500 don't work any more.  I expect it will get fixed soon.  Meanwhile, as root I  can manually edit the parameters in the filesin the directory
  • /sys/devices/platform/i8042/serio1/serio2
The above directory is found by
  • find /sys/devices/platform/i8042 -name name | xargs grep -Fl TrackPoint | sed 's/\/input\/input[0-9]*\/name$//'
Settings are reset at reboot.  :-(

I like sensitivity 125 and speed 80 on the T560; 190 and 90, inertia 10, on the T500.

Update


I found this solution (X1 parameters) that automates everything and survives reboot :-)

Another update, March 2020

Lalufu at github said,
You can also use xinput to modify the libinput values directly:
Run xinput to show the pointers the system knows about. If you have a ThinkPad you should see something along the lines of TPPS/2 IBM TrackPoint or similar.
xinput --set-prop "TPPS/2 IBM TrackPoint" "libinput Accel Speed" -0.5
will modify the pointer speed. Play around with the value to see what you like. If you want this to survive a reboot you can stick this in .bash_profile.

Friday, June 08, 2018

nice historiographical point

From a review of a history book:

"Written more in the tradition of Burckhardt and Braudel than Marx and Hobsbawm, the book is an exercise in seeing rather than storytelling."

Tuesday, May 08, 2018

Photo of Prof. Robert Charles Zaehner

Photos of Prof. Robert Charles Zaehner are rare.  One was published in his obituary in the journal Iran 13 (1975):