Thai Spec
Thai Spec
This package allows you to input Thai characters directly to LATEX documents and
choose any (system wide) Thai fonts for typesetting in XƎLATEX. It also tries to appro-
priately justify paragraphs with no more external tools.
Contents
1 Prerequisite 1
2 Recommendation 2
3 Package loading 2
4 Loading options 2
5 Usage Examples 4
6 Known Issues 4
7 Credits 4
8 License 5
1 Prerequisite
The package use TH Sarabun New font by default to typeset Thai characters which
included in the collection of Thai national fonts 1 . At least this font must be installed
to system wide in order to use this package. Moreover the following LATEX package
are essentially required for the default option: fontspec, ucharclasses, poly
glossia, setspace, datetime2, kvoptions, afterpackage, xstring,
and xpatch.
1 Thai national fonts, a.k.a. SIPAFonts. See https://github.com/epsilonxe/sipafonts
1
2 Recommendation
Install the collection of Thai national font said above and also TEX Gyre font family
which possibly already included with your TEX distribution. These are basically as-
sumed to be installed prior loading the package.
3 Package loading
In the preamble, add the command
\usepackage{thaispec}
then you can input Thai characters in the document and typeset the document as usual.
By default the package set thaifont to TH Sarabun New, while set mainfont,
sansfont and monofont to TEX Gyre fonts.
In case TEX Gyre font family is not system wide installed, the package should be
loaded with the following option:
\usepackage[texgyrefont = false]{thaispec}
4 Loading options
This section lists additional loading options by their features as follows. The examples
in the list are default and also initialized values for those options.
Options Features
2
Table 1: (continued) Loading options in thaispec package.
Options Features
3
5 Usage Examples
The following example is a basic example of using thaispec package. It is loaded
with the default setting for typesetting in XƎLATEX, i.e., only Thai characters are typeset-
ted with TH Sarabun New font, other charaters are typesetted with TEX Gyre fonts,
and paragraphs are justified by \sloppy macro.
1 \documentclass{article}
2 \usepackage{thaispec}
3 \begin{document}
4 \section{ภาษาไทย}
5 ทดสอบการพิมพภาษาไทยในเอกสาร \XeLaTeX
6 \end{document}
In order to use another Thai font face for any charaters in a math document without
\sloppy macro, the following example can be used to achieve the goal.
1 \documentclass{article}
2 \usepackage[math,
3 thaifont = Tahoma,
4 texgyrefont = false,
5 sloppy = false]{thaispec}
6 \begin{document}
7 \section{Math ภาษาไทย}
8 การพิมพภาษาไทยในเอกสาร $ax^2+bx+c=0$
9 \end{document}
6 Known Issues
Incorrect Thai characters with listing package
If you typeset some codes consisting of Thai characters in lstlisting environment
provided by listing package, this will possibly cause you a problem with incor-
rect Thai characters. The recommendation is choosing minted package instead of
listing package. However you need to additionally install pygments python mod-
ule in order to use minted package.
7 Credits
This package is motivated by a set of LATEX commands for typesetting Thai documents
provided by Dittaya Wanvarie 2 from Chulalongkorn University.
2 See http://pioneer.netserv.chula.ac.th/~wdittaya/ in LATEX section.
4
8 License
This work may be distributed and/or modified under the conditions of the LaTeX Project
Public License, either version 1.3 of this license of (at your option) any later version.
The latest version of this license is in
http://www.latex-project.org/lppl.txt
and version 1.3 or later is part of all distributions of LaTeX version 2005/12/01 or later.