Friday, October 28, 2011

Oneiric Ocelot upgrade woes

My main desktop machine got in a terrible mess during the Oneiric update.  Could have been my fault - I started the update and then left the machine for two days.  When I got back to it, it was frozen, and on hard reboot it wouldn't boot.  Finally, I got it back by booting from a USB stick and then using chroot to get a pseudo-login as root on the hard disk.
Having a network connection, that enabled me to clean up the system with dpkg and apt-get, so I fetched all the latest versions of everything and updated and upgraded tidily.  But still couldn't get a boot because of an obscure network problem with connecting to the bus.  Finally solved by these (weirdly written) instructions:
Now up and running, amazingly.


--

and another thing...

The compiz grid feature developed a fault about putting a window on the top-right of the screen.  Solution is here: https://launchpad.net/~lbrulet-8/+archive/ppa

Sunday, October 09, 2011

Ubuntu Evince menu fonts turn to garbage

Grr, recurrence of the old, old problem that the Evince menus turn to little squares like this:




Solution:

sudo mv /etc/apparmor.d/usr.bin.evince ~/
sudo /etc/init.d/apparmor restart

Tuesday, October 04, 2011

Simplest Sanskrit XeLaTeX file

Input:

\documentclass{article}
\usepackage{polyglossia}
\setmainfont[Script=Devanagari]{Nakula}

\begin{document}
Your Devanāgarī looks like this:  आसीद्राजा नलो नाम and your romanized stuff looks like this: āsīd rājā nalo nāma.  
\end{document}

Output:






You can get the Nakula font (and its twin, Sahadeva) from John Smith's website, http://bombay.indology.info

Monday, October 03, 2011

Guṭkās

Sanskrit booklets, or guṭkās, contain several works collected between one set of covers.  They were presumably copied sequentially by their owners as a vade mecum of useful knowledge.

Biswas 0891 (available digitized, no. 090393 at http://www.jainlibrary.org/menus_cate.php) is a series of catalogues of MSS in Jaina libraries in Rajasthan.  Volume 2 (1954), 73 ff. has a section that describes 222 such booklets, and lists their contents in detail.  A study of these particular collocations of texts would provide a valuable insight into reading habits, the circulation of texts and knowledge, and the personal tastes and obsessions of pre-modern Indian readers.

Friday, August 26, 2011

printer driver

Ubuntu, HP LJ 1300 - use the Gutenprint or the Foomatic/pxlmono driver.  Not CUPS or HPLIP.

Thursday, August 25, 2011

Wednesday, July 27, 2011

Gleick


I'm reading Gleick's The Information.  Very enjoyable and interesting romp through loosely-connected stories in the history of science from Babbage to Shannon and beyond.  I've very much enjoyed all of Gleick's books.

Viruses and bacteria

Why computer "virus"?  The metaphor would surely work better with the image of a computer "bacterium," wouldn't it?  A bacterium can be eradicated, unlike most viruses.  Bacteria can be contagious, and can multiply cells and colonize a particular location.

Yes, "Computer bacterium" from now on, I think.









Thursday, April 21, 2011

Ubuntu / dropbox

 If you get the warning
Unable to monitor filesystem
Please run "echo 100000 | sudo tee /proc/sys/fs/inotify/max_user_watches" and restart Dropbox to correct the problem.
here's one way to increase the default value of /proc/sys/fs/inotify/max_user_watches at startup, so one doesn't have to do it manually at every boot.

As root (or with sudo), create a file

/etc/sysctl.d/30-inotify.conf

with the contents

fs.inotify.max_user_watches=100001

Reboot, or run "sudo service procps start".


That's it!

Monday, December 27, 2010

devanagari.sty / xelatex clash

devanagari.sty uses the LaTeX2e font conventions (of course).  Today I had an old document using devanagari.sty that I'm just converting to XeLaTeX and UTF8.  It was fine, except that the document's English parts were in the chosen polyglossia font, while the table of contents was in cmr.

That was because of a statement
\def\DNrmdefault{cmr}
used by \NormalFont in devanagari.sty

The answer was to define \englishfont
\newfontfamily\englishfont{IndUni-P}
and then redefine \NormalFont as follows:
\DeclareRobustCommand\NormalFont{\dn@penitshape\englishfont}
In the end, this is all transitional nonsense, of course, since I will get rid of devanagari.sty and use XeLaTeX's internal facilities for the Devanagari in a day or two.

Monday, November 22, 2010

Hyphenating Sanskrit in roman transliteration

%!TeX program = xelatex
%
% Thanks to Yves Codet for the first version of this test file, and to Yves
% and Jonathan Kew for the hyphenation tables
% for Sanskrit (hyph-sa.tex):
%
% This file exemplifies the case where some Sanskrit is embedded in a
% mainly-English document, but the Sanskrit words are appropriately
% hyphenated. The Sanskrit words are in the argument of the
% \textsanskrit{} command.

\documentclass[12pt]{article}

\usepackage{fontspec}
\usepackage{polyglossia}

\setdefaultlanguage{english}
\setmainfont{Charis SIL}

\setotherlanguage{sanskrit}
\newfontfamily\sanskritfont{Charis SIL}

\textwidth=0.5cm
\parindent 0pt

\begin{document}

Sanskrit hyphenation:
\par\smallskip

\textsanskrit{manum ekāgram āsīnam abhigamya maharṣayaḥ |\par}

\bigskip

English hyphenation:
\par\smallskip

manum ekāgram āsīnam abhigamya maharṣayaḥ |

\end{document}

Friday, September 03, 2010

DLI - DownLoad Impossible?

An exceptionally useful series of remarks about the Digital Library of India from PW, here: http://www.indologica.de/drupal/?q=node/1240

Thanks, Peter!

Wednesday, September 01, 2010

XeLaTeX, Velthuis encoding, and palatal nasals

When using the Velthuis input coding for Devanāgarī, and wanting to have it handled by XeLaTeX, one finds the palatal ñ disappears in the Nāgarī.

input: sa~njaya

output: स न्जय


That's because the Velthuis input code for ञ् is ~n, and the "~" is a special code in TeX, meaning "hard space".

Here's the workaround. I define a font-switching command \dev that will turn Velthuis into Devanāgarī. \dev is mostly made up of "\textsanskrit" which is set up using the standard XeLaTeX/polyglossia \newfontfamily commands. \textsanskrit does the work of invoking the mapping-conversion (from XeTeX's velthuis-sanskrit.tec file).

