Tuesday, January 3, 2012

ledmac Installation

Not only does using ledmac make sense for my own translation project, but as I've started translating portions of Lanman's Sanskrit Reader with my tutoring student, being able to create facing pages with line-number keyed footnotes would be handy.

Here are the steps I've followed to get ledmac:

Detailed instructions below, with my mis-steps included.

Summary:
1. Installation. Both ledmac and ledpar should be included in your TexLive installation.
2. Help files. Download these! They're very detailed and crucial for getting the steps right.
3. Facing pages. First, call the packages. Then, surround numbered paragraphs with \pstart and \pend commands. Finally, enclose them in \begin{Leftside} and \end{Leftside} commands inside of the pages environment, to put them on facing pages.

1. Installation. I went to Terminal on my Mac in order to make sure that my TexLive installation was up to date. This required giving myself root admin privileges and then entering a few commands to update the TexLive manager itself (tlmgr):


Then:


This process took a a while to complete (as in several hours). Get a cup of coffee or ten while it works.

As everything was updating, I could see that I already had ledmac, so I didn't need to install it:


A better way to have discovered this was to have used the list --installed command at the outset, but this means my TexLive installation is up-to-date, which is probably important, anyway.

2. Help Files. I downloaded the help guides for ledmac and ledpar here. The help guide for the package ledmac advertises it as having these features: 
  • automatic stepped line numbering, by page or by section; 
  • sub-lineation within the main series of line numbers; 
  • variant readings automatically keyed to line numbers; 
  • caters for both prose and verse;
  • multiple series of footnotes and endnotes; 
  • block or columnar formatting of footnotes; 
  • simple tabular material may be line numbered; 
  • indexing keyed to page and line numbers.

The package ledpar is what allows one to have facing pages or parallel texts.

3. Facing pages and numbered paragraphs. I started with the Nalopakhyānām Tex file, since it was smaller than the Mukula translation. I already had generated ten lines of Sanskrit and ten lines of English translation, plus some notes.

My first step was to call the packages:
\usepackage{ledmac}
\usepackage{ledpar}
Then I started with the ledpar parallel pages scheme:

\begin{pages} \begin{Leftside} ... \end{Leftside} \begin{Rightside} ... \end{Rightside} \Pages \begin{Leftside} ... \end{Leftside} ... \Pages \end{pages}
The "leftside" command puts what is enclosed inside on the left page (for me, the Sanskrit) and the "rightside" puts what is enclosed inside on the right (the English). Each "\Pages" starts a new page.


Compiling the results didn't work, though. I got an error for the "\Pages command, and when I changed it to a lowercase "p", it compiled, but didn't break the text into two facing pages. I was using the verse package, so I decided to delete references to that, and use ledmac instead, as I discovered in the help guides that ledpar requires ledmac (which is why nothing was happening). So I replaced "\begin{verse}" with "\beginnumbering" and inserted enclosing "\pstart" and "\pend".


This compiled, but the result was that I had no output! The paragraphs disappeared. 


The reason was that I had changed "\Pagesto "\pages". Restoring the correct command gave me facing pages of text as I was wanting.


Next...keying footnotes to line numbers.

