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.



    Sunday, April 04, 2010

    Early Indian MS evidence for "zero"

    Early Indian document with ref. to zero

    The Bakhsālī manuscript was unearthed by a peasant in 1881 in the village of Bakhshālī about eighty kilometers north-east of Peshawar. The scribe wrote it in the Śāradā script on birch-bark using a pen with a flat, rectangular tip. The most recent research shows that this is the earliest Śāradā manuscript ever discovered, and suggests that it may be datable to as early as AD 700, although a date of 1200 has been proposed in the past. The mathematical work recorded in the manuscript is probably from the seventh century, and appears to have been composed in the Gandhāra
    district. The manuscript describes the foundations of arithmetic, including approximations of square roots, rules of inversion and proportion, the rule of three, various forms of equations, and a series of example problems on fiscal, taxation, travel, and geometrical topics (Hayashi 1995). It also uses a dot to symbolize zero, possibly making it the earliest written occurrence of this sign in India.

    ---
    T Hayashi, The Bakhshali manuscript : An ancient Indian mathematical treatise (Groningen, 1995).

    TeXWorks for linux

    TeXworks is a nice editor with an emphasis on multilingual use, simplicity and rapid document preview. It is from Jonathan Kew, author of XeTeX.

    Binary downloads for Mac and Windows are available from the TeXworks home page. For Ubuntu Linux, there's a PPA here.

    The Origins of Zero

    In 1998, I wrote the following letter to the editor of the New Scientist magazine, in response to an article that appeared on 25 April 1998 by Ian Stewart, entitled Zero, Zilch and Zip.

    ---------- cut -------------

    From ucgadkw@link-1.ts.bcc.ac.uk Sun May 3 15:28:53 1998
    Date: Sun, 3 May 1998 15:28:52 +0100 (BST)
    From: Dominik Wujastyk
    To: letters@newscientist.com
    Subject: Ian Stewart: Zero, Zilch and Zip

    Dear Sir,

    Ian Stewart writes engagingly about the origin of the mathematical zero and place-value notation ("Zero, zilch and zip", 25 April, p 41), but he suggests that these two concepts are connected, when they are in fact both logically and historically separate. You can count reasonably successfully with place-value notation but no explicit zero, and vice versa.

    Ian Stewart is also quite wrong in saying that "place notation was born probably in India, maybe with Arab help, not too long after AD 200".

    Three key elements -- a decimal base, place-value, and zero (I abbreviate this to "DPZ") -- occurred separately at earlier times both in India and in other parts of the ancient world. In particular, the Babylonians were using a place-value system, with a space for the null value, in the second millennium BC, but their base for counting was sixty, not ten. By the time of Alexander the Great, they were even using a special symbol for this null value. From perhaps as early as the third century AD the Mayans also used place-value and zero, but with the base twenty. But it does indeed seem to have been the Indians who first combined these key elements together to form the basis of the arithmetic system that has come down to the modern world.

    The Arabs did not have anything to do with the invention, and indeed Arabs only arrived in India about five hundred years later than Stewart suggests. The Arabs (or rather, the Muslims of the Middle East) certainly did transmit knowledge about zero and the place-value notation to Europe, but they learned it all from the Indians. We call our numerals "Arabic", it is true, but Arabic writers called them "Hindu", meaning "Indian".

    The Indian numerals are first mentioned outside India in the year 662, when the Syrian bishop Severus Sebokt, annoyed by the intellectual arrogance of immigrant Greek scholars, reminded them pointedly that other nations were also very learned, such as the Hindus with their admirable systems of astronomy and arithmetic, including calculating with nine symbols.

    Indian works on arithmetic, translated from the original Sanskrit in to Arabic (perhaps through Persian or Syriac), began to reach the Islamic world in about the eighth century. The first book known to us from outside India that demonstrates Indian methods of calculating with nine digits and zero was composed in the ninth century, probably in Baghdad, by al-Khwarizmi (whose name, through the medieval Latin and Old French, gives us "algorism" and "algorithm"). From about AD 950 on, many Arabic works demonstrating these new Indian methods of working out arithmetical problems, including fractions, were circulated under the name "al-Hisab al-Hindi', or "Indian calculation". After 1100, Latin translations of Al-Khwarizmi's work spread throughout the centres of medieval learning in Europe, which is how the the Indian DZP system ultimately reached us today.

    The earlier history of this number system in India is not perfectly clear, but the Indian astronomer Aryabhata, born in 473, was the first to describe the decimal place-value system explicitly, in a chapter of a work in which he also discusses algebra, geometry, and trigonometry. Before him, the third-century author Sphujidhvaja seems to be the first author to describe the use a symbol for zero in the decimal place-value system.

    It is often claimed that the adoption of the DPZ system was a great epistemological change heralding the opening of vast new mathematical horizons, and a leap forward in knowledge generally. I do not see why a notational change of this type should be seen as so important, and there
    is little actual historical evidence of such an effect. The counting system that has become second nature to us may seem consummate, but surely that is only a matter of what we are used to, what we have been taught from childhood. The Babylonians, using a non-DZP system, constructed vast tables of astronomical and arithmetical parameters which required extraordinary amounts of calculation, but we see no evidence that they were hampered by having a sexagesimal (60-based) and not a decimal system. Early Greek arithmetic was decimal, but was conducted without recourse to the use of zero. Sometimes a non-DZP notation can be positively helpful: to add ten and ten in Roman (X + X = XX) does not even require knowledge of another symbol, nor any notational manipulation beyond writing the symbols more closely together. What could be easier? That quintessence of modernity, the digital computer, abandons the internal use of decimals entirely, using only binary digits, or bits. The feeling that the DZP combination is in some way "better" than any other system is surely no
    different in principle from any other chauvinistic belief, such as that that one's own mother language -- whatever it may be -- is the easiest, best, and most expressive language in the world.

    In areas where sexagesimal (60-based) counting still lurks in our own mathematics, such as in the 360 degrees in a circle, we suffer no epistemological harm. That a right angle has ninety degrees has not held our civilization back in any obvious way, though measurement in radians is of course routine in higher maths.

    If some future government, politically desperate for a "British Sausage" issue, decides to go for total, all-out decimalization and legislates that a circle shall have ten degrees, there may be a leap in learning, but it may in a direction of five degrees.

    Yours faithfully,

    Dominik Wujastyk

    --
    Dr Dominik Wujastyk, FAX/voice: +44 171 611 8545/8467
    Wellcome Institute for URL: http://www.ucl.ac.uk/~ucgadkw/
    the History of Medicine, Email: d.wujastyk@ucl.ac.uk
    Wellcome Trust, 183 Euston Road, Trust URL: http://www.wellcome.ac.uk
    London NW1 2BE, England.

    First Rule of History:
    History doesn't repeat itself -- historians merely repeat each other.

    Tuesday, March 09, 2010

    JabRef


    Good! The new beta of JabRef, 2.6b3, now has a properly-working interface to JSTOR. One can search by keyword for JSTOR entries, and JabRef lists the hits and lets you import whatever you want to your bibtex database. JabRef even helpfully marks possible duplicates. Very nice indeed, especially for us humanists.

    Get your JabRef here: http://jabref.sourceforge.net/

    At the moment, JabRef and Mendeley seem to be moving forward fast. They approach the problem of bibliography management slightly differently, and offer different feature-sets. However, both are emerging as seriously useful tools.