But just before \textsanskrit, we change tilde into a normal character. And after \textsanskrit, we turn tilde back into an "active" hard space. We use the \aftergroup command so that the "active" version of tilde is activated after the closing of the group that contains the Devanāgarī.

Here's the code:


\newfontfamily\textsanskrit [Script=Devanagari,Mapping=velthuis-sanskrit]{Nakula}


% Make the tilde into a normal letter of the alphabet
\def\maketildeletter{\catcode`\~=11 }


% Return tilde to being the default TeX "active" character for hard space
\def\maketildeactive{\catcode`\~=13 }

\def\dev{\maketildeletter\textsanskrit \aftergroup\maketildeactive}


Here's how you use it:

input: {\dev sa~njaya uvaaca}. What did Dr~Sañjaya say?

output: सञ्जय उवाच. What did Dr Sañjaya say?

where that space betwen "Dr" and "Sañjaya" is hard, and you can't break a line there.

Enjoy.
 

Update 2020:

Using David Carlisle's much better idea from the comments below, here's the new code:
 
\newfontfamily\textsanskrit [Script=Devanagari,Mapping=velthuis-sanskrit]{Nakula}

\def\dev{\edef~{\string~}\textsanskrit }
 
\begin{document}

{\dev sa~njaya uvaaca}. What did Dr~Sañjaya say?

\end{document}

 
 

Saturday, August 14, 2010

Dr T. Bhaskaran

I am sorry to read today that Dr T. Bhaskaran has died (d. 12.8.2010).

In the 1980s, Dr Bhaskaran was Director of the Oriental Manuscript Library and Research Institute, University of Kerala. (On the OMLRI, that many of us will have visited over the years, see here). Amongst his many books, Dr Bhaskaran was particularly proud of his publication, with his successor Dr K. Vijayan, of the facsimile edition of a beautiful illustrated palm-leaf manuscript of the Rāmāyaṇa, over which he took great pains to ensure high-quality colour reproduction and typesetting (Chitra Ramayanam, 1997, published by the University of Kerala, Trivandrum Sanskrit Series no.265, and on CD by CDIT).


Dr Bhaskaran also prepared and published three volumes of the Alphabetical Index of Sanskrit Manuscripts in the Oriental Research Institute and Manuscripts Library, Univ. of Trivandrum, that are essential guides to the MS holdings of the library.  This series was started with vol.1 (a - na, 6079 works) in 1957 by Suranad Kunjan Pillai, and continued with vol.2 (ta - ma, 7980 works) in 1965 by K. Raghavan Pillai. There the series halted for decades, until Dr Bhaskaran re-enlivened it, finishing off the alphabet (vols 3 & 4, 1984 & 1986, 5253 & 2218 works), and starting a supplemental series (vol. 5, 1988, covering 4643 works). Few people in the world can say that they have catalogued 12,000 Sanskrit manuscripts.  The impulse of Dr Bhaskaran's diligent cataloguing work directly inspired the library to complete the Supplementary Index in two further volumes (1995, 2000).  These seven volumes cover the 35,060 Sanskrit MSS in the library that have been catalogued, amounting to about half the library's total holdings.


