Tamil and Hindi Support in LaTeX

Doing a post on typesetting Tamil and Hindi is only natural after sorting out Jawi and CJK! Just after I managed to get them working using the itrans package and the devanagari fonts, this exact question was asked on the TeX-LaTeX Stack Exchange site, to which I posted what worked for me. So this post is essentially a re-write of my answers there.

(These instructions are LaTeX-only; I’ve not dabbled much in XƎLaTeX.)

Installation on Ubuntu (TeXLive)

This one’s easy. Grab the itrans and itrans-fonts packages for Tamil, and also the texlive-lang-indic package for the Hindi fonts via synaptic (or apt-get).

Installation on Windows XP (MikTeX)

Grab the devanagari package using MikTeX’s Package Manager. As for itrans, since it’s not packaged properly in MikTeX, so we’ll need to install it manually. Download itrans53-win32.zip from CTAN. After unzipping the contents (say C:\itrans53\), assuming being your local TEXMF tree,

  • Move the contents of the lib folder into \tex\latex\itrans
  • Move the contents of the fonts folder into the appropriate locations, i.e.
    • *.mf in \fonts\source\itrans
    • *.afm in \fonts\afm\itrans
    • *.tfm in \fonts\tfm\itrans
    • *.pfb, *.pfa, *.pfm in <texmf>\fonts\type1\itrans
    • *.ttf in \fonts\truetype\itrans
    • *.fd in \tex\latex\itrans
  • Refresh the file name database (e.g. via MikTeX Options/Settings)

Using itrans

itrans doesn’t let you type in Tamil or Hindi (or Marathi, Sanskrit, Telugu and Gujarati) directly, rather you have to key in the ASCII transcription, then process it with itrans from the command prompt, then run (pdf)latex on the resultant file.

Say I have the following file indic-pre.tex:

\documentclass[11pt]{article}
\usepackage[preprocess]{itrans}

\newfont{\tmlb}{wntml12}
\newfont{\tmls}{wntml10}
\newfont{\devnf}{dvng10 scaled \magstep1}
#tamilifm=wntml.ifm
#tamilfont=\tmlb
#hindiifm=dvng.ifm
#hindifont=\devnf

\begin{document}
Thank you!
{#tamil na^nRi #endtamil}
{#hindi dhanyavaad #endhindi}
\end{document}

Process it with itrans: (Windows MikTeX users need to change path to itrans53\bin to evoke itrans.exe

$ itrans -i indic-pre.tex -o indic.tex

Then run (pdf)latex on indic.tex, which is of course the file to edit if you have further text to add. Here’s the output of that little file:

Hold on! How’d you know you needed to type na^nRi etc?

I peeked at the transliteration map files ☺. For example, tamil.ps for the Tamil transliteration, dvng.ps for the Hindi (devanagari) transliteration, etc. If your LaTeX set up doesn’t install these files by default, you can download the package source .zip and look in the doc folder. The .itx files are sample source .tex files that generated the .ps files.