using Thai with LaTeX on Mac OS X

Here the thing, while I was writhing my thesis using LaTeX with the template that Dr. Gordon created, I have to write a long research report for my work.
So I have a though of using LaTeX to create that report since I already fond of the way LaTeX writing can help me organize and create beautiful PDF report.

Screen Shot 2014-07-27 at 10.19.03 AM

However, it’s not easy as I thought since I have to write that report in Thai and Thai language is designed to be difficult to use in the digital world. I have to dig around for a couple days in order to use Thai with LaTeX especially on OS X.
Here is how I did it:

1. First we’ll need to install TeX Live, for Mac we need to install MacTex
2. Once you install the MacTex then you’re ready to use international language with LaTeX using XeTeX typesetting engine.
3. Then you’ll need a tool with XeTeX engine to write LaTeX. I recommend Texmaker because it’s free and super powerful.
Screen Shot 2014-07-27 at 10.38.42 AM
4. After installing you will have to set up the typesetting by go to Texmaker > Preferences > Quick Build > XeLaTex + View PDF
5. Finally test your environment by creating new document with this code

\usepackage[top=25mm, bottom=20mm, left=25mm, right=25mm]{geometry}
\XeTeXlinebreaklocale "th"
\XeTeXlinebreakskip = 0pt plus 1pt
\setmainfont{TH SarabunPSK}
\newfontfamily{\thaifont}[Script=thai]{TH SarabunPSK}
ป้า กะ ปู่ กู้อีจู้ ตัวปกติ\\
{\itshape ป้า กะ ปู่ กู้อีจู้ ตัวเอียง} \\
{\bfseries ป้า กะ ปู่ กู้อีจู้ ตัวหนา } \\
{\bfseries\itshape ป้า กะ ปู่ กู้อีจู้ ตัวหนาเอียง} \\
ทดสอบใช้คำสั่ง \LaTeXe{}\\
ป้า กะ ปู่ กู้อีจู้ ไฟฟ้า ปัญญา ตัวปกติ\\
\textbf{ป้า กะ ปู่ กู้อีจู้ ไฟฟ้า ปัญญา ตัวหนา}\\
\textit{ป้า กะ ปู่ กู้อีจู้ ไฟฟ้า ปัญญา ตัวเอียง}\\
\textsl{ป้า กะ ปู่ กู้อีจู้ ไฟฟ้า ปัญญา ตัวเอน}\\
\textbf{\textit{ป้า กะ ปู่ กู้อีจู้ ตัวหนาเอียง}}\\
%%\texttt{ป้า กะ ปู่ กู้อีจู้ ไฟฟ้า ปัญญา ตัวพิมพ์}
xxxx xxxxx xxxxx
xxxx xxxxx xxxxx
%% \backmatter %% ใช้ไม่ได้ หายหมด
%% ยังไม่ดีมาก แต่ก็ได้ ก ข ค
\chapter{ทดสอบภาคผนวก} %% ---------------------
\chapter{ทดสอบภาคผนวกอีกที} %% ---------------------

You should see Thai language is working correctly, if not check if you system has Thai Sarabun font installed? You can download this official Thai font from SIPA

The main point is you’ll need to tell LaTeX to use Thai font
\usepackage{font spec} % To enable non-standard font selections
\setmainfont{TH SarabunPSK} % A font with Thai glyphs
\XeTeXlinebreaklocale ’th_TH’ % Thai-style word-breakings and line-wrappings

Enjoy Thai LaTeXing ^_^

For patients who are purchasing medicaments online, there are several substantial aspects that should be mature. Naturally there isn’t anything you can’t buy online anymore. Like many other medicinal products, Viagra is also classified according of it’s active element. Viagra is a remedy used to treat a lot of conditions. What do you already know about “buy generic cialis professional “? You may have heard about “generic cialis professional “. Questions, like “Cialis Soft “, refer to a lot of types of medicinal problems. Professionals feel that treating this health status on your own is unsafe. Ask everyone and he will answer that any remedy has side effects. Internet is a perfect way to find a pharmacist in your area who treats such dysfunction.