Dr Bhaskaran was a member of the Ezhava community.  He was proud to have been such a leading figure in Sanskrit studies in Kerala, and explained to me a few years ago, when I visited him in his retirement in Aleppey, that the Ezhavas as a group were often quite wrongly categorized merely as toddy-tappers, when in fact many members of their society were physicians and herbalists, as well as Sanskritists.  As an example, he cited the famous facsimile inscription of 20 April 1675 in the Hortus Malabaricus (Amsterdam, 1678-1693) in which the Ezhava Itty Acyutan, "Doctor Malabaricus," wrote about his own contribution to that magisterial work of Dutch botanical science.


Dr Bhaskaran was a kind and learned man, who did much quiet and important work for the indological field of studies.

Tuesday, August 03, 2010

Wellcome Library: The Test of Time

Wellcome Library: The Test of Time: "Last year we brought you news of The Test of Time, a BBC Radio 4 series in which present day scientists reflected on the work of their ancie..."

Tuesday, July 06, 2010

Switching from Devanāgarī to Roman with a single command

I have to admit even I am startled by the success of this.
In the input file below, I changed the single command:
  • \setdefaultlanguage{sanskrit}

to

  • \setdefaultlanguage{english}
and the result was the following:

How do I install RomDev mapping for XeLaTeX (Unicode transliteration -> Devanāgarī)?

