0% found this document useful (0 votes)
64 views

Thai Spec

This package allows inputting Thai characters directly into LaTeX documents using XeLaTeX. It uses the TH Sarabun New font by default but allows choosing other system fonts. The package requires certain LaTeX packages and recommends installing additional fonts. It provides options for changing fonts and settings like numbers, theorems, and font families. Examples demonstrate basic usage and adjusting options. Known issues involve listing packages, and credits note inspiration from other Thai LaTeX commands. The package is distributed under the LPPL license.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views

Thai Spec

This package allows inputting Thai characters directly into LaTeX documents using XeLaTeX. It uses the TH Sarabun New font by default but allows choosing other system fonts. The package requires certain LaTeX packages and recommends installing additional fonts. It provides options for changing fonts and settings like numbers, theorems, and font families. Examples demonstrate basic usage and adjusting options. Known issues involve listing packages, and credits note inspiration from other Thai LaTeX commands. The package is distributed under the LPPL license.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

The thaispec package:

Thai language typesetting in XƎLATEX


Ratthaprom Promkam
[email protected]

Version 0.2 from February 25, 2018

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}

This will typeset the document by setting mainfont to TH Sarabun New.


The package also predefines \today and \Today for today Thai date printing in
short and long formats respectively.

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.

Table 1: Loading options in thaispec package.

Options Features

thainum Uses Thai numbers for almost all number


digits. It is untoggled by defalut.

math Additionally load the following packages:


mathtools, amssymb, amsthm,
mathspec orderly.
Normally thaispec package loads
fontspec with no-math option. If
your document consists of math objects,
this option is then recommended.

2
Table 1: (continued) Loading options in thaispec package.

Options Features

thaifont = <SYSTEM_FONT_NAME> Choose a system font for Thai characters.


Example:
thaifont = TH Sarabun New

mainfont = <SYSTEM_FONT_NAME> Choose a font for mainfont corre-


sponding to fontspec package.
Example:
thaifont = TeX Gyre Termes

sansfont = <SYSTEM_FONT_NAME> Choose a font for sansfont corre-


sponding to fontspec package.
Example:
thaifont = TeX Gyre Heros

monofont = <SYSTEM_FONT_NAME> Choose a font for monofont corre-


sponding to fontspec package.
Example:
thaifont = TeX Gyre Cursors

thaithm = <BOOL> After loading amsthm package,


thaispec package automatically
defines a set of theorem-like en-
vironments with Thai heading by
default. The automatic defined envi-
ronments includes theorem, lemma,
corollary, definition, axiom,
undefinedterm, example, remark
and note. If you prefer to set them
yourself, just set its value to false.
Example:
thaithm = true

thmcount = <VALUE> If the option thaithm = true is


prefered, this package set the counter
independently for each automatic defined
environments. The value of <VALUE>
can be one of the following: default,
no, full, section, chapter,
kind, kind-section, and kind-
chapter.
Example:
thmcount = default

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.

You might also like