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.