[Update, February 2011: Somdev has moved his blog to http://pratibham.blogspot.com/.]

Somdev Vasudev's RomDev mapping is installed as follows:
  1. The actual mapping file is published by Somdev in his blog, here:
    http://sarasvatam.blogspot.com/2010/03/updated-teckit-romdev.html 
    [Update Feb 2011: now at http://pratibham.blogspot.com/2010/03/updated-teckit-romdev.html; update March 2012: now at https://github.com/somadeva/RomDev]
  2. Cut and paste this text, and save it in a Unicode file called RomDev.map.  Save that file in a place which XeTeX can "see," e.g., something like local/texmf/fonts/misc/xetex/fontmapping/
  3. You now need to compile the human-readable *.map file into a binary *.tec file, so that XeTeX can read it directly.  This is done by the program Teckit, which you can get here:
    http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&item_id=TECkitDownloads
  4. I'm working with Ubuntu GNU/Linux.  For me, the command is,

    teckit_compile RomDev.map -o RomDev.tec

    I'm afraid I don't know the Windows or Mac command invocation.

  5. Now you have a file in a place like
    local/texmf/fonts/misc/xetex/fontmapping/RomDev.tec

  6. Run the command that rebuilds the database of files that TeX knows about.  In Linux it's
    sudo mktexlsr
  7. That's it!  XeTeX and XeLaTeX can now see, and make use of the RomDev mapping, that converts Unicode transliteration into Devanāgarī, as exemplified in my earlier blog posts below. 

    A minimal edition of a Sanskrit verse, using XeLaTeX and Ledmac


    And here's the input for the above (tested and working in September 2019):


    \documentclass{book}
    % Set up things for XeLaTeX, and Devanagari.
    % Simplified version of http://cikitsa.blogspot.com/2010/07/xelatex-for-sanskrit.html

    \usepackage{polyglossia} % the multilingual support package
    % Next, from the polyglossia manual:
    \setdefaultlanguage{sanskrit} % this is mostly going to be Sanskrit,
    \setotherlanguage{french} % with some French embedded in it,
    \setotherlanguage{english} % and some English.
    % These will call appropriate hyphenation.
    \usepackage{xltxtra} % standard for nearly all XeLaTeX documents
    \defaultfontfeatures{Mapping=tex-text} % ditto
    \setmainfont{Gandhari Unicode} % could be any Unicode font
    % Now define the Devanagari font:
    % John Smith's Sahadeva, input using standard UTF8 transliteration
    \newfontfamily\sanskritfont [Script=Devanagari,Mapping=RomDev]{Sahadeva}

    % Now come the commands for the critical edition formatting:
    \usepackage[noeledmac]{ledmac} %"noeledmac" stops some annoying messages
    % customizations to Ledmac, and macros to make life easier.
    \def\Variant#1{\Afootnote{\relax#1}}
    \def\Lemma#1{\lemma{\relax#1}}
    \let\Reference=\Bfootnote
    \let\Grammatical=\Cfootnote
    \let\Tibetan=\Dfootnote
    % in a real edition, I'd probably also make
    % abbreviations for \textfrench (perhaps \tf) etc.
    \def\Omission#1{$\langle$#1$\rangle$}
    \def\ScribalDeletion#1{{\rm[\kern-.15em[}#1{\rm]\kern-.15em]}}
    \def\hardspace{\texttt{\char`\ }}
    \def\And{{\rm\penalty-1\quad$\mid\mid$~}} % divider between variants to the same lemma
    % more customizations: make the A notes
    % (\Variants and \Lemmas)into two-column format,
    % and make the B notes (\Reference) normal footnotes.
    %
    % changes to stuff cut-and-pasted from ledmac.sty:
    \makeatletter
    \renewcommand*{\twocolfootfmt}[3]{%
    \normal@pars
    % \hsize .45\hsize
    \hsize .49\hsize
    \parindent=0pt
    \tolerance=5000
    \raggedright
    \leavevmode\hangindent1.5em\hangafter1
    \strut{\notenumfont\printlines#1|}\enspace
    {\select@lemmafont#1|#2}\rbracket\enskip
    #3\strut\par\allowbreak}
    \foottwocol{A}
    \renewcommand*{\normalfootfmt}[3]{%
    \normal@pars
    \parindent=0pt \parfillskip=0pt plus 1fil
    \hangindent1.5em\hangafter1
    {\notenumfont\printlines#1|}\strut\enspace
    {\select@lemmafont#1|#2}\rbracket\enskip#3\strut\par}
    \footnormal{B}
    \makeatother
    \firstlinenum{1}
    \linenumincrement{1}


    % and here begins the edition:
    %
    \begin{document}
    \chapter*{yogaśatakam}
    \large


    \section*{\textenglish{The example verse by itself}}

    \textenglish{From \emph{Yogaśataka: Texte m\'edical attribu\'e
    \`a Nāgārjuna\ldots par Jean Filliozat} (Pondich\'ery, 1979), pp.\,1, 59:\par}

    \bigskip

    kṛtsnasya tantrasya gṛhītadhāmna-\\
    ścikitsitādviprasṛtasya dūram|
    vidagthavaidyapratipūjitasya\\
    kariṣyate yogaśatasya bandhaḥ|| 1||

    \bigskip

    \section*{\textenglish{The example verse, with apparatus}}
    % we could use the \stanza command, but I haven't bothered.

    %
    % I find that the judicious use of indentation
    % and newlines helps enormously to see what's what.
    % Using a good "folding editor" would be even better.
    %

    \begingroup
    \beginnumbering
    \autopar
    \edtext{
    \edtext{kṛtsnasya}{
    \Variant{%
    \textfrench{N1 détruit, C1 }kṛtas tasya,
    \textfrench{C2 }kṛtasya.}
    \Tibetan{\textfrench{T \emph{mth'yas}, ``sans limite, immense''
    traduit }kṛtsnasya.}}
    tantrasya
    \edtext{gṛhītadhāmna-}{
    \Variant{\textfrench{Ca, JK }dhamnā.}}\\
    \edtext{ścikitsitā}{
    \Lemma{cikitsitād} % not ``ścikitsitā'', of course. We're preserving
    the sandhyakṣaras.
    \Variant{\textfrench{C1, C2 } cikitsitāt.}
    \Tibetan{\textfrench{T \emph{gso-spyad} ''pratique de la
    thérapeutique''. Ordinairement
      \emph{gso spyad} est ``investigation del la th.''}}}% comment sign to stop a break after the conjunct
    \edtext{dviprasṛtasya}{
    \Lemma{viprasṛtasya} % as above with cikitsitād.
    \Variant{\textfrench{Ca} cikitsitārthaprasṛtasya, \textfrench{C1, C2}
    viprasutasya.}}
    \edtext{dūram}{
    \Variant{\textfrench{Ca} dūrāt}}|
    \\ \indent
    %
    % the above line is annoying. Because the whole verse is
    % inside an \edtext{} macro, in order to get the
    % \Grammatical note naming the upajāti verse, we have to
    % avoid having paragraph breaks, which are not allowed
    % inside \edtext{}.
    % instead, we use \\ (newline) and \indent (paragraph indent)
    % to get the same visual effect. A nasty kludge.
    %
    vidagdhavaidyapratipūjitasya\\
    \edtext{kariṣyate}{
    \Variant{\textfrench{N1} karikṣete.}}
    yogaśatasya bandhaḥ|| 1||
    }{\Lemma{}\Grammatical{Upajāti.}}
    \par % necessary to stop \autopar complaining. Thanks to Alessandro Graheli.
    \endgroup
    \end{document}

    Monday, July 05, 2010

    XeLaTeX for Sanskrit

    This example worked well in July 2010, but some TeX packages have since been updated slightly.  See the new, updated version of this example, posted on 27 May 2013.