## Thursday, July 19, 2012

### Myanmar (Burmese) Language with XeTeX and LuaTeX

To properly render Myanmar fonts using LaTeX, it is necessary to use TeX typesetting engines that support Unicode such as XeTeX and LuaTeX. You should make sure that your TeX Live or MiKTeX version is up to date and XeTeX and LuaTeX are bundled with them. To build TeX files conveniently, you can define user command in editors such as TeXmaker or TeXstudio. In TeXstudio, click Configure TeXstudio... command in the Options menu. Then, go to Commands and copy the command for the PdfLaTeX.
After that, go to User menu and click User Commands -> Edit User Commands and click green plus sign. Paste the command that you have copied and replace pdflatex with xelatex for XeTeX. Follow the same procedure and use lualatex for LuaTeX.
The following example TeX file, Z1.tex, works with both xelatex and lualatex.
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Zawgyi-One}
\begin{document}
ျမန္မာစာ
\end{document}
Another example for lualatex that includes lua script is luaZ1.tex. I have tested laulatex with Zawgyi-One, Padauk, Myanmar3, and Myanmar MN. And I found that only Zawgyi-One works with current version (LuaTeX, Version beta-0.70.1-2011082320).
XeTeX can render Zawgyi-One and Padauk on all platforms, and Myanmar MN on Mac OS X. Although there is no problem for Zawgyi-One, Unicode fonts such as Padauk require renderer to be defined. In the following example, Renderer=Graphite defines Graphite as the renderer. For Myanmar MN font, the renderer should be explicitly defined as Renderer=AAT. See example XeFontspec.tex as shown below.
Another way to define renderer instead of using \fontspec[Renderer=Graphite]{Padauk} is \font\1="Padauk/GR" \1 , where /GR is to explicitly use the Graphite font renderer. Other possible options are /AAT to explicitly use the ATSUI renderer (Mac OS X only) and /ICU to explicitly use the ICU OpenType renderer. However, defining renderer does not works for xelatex versions on my Windows XP and Ubuntu Linux. Fortunately, I found a way at Calmhill's blog that uses \fontspec[Script=Myanmar]{Padauk} to make Padauk works on them. An example is XePadauk.tex.
An example for Myanmar MN is XeMyanmarMN.tex. Currently, according to my tests, Myanmar3 does not work on all platforms.

Updated post: A LaTeX Report Template for Myanmar Language Using XeTeX