[XeTeX] Automatic language switching

kevin & siji kevinsiji at gmail.com
Mon Jan 4 11:01:55 CET 2010


Dear All,

I am new to the wonderful TeX world.

I tried and successfully created Tamil documents using LyX. I believe I've
created the necessary files for hyphenation in this language, and it works
fine.

Where now I got blocked is while attempting to automatically switching the
languages between English, Tamil & Malayalam. I can switch the font, but the
command to switch language is resulting in a 'Tex capacity exceeded error'.
I hope somebody from you will be able to help me to put the code right.

Here is my complete code:

\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{polyglossia}

\setdefaultlanguage{english}
\setotherlanguage{tamil}
\setmainfont{Arial}
\newfontfamily\tamilfont[Script=Tamil]{Latha}

%Automatic language switching code
\newcount\cnt\cnt="0B80
\loop
  \XeTeXcharclass\cnt=10 \ifnum\cnt<"0BFF \advance\cnt1
\repeat
  XeTeXcharclass "200C = 10
  XeTeXcharclass "200D = 10

\XeTeXinterchartoks 0 10 = {\starttamil}
\XeTeXinterchartoks 255 10 = {\starttamil}
\XeTeXinterchartoks 10 0 = {\finishtamil}
\XeTeXinterchartoks 10 255 = {\finishtamil}

\newcommand\starttamil{\begin{tamil}}
\newcommand\finishtamil{\end{tamil}}

\XeTeXinterchartokenstate = 1

\begin{document}
English and தமிழ் and again some English between தமிழ் மேலும் தமிழ் மற்றும்
ஆங்கிலம்.
\end{document}


Thanks,

-- 
Kevin Siji
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/xetex/attachments/20100104/e5e03d98/attachment.html>


More information about the XeTeX mailing list