LaTeX for the Thai Language
Trying to use the Thai language in parallel with all of the stuff (code listing, maths environment, etc.) in LaTeX can induce pain.
This is my LaTeX for Thai script “starter kits” for those who want to get started typing LaTeX documents in Thai but don’t know where to begin.
Note:
- For those who haven’t even installed LaTeX things in Windows, please refer to this page. To be honest, I found that working with LaTeX in VS Code is the most comfortable way to do things (auto-completion, beautiful dark-mode, very friendly GUI, etc.) Also, installing MikTeX with Strawberry Perl is much faster (less than 15 minutes with normal internet) than installing TeX Live (more than 2 hours, for real?)
-
Since Thai-script LaTeX needs XeLaTeX to compile the file, I recommend that you make that the default. In VS Code, use the shortcut
CTRL + SHIFT + P
and search forPreferences: Open User Setting (JSON)
. Then, add the following parameter:"latex-workshop.latex.tools": [{ "name": "latexmk", "command": "latexmk", "args": [ "-xelatex", "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "%DOC%" ] }]
- If you have problems with the font “TH Sarabun New”, try “Install for all users” when you install the font in Windows.
- Normally, VS Code will compile your TeX file every time you save it. (If you have followed all of the steps on this page.)
- Please note that, unlike many Thai LaTeX preambles that I found so far, my LaTeX preamble does not contain
polyglossia
package. I find it to be a pain in my a$$. It has a lot of problems when used in parallel with thelisting
package.