# LaTeX/XeTeX setup Tamil/Indic languages

I use TexMaker and LyX in Ubuntu. I'd like to typeset Tamil/Telugu/Hindi text, and so far I've been unsuccessful.

Please suggest me a working TeX/LaTeX/variants setup for Indic languages, especially Tamil.

edit: XeTeX seems to have good Unicode support, and I read TexMaker has XeteX support too. I installed all XeTeX, latex-tamil packages etc. But couldn't make them work yet.

Documentations talk about Arabic or Korean text. Nothing mentioned about Tamil/Indic text.

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 அய்யா வணக்கம்.}


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.

As of 2019, both babel and polyglossia support Tamil on XeLaTeX. LuaLaTeX does not currently work with Indic scripts, but there is also an experimental project integrating Harfbuzz and LuaLaTeX that should work. 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}


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}


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.

• Instead of \usepackage[bidi=default]{babel} and \babelprovide[main, import]{english}, just write \usepackage[english]{babel} (Tamil is not an RTL script). – Javier Bezos Jul 7 '19 at 16:41
• @JavierBezos I ended up leaving the \babelprovide[import, main] line, because most requests I’ve seen for Tamil, Malayalam, etc. are about multilingual documents. I mentioned a few other use cases. I removed the unnecessary package option. Thanks for pointing that out! – Davislor Jul 7 '19 at 18:45
• There is no reason to load english with \babelprovide. The standard method, as a package option, is still preferred. – Javier Bezos Jul 8 '19 at 13:14
• @JavierBezos I suppose my own preference is to load all my languages by the same method, but if you say [english] is preferred, I’ll change my MWE. – Davislor Jul 8 '19 at 19:27
• Could you update your answer to include luahbtex + luaotfload 3.11? \babelfont[tamil]{rm}[Script=Tamil,Renderer=Harfbuzz]{Latha} should work fine then. See tex.stackexchange.com/a/493185/2388 for installation instructions. – Ulrike Fischer Nov 11 '19 at 10:04

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. • Appreciate the shout-out. Unfortunately, a few important sites still require PDFLaTeX, and might need something like that, or a hack like compiling all the Tamil words to PDF and including them. – Davislor Jul 8 '19 at 20:44 To use various indic languages in latex with texmaker I recommend following steps to be followed by viewers of this post. 1. Download latest version of MikTeX. Install it in your system. I use the C:/latex/ directory. 2. Download devnag developed by velthuis from CTAN. Install it in your system. I use the c:/latex/velthuis directory. 3. Open mycomputer->all programmes->miktex->miktex settings. Go to root tab and add c:/latex/velthuis directory and click OK. 4. Install TeXMaker and go to "user" tab and open "user command" and then "edit user command". Enter "devnagari" in menu item and commands c:/latex/velthuis/bin/devnag.exe %.dn|c:/latex/miktex/bin/latex.exe -interaction=nonstopmode %.tex|"C:/latex/MiKTex/miktex/bin/yap.exe" %.dvi  in command field. Click OK. 5. Now devnagri will appear in dropdown in menu bar after arrow. You can add extra command using | having no space before and after |. 6. Now copy misspal file from c:/latex/velthuis/doc/generic/ folder in TeXMaker and save it as misspall.dn. Now run devnagri command and you will see out put in DVI preview in devnagari script. If you want write document in tamils then use itrans instead of devnag. It is also working with LaTeX and TeXMaker very well. 7. Remember %.dn means % denotes to filename without extension and .dn extension of file. Users must read doc or manual of devnag or itrans. • While a link to your homepage may be part of your user profile, it should not be included in answers. – lockstep Apr 10 '11 at 12:56 For Hindi, you can probably use the devanagari package for LaTeX. I've used it for Sanskrit. Just note that the "internal" codes for the script is a bit obtuse, so it is suggested that you follow the documentation and type in a more readable format, and then pass the source file through a preprocessor. (Included in the distribution.) There are also language packages for Telugu and Tamil, but not having used either I cannot say more about them. • Thanks Willie. I've installed Tamil packages but couldn't get them work yet. Heard about Xetex's support for Unicode characters. Any idea how to use it in Ubungu? (Guess it should go to another question) – ananth.p Jul 27 '10 at 21:11 • Sorry, but I've really limited experience with Xetex, and had never played with the Tamil package myself. Good luck! – Willie Wong Jul 27 '10 at 21:15 • Will try devanagari first. 'Internal Codes' meaning I should be typing the source with some kind of hex code letter-by-letter? Thanks for the tip. – ananth.p Jul 27 '10 at 21:30 • This page has a code example that works (partially)- tug.org/pipermail/xetex/2009-December/015051.html Letters with dot about (க், ல்) are rendered wrong. TexMaker didn't help much. It wouldn't let me type in Tamil, but I could copy-paste unicode text into it. TexMaker, by default, tries to compile with Latex, I had to compile from command line ($ xelatex <source>) – ananth.p Jul 27 '10 at 21:46