Below is the .tex document with screen caps of the output:
\documentclass{article}
%======SET UP PACKAGES=========
\usepackage{fontspec}
\usepackage[a4paper]{geometry}
\usepackage{ledmac}
\usepackage{ledpar}
\setmainfont[Script=Devanagari]{Sahadeva} % use when the main language is Sanskrit
\usepackage{fancyhdr} % for allowing headers and footers
\usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent
%======SET DOCUMENT VALUES=========
\title{Sanskrit Reader}
\author{Charles Lanman}
\date{} % Activate to display a given date or no date (if empty),
% otherwise the current date is printed
\pagestyle{fancy}
\setlength{\headheight}{12.5pt}
\fancyhead[RO, RE]{\thepage} % inserts page number right-aligned on odd and even pages
\fancyhead[LO, LE]{\leftmark} % inserts section title right-aligned on odd and even pages
\fancyfoot[CO, CE]{Solutions by Malcolm Keating} % inserts author name centered on odd and even pages
%======BODY OF DOCUMENT=========
\begin{document}
\renewcommand*{\goalfraction}{0.8} % more room on page for footnotes
\maketitle
\tableofcontents
\begin{pages}
\begin{Leftside}
\beginnumbering
\pstart
\section{Nalopakhyānām Sanskrit Text}
।। अथ नलोपाख्यानम्\footnote{नलोपाख्यानम् = नल+उप+आख्यानम् (√ख्या + आ, with ॰अन nominal ending); gen. tatpuruṣa (TP) in n. acc. s.} ।।\\
बृहदश्च उचाच ।\\
आसीद् राजा नलो नाम वीरसेनसुतो बली ।\\
उपपन्नो गुणैर् इष्टै रूपवान् अश्वकोविद: ।। १ ।।\\
अतिष्ठन् मनुजेन्द्राणां मूर्ध्नि देवपतिर् यथा ।\footnote{अतिष्ठन् = √स्था Impf 3s.; मनुजेन्द्राणाम् = मनु + ज + इन्द्र = "men" + "born" + "Indra" in m. gen. pl.; मूर्ध्नि = m. loc. s., use of locative here is predicative} \\
उपर्य् उपरि सर्वेषाम् आदित्य इव तेजसा ।। २ ।।\footnote{The instrumental तेजसा could modify how Indra, the lord of the gods, is far above everyone, but since सर्वेषाम् is parallel to मनुजेन्द्राणाम it probably refers to them, and thus तेजसा describes the brilliance of Nala.}\\
ब्रह्मण्यो वेदविच् छूरो निषधेषु महीपति: ।\footnote{The only unmodified or uncompounded masculine nominative singular noun in these lines, शूर:, is the subject of the predications.}\\
अक्षप्रिय: सत्यवादी महान् अक्षौहिणीपति: ।। ३ ।।\\
ईप्सितो नरनारिणाम् उदार: संयतेन्द्रिय: ।\footnote{ईप्सित = √आप् desid. ppp. "was desired to be obtained"; संयतेन्द्रिय: = सम् + √यम् (ppp) + इन्द्रिय: = bahuvṛhi, one whose senses are controlled}\\
रक्षिता धन्विनां श्रेष्: साक्षाद् इव मनु: स्वयम् ।। ४ ।।\\
तथैवासीद्। विदर्भेषु भीमो भीमपराक्रम: ।\\
शूर: सर्वगुणैर्। युक्त: प्रजाकाम: स चाप्रज: ।। ५ ।।\footnote{Read च as "but" since the sense is contrastive, not simply conjunctive.}\\
स प्रजार्थे परं यत्नम् अकरोत् सुसमाहित: ।\footnote{अकरोत् = Impf 3s. √कृ; सुसमाहित: = सु+सम्+आहित:(आ+√दा ppp) = m. nom. s., "great focus", with loc., "intend upon"}\\
तम् अभ्यगच्छद् ब्रह्मर्षिर् दमनो नाम भारत । ६ ।।\footnote{The vocative of "Bharata!" is spoken by Bṛhadaśva, the narrator, to Yudhiṣṭhira.}\\
तं स भीम: प्रजाकामस् तोषयामास धर्मवित् ।\\
महिष्या सह राजेन्द्र सत्कारेण सुवर्चसम् ।। ७ ।।\\
तस्मै प्रसन्नो दमन: सभार्याय वरं ददौ ।\\
कन्यारत्नं कुमारांश् च त्रीन् उदारान् महायशा: ।। ८ ।।\\
दमयन्तीं दमं दान्तं दमनं च सुवर्चसम् ।\\
उपपननान् गुणै: सर्वैर् भीमान् भीमपराक्रमान् ।। ९ ।।\\
दमयन्ती तु रूपेण तजसा यशसा श्रिया ।\\
सौभाग्येन च लोकेषु यश: प्राप सुमध्यमा ।। १० ।।\\
\pend
\endnumbering
\end{Leftside}
\begin{Rightside}
\beginnumbering
\pstart
\section{Nalopakhyānām English Translation}
Now, the story of Nala.\\
And Bṛhadaśva said:\\
There was a king named "Nala", the strong son of Vīrasena,\\
Possessing desirable qualities, attractive, and knowledgeable in horsemanship.\\
He stood as head among the princes, just like the lord of gods, Indra,\\
With (his) brilliance, he was far, far above all of them, like the sun.\\
The hero (was) a knower of the Brahmas, ruler of Nirṣadha,\\
A lover of gambling, a speaker of truth, a great general,\\
Desired by men and women, noble and one who was in control of his senses,\\
A protector, the best among archers, as if Manu himself were manifest in body.\\
In the same way, there was in Vidarbha, Bhīma, possessor of terrible strength,\\
A hero who had all qualities, was desirous of progeney, but he was without children.\\
In the aim of having children, he made great effort, he was single-minded.\\
A priestly sage named Damana approached him, O Bharata.\\
O Great King, Bhima, having a desire for offspring, along with his wife, caused the life-filled one to be pleased with hospitality.\\
The pleased Damana gave to him, along with his wife, a boon.\\
A girl-jewel and three excellent boys [were given by Damana] who has great fame.\\
Damyanti, Dama, Danta and Damana, who was full of life.\\
They were endowed with all virtues, terrifying and of terrible courage.\\
Damayanti by her beauty, splendor, fame, grace,\\
And fair-waisted Damayanti won fame in the world by her beauty, splendor, fame, grace and comeliness.\\
\pend
\endnumbering
\end{Rightside}
\Pages
\end{pages}
\end{document}