May 8, 2016

Using Devanagari within latex

  1. Using Devanagari within Latex
    1. Setup
      1. On Windows
      2. On Linux
    2. Calling Devanagari within latex
    3. Example

Using Devanagari within Latex

This is a small Tutorial on how to setup Latex with Devanagari output.


What you need before is a working latex environment.

On Windows

First of all you need to download and install the great Sanskrit2003 font, which is part of Omkarananda Ashram's Itranslator : Click here to do so, just unzip the file, right-click on the file Sanskrit2003.ttf and select 'install'.

On Linux

Extract the zip and copy the files to your truetype-folder.On Ubuntu/Debian systems, this is done with the following command:
sudo cp -rf Sanskrit2003.ttf /usr/share/fonts/truetype/

Calling Devanagari within latex

Next step is to create a new latex file or edit an existing one and add the following lines to the header:
\newfontfamily\devanagarifont[Script=Devanagari,Mapping=harvardkyoto]{Sanskrit 2003}  

Now we should be able to create Devangari output with the foreignlanguage-command anywhere in the body of the latex-file:

\foreignlanguage{hindi}{ahaM siMHaH}

If you wish to use a different mapping instead of harvard kyoto, just change the Mapping parameter:

\newfontfamily\devanagarifont[Script=Devanagari,Mapping=iast]{Sanskrit 2003}   

Inside the document:

\foreignlanguage{hindi}{ahaṃ siṃhaḥ}

For velthuis it goes like this:

\newfontfamily\devanagarifont[Script=Devanagari,Mapping=velthuis]{Sanskrit 2003}  

Inside the document:

\foreignlanguage{hindt}{aha.m si.mha.h}


A full working minimal example is the following file (just copy and paste it to your editor and run):
\newfontfamily\devanagarifont[Script=Devanagari,Mapping=harvardkyoto]{Sanskrit 2003}
\foreignlanguage{hindi}{ahaM siMhaM}

Have fun! :)

Tags: latex sanskrit devangari