For my Ubuntu system I did as Lian Tze Lim suggested. Use the package manager to install the itrans and itrans-fonts packages. No muss No fuss.

For Windows and MiKTex 2.9 the set up process was more involved. Below is the batch file I created to facilitate the copying.

1) Install MiKTeX

2) Use the MiKTeX package manager to install the indic-type1 package and the devanagari packages.

4) extract itrans53-win32.zip to some temporary location. I used C:\temp\Tamil\ITRANS53.

5) Open a command window which is running as administrator. (many of the copies are into c:\program files\ and that requires the process be run with elevated privilege)

6) CD to the temporary location of ITrans (e.g. C:\temp\Tamil\ITRANS53)

7) execute the batchfile commands below.

8) close the command window

9) Right click on start->computer and select Properties.

10) Select Advanced System Settings->Environment Variables

11) add new system environment variable named: ITRANSPATH. See the batch file commands below for the exact value for this variable.

12) open a command window

13) The command:

itrans -I <filename>.itx -o <filename>.tex


will now work and (pdf)latex can resolve the packages, fonts, and commands referenced in the output from itrans.exe.

I can now process LaTeX files in both Ubuntu and Windows 7 and have the source files (.Tex, .ITX, etc.) under revision control

The batch file is:

echo off

rem Record where is MikTeX is installed
set MiktexRoot=C:\Program Files\MiKTeX 2.9

rem copy itrans.exe to a directory already within the path environment variable
rem   namely the path adjustment made by the installer for MiKTeX which puts
rem   all of the MiKTeX installed tools on the PATH variable
rem
rem for 32-bit windows systems remove the x64 suffix
copy ".\bin\*.exe" "%MiktexRoot%\miktex\bin\x64\*.*" /Y /V

rem Create the directories within the MikTeX structure used or referenced by the itrans package
mkdir "%MiktexRoot%\doc\itrans"
mkdir "%MiktexRoot%\doc\itrans\contrib"
mkdir "%MiktexRoot%\fonts\source\public\itrans"
mkdir "%MiktexRoot%\fonts\type1\public\itrans"
mkdir "%MiktexRoot%\fonts\tfm\public\itrans"
mkdir "%MiktexRoot%\fonts\afm\public\itrans"
mkdir "%MiktexRoot%\fonts\truetype\public\itrans"
mkdir "%MiktexRoot%\tex\latex\itrans"
mkdir "%MiktexRoot%\tex\latex\itrans\fonts"

rem Copy itrans package files into the MiKTeX structure
rem used http:\\tex.stackexchange.com\questions\1754\tamil-tex-in-windows
rem and the installation script for Tamil-Omega as guides for the copy commands
rem Listed below
rem

rem Copy Documentation files
copy ".\doc\*.*" "%MiktexRoot%\doc\itrans\*.*" /Y /V
copy ".\contrib\*.*" "%MiktexRoot%\doc\itrans\contrib\*.*" /Y /V
rem copy Font Files
copy ".\lib\fonts\*.mf"  "%MiktexRoot%\fonts\source\public\itrans\*.*" /Y /V
copy ".\lib\fonts\*.pfa" "%MiktexRoot%\fonts\type1\public\itrans\*.*" /Y /V
copy ".\lib\fonts\*.pfb" "%MiktexRoot%\fonts\type1\public\itrans\*.*" /Y /V
copy ".\lib\fonts\*.pfm" "%MiktexRoot%\fonts\type1\public\itrans\*.*" /Y /V
copy ".\lib\fonts\*.tfm" "%MiktexRoot%\fonts\tfm\public\itrans\*.*" /Y /V
copy ".\lib\fonts\*.afm" "%MiktexRoot%\fonts\afm\public\itrans\*.*" /Y /V
copy ".\lib\fonts\*.ttf" "%MiktexRoot%\fonts\truetype\public\itrans\*.*" /Y /V
rem copy all of the ITRANS Lib structure into MiKTeX structure.
copy ".\lib\*.*" "%MiktexRoot%\tex\latex\itrans\*.*" /Y /V
copy ".\lib\fonts\*.*" "%MiktexRoot%\tex\latex\itrans\fonts\*.*" /Y /V

rem post installation commands to rebuilt the font name database ans to process all of the font MAPping files.
texhash
updmap

rem
rem With the above copies MikTeX can now find the ITRANS fonts and resolve references created by the itrans.exe preprocessor
rem
rem But the preprocessor cannot be run from the command line because itrans.exe is expecting to find a
rem specific ITRANS structure somewhere on the disk via the environment variable: ITRANSPATH