LaTeX/XeTeX setup Tamil/Indic languages

As of 2020, both babel and polyglossia support Tamil. This requires either LuaLaTeX with the HarfBuzz renderer (a version from 2020 or later should work) or XeLaTeX. The babel package supports more languages and engines, while the polyglossia package has a somewhat simpler user interface.

Either of these let you use any system font that supports Tamil. Any font you can use in your word processor should work.

Save as UTF-8.

With Babel

\documentclass{article}
\usepackage[english]{babel}
\usepackage{fontspec}

\babelprovide[import]{tamil}

\defaultfontfeatures{Scale=MatchLowercase}
\babelfont{rm}[Scale=1.0]{Latin Modern Roman}
\babelfont[tamil]{rm}{Latha}

\begin{document}
\foreignlanguage{tamil}{தமிழ் அரிச்சுவடி-தமிழ் மொழி}
\end{document}

babel sample

This set-up is for the common case where you want to use a bit of Tamil in a multilingual document. You can also declare Tamil the main language, or set a section in Tamil with \begin{otherlanguage}{tamil}...\end{otherlanguage}. You can define \babelfont[tamil]{sf}{Some Font} to get a sans-serif font and \babelfont[tamil]{tt}{Some Font} to get monospace.

If you get warning messages about the font not supporting the language Tamil for the script Tamil, they’re harmless, but you can suppress them by adding the option \babelfont[tamil]{rm}[Language=Default]{Some Font}. What happened is that the selected font doesn’t add an OpenType language tag.

With Polyglossia

\documentclass{article}
\usepackage{polyglossia}

\setdefaultlanguage{english}
\setotherlanguage{tamil}

\defaultfontfeatures{Scale=MatchLowercase}
\newfontfamily\tamilfont{Latha}[Script=Tamil]

\begin{document}
\texttamil{தமிழ் அரிச்சுவடி-தமிழ் மொழி}
\end{document}

polyglossia sample

You can also use the tamil environment for sections, and define \tamilfontsf and \tamilfonttt similarly to \tamilfont.

If You Cannot Use XeTeX

It would be nice if the last few holdouts added support for XeTeX (and, in the future, HarfTeX). Since some publishers still do not allow it, you might still need to fall back on a workaround such as LianTze Lim’s solution. If you need only a few short words or phrases in Tamil, another workaround is to compile them with XeLaTeX as tiny standalone PDFs, then insert the PDFs as images.


I will give what I learned by trial and error. This is pertaining to Windows platform.

( I used the material given found here at the XeLaTeX wiki.)

The trick is to

  1. use the fonts available in the system's font directory. (Windows7 provides Latha font for Tamil) and
  2. compile your source file with xelatex, not pdflatex! (For this in Windows platform, 'Texworks' can be used as this is an unicode editor. Check whether your favourite editor can save your file in utf-8 format)

In the preamble include the following

\usepackage{fontspec}

\newfontfamily{\lathatam}{Latha}

The declaration in the first set of parentheses is the command to call Tamil encoding in the body of your document such as:

{\lathatam அய்யா வணக்கம்.} 

I used Microsoft's Indic Tamil Input Method. (For downloading and installation see the relevant web site. You can also use Google's method).

Another Tamil font encoding is 'Arial Unicode MS'. To use this declare

\newfontfamily{\anothertam}{Arial Unicode MS}

in the preamble, and use it by doing:

{\anothertam நான் நலம். நீங்கள் நலமா}

When you compile with xelatex, you will see the difference between these fonts.


[Note added on 7 July 2019] Please disregard this answer and use XeLaTeX/LuaLaTeX with polyglossia/babel instead, as explained in Davislor's answer. I'll leave this answer here for historical interest.

I was able to typeset Tamil using LaTeX on Ubuntu by installing the itrans and itrans-fonts packages via synaptic (or apt-get). It doesn't let you type in Tamil 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 nandri-pre.tex:

\documentclass{minimal}
\usepackage[preprocess]{itrans}

\newfont{\tmlb}{wntml12}
\newfont{\tmls}{wntml10}
\hyphenchar\tmlb=-1 
\hyphenchar\tmls=-1 

#tamilifm=wntml.ifm
#tamilfont=\tmlb

\begin{document}
Hi! {#tamil na^nRi #endtamil}
\end{document}

Process it with itrans:

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

Then run (pdf)latex on nandri.tex, which is of course the file to edit if you have further text to add.