Tuesday, July 06, 2010

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

And here's the input for the above:

% 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:
% customizations to Ledmac, and macros to make life easier.
% in a real edition, I'd probably also make
% abbreviations for \textfrench (perhaps \tf) etc.
\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:
% \hsize .45\hsize
\hsize .49\hsize
\parindent=0pt \parfillskip=0pt plus 1fil

% and here begins the edition:

\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}


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


\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.

\textfrench{N1 détruit, C1 }kṛtas tasya,
\textfrench{C2 }kṛtasya.}
\Tibetan{\textfrench{T \emph{mth'yas}, ``sans limite, immense''
traduit }kṛtsnasya.}}
\Variant{\textfrench{Ca, JK }dhamnā.}}\\
\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
\Lemma{viprasṛtasya} % as above with cikitsitād.
\Variant{\textfrench{Ca} cikitsitārthaprasṛtasya, \textfrench{C1, C2}
\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.
\Variant{\textfrench{N1} karikṣete.}}
yogaśatasya bandhaḥ|| 1||
\par % necessary to stop \autopar complaining. Thanks to Alessandro Graheli.


  1. This is going to be really helpful. I am grateful to you and to Somadeva Vasudeva for this.

  2. Thank you very much! This is priceless.

    I have a question though. Any idea why the indentations in my output are not right? In the first verse only the first line is indented, in the second instance the third line is indented, but with a smaller indent.


  3. 1. Looks like you've got a \break (\\) instead of a paragraph after the first dūram. There should be a blank line after the first dūram. It's somehow got lost in the upload, so just put an explicit \par after the daṇḍa, like this:

    2. at line 95 of the input file, add a percent sign to get rid of that initial space:



    In a day or two, I'll emend the source files on this blog, so thi.s comment will be obsolete.