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

## 15 thoughts on “Tamil and Hindi Support in LaTeX”

1. very nice
but i want to know how this newfont is defined

2. Rajan, I don't quite understand your question, can you describe in more detail what is it that you want to know?

3. Anonymous says:

@Rajan T K, There are many tools for creating fonts. E.g Metafont is a free but powerful tool.

4. Anonymous says:

Hi,

I tried the steps mention here.
When i ran the command “itrans -i indic-pre.tex -o indic.tex”,
I get the error:
** ITRANS 5.30 (29 July 2006) (TeX Interface)

Error: fillup font error (fill up from wntml.ifm)
Error: could not load in IFM file (line 7, #tamilifm=wntml.ifm)

What am I doing wrong?

Thanks,
Ram

5. Hello Ram, What OS are you on? It sounds like you're missing the itrans font files.

6. Anonymous says:

Thanks very much for the post, it is exactly what I have been trying to do, but in Gujarati. I needed to make one change that other users might find useful though. I could not initially run latex or pdflatex successfully, and I kept getting the message below.

!pdfTeX error: pdflatex (file itxguj.pfa): cannot open Type 1 font file for reading

What I needed to do was to copy the itxguj.pfa file to the /usr/share/texmf-texlive/fonts/type1/public/velthuis/ directory (on ubuntu 12.04) and run texhash as the user (sudo texhash). It worked beautifully thereafter!

7. Hi,
I am getting error in windows 7 while evoking itrans.exe. The error is “Not a TDS-compliant root directory” How can I rectify the error.

8. Anonymous says:

I have a problem with Itrans and dvnc font for sanskrit. I follow these steps:
1.- I write a file “my-file.itx”
2.- I use the pre-processor: itrans -i my-file.itx -o my-file.tex
3.- I open “my-file.tex” with TexnicCenter y make the ouput profile Latex->Ps (no problem)
4.- I try to see “my-file.ps” but it's impossible to view anything.
Where is the problem?
Thankyou very much for your help

9. I'm not quite sure what's the cause of the problem here. If you convert the PS to a PDF, do you get any contents in your PDF?

10. I tried this in Windows 7 (example file from linux user group)
documentclass[11pt]{article}
usepackage[english]{babel}

usepackage{fontspec}
defaultfontfeatures{Ligatures=TeX}
setmainfont{Arial}
begin{document}
fontrm=”Arial Unicode MS” at 16pt rm
அன்புள்ள அய்யாவுக்கு,\
வணக்கம். \
என்னுடைய இக்கடிதம் கிடைத்ததும் பதில் அனுப்புக

end{document}
and run xelatex instead of pdflatex.

I get tamil output but the rendering of tamil characters are not correct.

Can any one offer help?

11. I ran your code (Windows 7, MikTeX 2.9) and got some colleagues who can read Tamil to vet the output; things seem to be running fine here..

12. Hi Lian,

Thank you so much for this information. I am not too familiar with the commands in LaTeX. Please can you help me with getting the output for Sanskrit, Kannada and English with diacritics. I am not sure how to specify the newfont{…..} commands.

Thank you!

13. Anonymous says:

This is such a great blog post. I was exactly looking for something like this to get tamil fonts. Let me try it out and see how it goes. Thanks