I use TexniCentre and Miktex 2.8 in Windows XP. I would like to typeset Tamil text, and so far I've been unsuccessful.
Please suggest me a working TeX/LaTex/variants setup for Tamil language.
Thanks for any help in advance.
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityYou'll need a Tamil font installed on your operating system; I used Noto Serif Tamil and Noto Sans Tamil as example below.
\usepackage{polyglossia}
\setmainlanguage{tamil}
\setotherlanguage{english} %% OPTIONAL if you have some English text in your book
%% Select fonts for Tamil
\newfontfamily\tamilfont[Script=Tamil]{Noto Serif Tamil}
\newfontfamily\tamilfontsf[Script=Tamil]{Noto Sans Tamil}
%% OPTIONAL; Select fonts for English
\setmainfont{Times New Roman}
\setsansfont{Arial}
Then compile the document with xelatex
or lualatex
.
Typesetting Tamil is possible with the itrans
pakcage, but it's not packaged properly in MikTeX. You will need to install it manually. Download itrans53-win32.zip
from CTAN. After unzipping the contents (say C:\itrans53\
), assuming <texmf>
being your local TEXMF tree,
lib
folder into <texmf>\tex\latex\itrans
fonts
folder into the appropriate locations, i.e.
*.mf
in <texmf>\fonts\source\itrans
*.afm
in <texmf>\fonts\afm\itrans
*.tfm
in <texmf>\fonts\tfm\itrans
*.pfb, *.pfa, *.pfm
in <texmf>\fonts\type1\itrans
*.ttf
in <texmf>\fonts\truetype\itrans
Then try out the minimal example I gave in my answer to this related question. You would need to evoke itrans.exe
in the itrans53\bin
folder. (However I'm not sure if it works in 64-bit Windows.)
For my Ubuntu system I used 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 manage to install the indic-type1 package and the devanagari packages.
3) download itrans53-win32.zip from http://www.aczoom.com/files/itrans/53/itrans53-win32.zip
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
rem instruct the user about this environment variable requirement
rem
echo "Set the environment variable: ITRANSPATH"
echo "ITRANSPATH=%MiktexRoot%\tex\latex\itrans;%MiktexRoot%\tex\latex\itrans\fonts"
On Windows 10, first install the “Supplemental Tamil Fonts”, namely Latha and Vijaya. (Windows 10 comes by default with Nirmala UI, which does not work as well.) The directions are available, for instance, at Microsoft Answers. A brief summary of those directions is: Settings -> System -> Apps & features -> Manage optional features -> "+" icon next to Add a feature -> "Tamil Supplemental Fonts".
Then use XeLateX following the answers to the question “Typesetting in Tamil on ShareLaTeX” on this site, with font Latha or Vijaya.
I was writing something in both English and Tamil so the key commands I used from the answers to this other question were:
\usepackage{polyglossia}
\setmainlanguage{tamil}
\setotherlanguage{english}
\usepackage{fontspec}
along with: \selectlanguage{english} % Some English writing here \selectlanguage{tamil} % Some Tamil writing here
You also have to use \newfontfamily or \setmainfont to select the font you installed in the first step (Latha or Vijaya) as the actual font to use when rendering Tamil.
Indeed, Xelatex is the way to go. And Unicode fonts. See, in part, LaTeX/XeTeX setup Tamil/Indic languages
Tried an experiment:
MWE
\documentclass[12pt]{article}
\usepackage{xcolor}
\pagecolor{red!3}
\usepackage{fontspec}
\setmainfont[Script=Tamil]{Noto Serif Tamil}
\newfontfamily\tamilfontsf[Script=Tamil]{Noto Sans Tamil}\newfontfamily\fpunct{Noto Serif}
\newfontfamily\fdev{Noto Serif Devanagari}
\newfontfamily\englishfont{Noto Serif}
\usepackage{polyglossia}
\setdefaultlanguage[numerals=tamil,changecounternumbering=true]{tamil}
\setotherlanguages{english}
\newcommand\bqql{{\fpunct “\thinspace}}
\newcommand\bqqr{{\fpunct\thinspace ”}}
\newcommand\bql{{\fpunct ‘\thinspace}}
\newcommand\bqr{{\fpunct\thinspace ’}}
\newcommand\bc{{\fpunct ,}}
\newcommand\bend{{\fpunct\textendash\ }}
\newcommand\bemd{{\fpunct\textemdash\ }}
\newcommand\bdanda{{\fdev ।\thinspace}}
\newcommand\bddanda{{\fdev ॥\thinspace}}
\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\newcommand\bframe[1]{%
\begin{tikzpicture}
\node [shade,
top color=red!40,
bottom color=violet!5,
rounded corners=2pt,
blur shadow={shadow blur steps=5,violet}
] {#1};
\end{tikzpicture}%
}
\usepackage{titlesec}
\titleformat{\section}{\large}{\bframe{\thesection}}{0.75em}{}
\usepackage{titletoc}
\titlecontents{section}
[1em]%left
{}%abovecode
{\bframe{\thecontentslabel}\hspace{0.75em}}%numbered format
{\huge}%numberless format
{\titlerule*[1pc]{.}\contentspage} % page number
[]%belowcode
\begin{document}
\tableofcontents
\vspace{1ex}
\hrule
\vspace{1ex}
\today
\textenglish{From Wikipedia}
\section{சூரியக் குடும்பம்}
கதிரவ அமைப்பு (\textenglish{Solar System}) அல்லது சூரியக் குடும்பம் என்பது கதிரவனுக்கும் அதைச் சுற்றி வரும் ....
\section{கண்டு பிடிப்பும் ஆய்வுப் பயணமும்}
பல்லாயிரம் ஆண்டுகளாக மனித இனம் கதிரவ அமைப்பைப் பற்றி புரிந்துகொள்ளவோ ஏற்றுக்கொள்ளவோ இல்லை.
\end{document}
tamildigits.sty (cloned from Bengali version)
\ProvidesPackage{tamildigits}
[2019/11/11 v.00%
Formatting of Tamil digits]
\def\tamildigits#1{\expandafter\@tamil@digits #1@}
\def\@tamil@digits#1{%
\ifx @#1% terminate
\else%௦௧௨௩௪௫௬௭௮௯
\ifcase#1௦\or௧\or௨\or௩\or௪\or௫\or௬\or௭\or௮\or௯\fi
\expandafter\@tamil@digits
\fi
}
\endinput
Added Tamil digits processing (also cloned) to the end of gloss-tamil.ldf
(language definition file, a part of polyglossia
):
%===============================
\def\tmp@western{Western}
\newif\iftamil@devanagari@numerals
\tamil@devanagari@numeralsfalse%true
\def\tmp@tamil{tamil}
\newif\iftamil@tamil@numerals
\tamil@tamil@numeralstrue%false %
\define@key{tamil}{numerals}[Devanagari]{%
\def\@tmpa{#1}%
\ifx\@tmpa\tmp@western
\tamil@devanagari@numeralsfalse
\else\ifx\@tmpa\tmp@tamil
\tamil@devanagari@numeralsfalse
\tamil@tamil@numeralstrue\fi
\fi}
\def\extras@tamil{}
\def\noextras@tamil{}
\define@boolkey{tamil}[tamil@]{changecounternumbering}{
\def\@tmpa{#1}
\def\@tmptrue{true}
\ifx\@tmpa\@tmptrue
\def\extras@tamil{%
\let\savethepage\thepage
\let\savethesection\thesection
\let\savethesubsection\thesubsection
\let\savethesubsubsection\thesubsubsection
\let\savetheparagraph\theparagraph
\let\savethesubparagraph\thesubparagraph
\def\thepage{\tamilnumeral{page}}
\def\thesection{\tamilnumeral{section}}
\def\thesubsection{\tamilnumeral{subsection}}
\def\thesubsubsection{\tamilnumeral{subsubsection}}
\def\theparagraph{\tamilnumeral{paragraph}}
\def\thesubparagraph{\tamilnumeral{subparagraph}}
}
\def\noextras@tamil{%
\let\thepage\savethepage
\let\thesection\savethesection
\let\thesubsection\savethesubsection
\let\thesubsubsection\savethesubsubsection
\let\theparagraph\savetheparagraph
\let\thesubparagraph\savethesubparagraph
}
\fi
}
\def\tamilnumber#1{\tamildigits{\number#1}}% Takes number
\def\tamilnumeral#1{\tamilnumber{\csname c@#1\endcsname}}% Takes counter
\def\blockextras@tamil{\extras@tamil}
\def\inlineextras@tamil{\extras@tamil}
A sample of some system fonts:
MWE
\documentclass[12pt]{article}
\usepackage{xcolor}
\pagecolor{red!3}
\usepackage{fontspec}
\setmainfont[Script=Tamil]{Noto Serif Tamil}
\newfontfamily\tamilfontsf[Script=Tamil]{Noto Sans Tamil}
\newfontfamily\englishfont{Noto Serif}
\newcommand\ftaname{Baloo Thambi}
\newcommand\ftbname{ETTamilNew}
\newcommand\ftcname{\detokenize{GIST-TMOTPadma}}
\newcommand\ftdname{\detokenize{GIST-TMOTParvathi}}
\newcommand\ftename{SakalBharati}
\newcommand\ftfname{\detokenize{TSCu_SaiIndira}}
\newfontface\fta{\ftaname}
\newfontface\ftb{\ftbname}
\newfontface\ftc{\ftcname}
\newfontface\ftd{\ftdname}
\newfontface\fte{\ftename}
\newfontface\ftf{\ftfname}
\newcommand\sampletext{சூரியக் குடும்பம்}
\usepackage{polyglossia}
\setdefaultlanguage[numerals=tamil,changecounternumbering=true]{tamil}
\setotherlanguages{english}
\begin{document}
\begin{tabular}{rl}
\textenglish{\ftaname} & \huge\fta\sampletext \\
\textenglish{\ftbname} & \huge\ftb\sampletext \\
\textenglish{\ftcname} & \huge\ftc\sampletext \\
\textenglish{\ftdname} & \huge\ftd\sampletext \\
\textenglish{\ftename} & \huge\fte\sampletext \\
\textenglish{\ftfname} & \huge\ftf\sampletext \\
\end{tabular}
\end{document}
Plus font effects, as well:
MWE
\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage{fontspec}
\setmainfont{Noto Serif}[Scale=3]
\usepackage{contour}
\usepackage{shadowtext}
\newcommand\sampletext{சூரியக்}
\newcommand\sampletextb{குடும்பம்}
\newcommand\sampletextc{அமைப்பு}
\newcommand\ftcname{\detokenize{GIST-TMOTPadma}}
\newfontface\ftc{\ftcname}[Scale=3]
\begin{document}
\contourlength{1.4pt}
\shadowcolor{blue}
\shadowoffsetx{1.52pt}
\shadowoffsety{1.52pt}
\Huge
\shadowtext{%
\contour[32]{yellow}{%
\textbf{{\ftc\sampletext}}
}%
}%
\bigskip
\contourlength{0.4pt}
\color{yellow}
\shadowcolor{blue}
\shadowoffsetx{0.52pt}
\shadowoffsety{0.52pt}
\Huge
\shadowtext{%
\contour[24]{red}{%
\textbf{{\ftc\sampletextb}}
}%
}%
\bigskip
\contourlength{0.8pt}
\color{Magenta}
\shadowcolor{blue!40}
\shadowoffsetx{4.52pt}
\shadowoffsety{2.52pt}
\Huge
\shadowtext{%
\contour[24]{red}{%
\ftc\sampletextc
}%
}%
\end{document}
MikTeX version (2.9)