[Tex/LaTex] Typesetting in Tamil on ShareLaTeX

babelsharelatextamil

My main goal is to display Tamil script in LaTeX using ShareLaTeX. I would be happy to figure out a minimal working code to display வணக்கம் in ShareLaTeX.

\documentclass{article}
\usepackage[utf8]{inputenc}

\title{Tirukkural}    
\date{April 2014}    
\begin{document}
\maketitle

அகர முதல எழுத்தெல்லாம் ஆதி
பகவன் முதற்றே உலகு

\end{document}

I have tried several packages, however, I run into a lot of errors whenever I use them. Here are some of my attempts:

1) itrans-package: Transliteration Example
LaTeX/XeTeX setup Tamil/Indic languages

When I use the code suggested in the thread above, I get the error: 'File 'itrans.sty' not found'. How could I include it into ShareLaTeX?

2) otamil-package: Tamil Font Example

When I try to include the otamil-package the documentation says I have to install Yudit which would therefore not allow me to use tamil through ShareLaTeX. Does anyone have a suggestion how I could bring the code to use?

\usepackage[chandra]{otamil}

3) babel-package: Tamil Font Example
http://www.sharelatex.com/learn/International_language_support

ShareLaTeX has a sample code for using Russian script. However, applying the same logic to Tamil I get the following error message: Package babel Error: Unknown option `tamil'. Either you misspelled it

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english, tamil]{babel}
\usepackage[T1, T2A]{fontenc}

\begin{document}

அகர முதல எழுத்தெல்லாம் ஆதி
பகவன் முதற்றே உலகு

\end{document}

Best Answer

Fast solution for ShareLaTeX: upload the font file(s) into the project and use the fontspec package with ExternalLocation parameter in the xelatex engine.

My best guess is that there is no solution for ShareLaTeX/WriteLaTeX at the moment. As far as I know, there is no font in TeX distribution supporting Tamil. There is/was support for Omega, see tamil-omega, but you cannot run it. Even an example in itrans-xetex uses the JanaTamil font which must be installed somehow. There is a great support for Indic fonts in T1 encoding created by Karel Píška, but you cannot install it on those servers by yourself.

There are fonts on the Internet, but you need to grab, install and use them, see a list of them. If you are a Microsoft Windows user, use Arial Unicode MS, if you are a Linux user, install ttf-indic-fonts package (8 fonts). If nothing from these options is working for you on your local computer, use the Code2000 font as a starting point.

The only solution I see is to upload font file to the server's project (in the same way as uploading pictures) and use ExternalLocation from the fontspec package (untested). Uploading files is possible in TeXonWeb project, http://tex.mendelu.cz/en/. It is similar project to the ShareLaTeX.

Edit 1: I am uploading TAMu_Kadampari.ttf file from Linux distribution (ttf-indic-fonts) as my testing font sample. I haven't found solution in ShareLaTeX (I am not able to switch to xelatex/lualatex from pdflatex, so installing a font is almost impossible there, but uploading files is possible - I wrote an email to the maintainers if they could improve it), but after registration this approach works in WriteLaTeX, http://www.writelatex.com/, and TeXonWeb, http://tex.mendelu.cz/en/. I enclose several screenshots, the first picture is taken from ShareLaTeX (not working), the second picture is taken from WriteLaTeX (working) and the last one is from TeXonWeb project (it is working in Czech version, in English version we cannot switch the engine to xelatex right now - I have notified the author of this project).

Edit 2: It is working in ShareLaTeX as well. We need to switch to the project settings in the left tool bar, return to code and recompile the document. I illustrate it with two screenshots.

xelatex-settings

xelatex-compilation

Screenshots from Edit 1:

sharelatex

writelatex

texonweb

Solution for local computer: On a local computer this task is rather easy as already mentioned by David Carlisle. Use polyglossia and run the xelatex engine. I enclose my example and a preview of it.

%! xelatex mal-tamil.tex
\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{tamil}
\setotherlanguage{english}
\usepackage{fontspec}
\newfontfamily\tamilfont[Script=Tamil,Scale=1.4]{TAMu_Kadampari.ttf} 
% http://www.wazu.jp/gallery/Fonts_Tamil.html
% Linux (ttf-indic-fonts): 
%    TAMu_Kadampari.ttf
%    TAMu_Kalyani.ttf
%    TAMu_Maduram.ttf
%    TSCu_Comic.ttf
%    TSCu_Paranar.ttf
%    TSCu_paranarb.ttf
%    TSCu_paranari.ttf
%    TSCu_Times.ttf
% Microsoft Windows: Arial Unicode MS
% After download: Code2000
%    http://web.archive.org/web/20101122142710/http://code2000.net/code2000_page.htm
\begin{document}
\selectlanguage{english}
\title{Tirukkural}    
\date{April 14, 2014}    
\maketitle
\thispagestyle{empty}
\selectlanguage{tamil}
அகர முதல எழுத்தெல்லாம் ஆதி
பகவன் முதற்றே உலகு
\end{document}

mwe