Next Previous Contents

3. Applications with Thai language

This is the tricky part. Most applications support ISO-8859-1 character set. For example, emacs can display ISO-8859-1 character. If we set emacs to display ISO-8859-1 and use Thai font, you can edit Thai document with emacs. But this is not a good policy. You should avoid using this trick as possible. What we need is Thai locale or Thai supported applications to manage these things.

To make X window application displays Thai font, you should run the application with -fn option. For example,

%xedit -fn thai8x16
Note that thai8x16 is just a one of Thai font names. You can see all available fonts by command xlfonts. If you don't want to fill -fn option every time you run application. You should set Thai font in your ~/.Xdefaults or ~/.Xresources like this

XTerm*font:     thai8x16

3.1 Some X applications and Thai language


txterm is Thai version of xterm. There are several programs running under xterm such as shell, pine, vi, less, etc. We can type Thai characters without any problems with txterm. Txterm also provides its own Thai input method by pressing " F1 " key. Txterm will use fonts thai9x13 as default Thai font. You can change this by add -fn option.

You can get txterm from Thaigate or ZzzThai.

bash shell :

Normally, shell accepts only ASCII character set. To type Thai characters in shell command line, you should set environment LC_CTYPE to iso_8859_1.

I don't set LC_CTYPE environment variable to iso_8859_1 because this environment variable will effect other applications too. With bash shell, you can specify which environment variable to be passed to the application. For example, I can make a fake Thai X terminal with this syntax.

LC_CTYPE=iso_8859_1 xterm -fn thai8x16
This xterm display Thai characters well, but not good for typing Thai characters. I strongly recommend you to use txterm.

ls :

If you name a filename in Thai. Issue the command as

ls -N 

You may set alias in ~/.bashrc or ~/.cshrc, so you can type ls without option. If you don't use ls with -N option, you may see Thai filename as ?????.

Emacs, Mule

Mule stands for " Multilingual Enhancement to GNU Emacs " . It has the same functions as emacs and supports many languages. Mule provides its own input method, so you don't need any configuration for typing Thai. You needs only Thai fonts for mule which you can get from, ZzzThai or Etl site. These Thai fonts are fixed width fonts.

You need some configuration for mule. Puts the following lines in your .emacs.

;; Thai System, add in .emacs
(set-file-coding-system-for-read '*tis620*)
(set-default-file-coding-system '*tis620*)
(set-display-coding-system '*tis620*)
(set-keyboard-coding-system '*tis620*)
(setq-deafault quail-current-package (assoc "thai" quail-package-alist))
Add the following lines in .Xdefaults.

! Emacs, Mule - Font menu
Emacs*FontSetList: thai14, thai16, thai24

When you hold shift key and press left mouse's button, you can select Thai fonts to display in mule window. To type Thai characters, press " Ctrl + ] " . To type English, press " Ctrl + ] " again.

You can get mule from ElectroTechnical Laboratory(ETL)


Vi should be run on txterm.


In the past, we could not send 8-bit characters through E-mail. Now, although mail transfer agent can handle 8-bit characters but some old mail transfer agent can not. We can send Thai e-mail by using e-mail application that supports MIME (Multipurpose Internet Mail Extensions) E-mail applications that support MIME are pine, elm, Netscape mail, etc.

Put the following definition in your ~/.pinerc file:

This can also be set via the Setup option in pine window. You can find it under Config. You can read Thai news from pine, too.

Pine should be run in txterm.


If you have Thai fonts in your system. Just set Thai font from preference. Thai fonts will appear in User defined area. See for setting Thai language on Netscape.

Some movement about Thai Mozilla project at

Ss, Simple thai word Separator

ss is a dictionary based Thai word separation program similar to cttex. It can be used to insert a configurable string between Thai words. It can also show words that cannot be found in the dictionary. More words can be added to the dictionary. Developed by Mr.Teera Kittichareonpot.

We can use this program to insert < WBR > tag between Thai words in html file. Browser will display Thai homepage better than normal html document.

Xzthai, X keyboard configurator + simple editor

Xzthai, this is the Tcl/Tk application for mapping Thai keyboard on any keyboard with graphical user interface. Also provides simple editor and keyboard layout figure. It actually uses xmodmap program in background to map Thai keyboard. This may be useful for commercial X server and X server on UNIX.

3.2 Printing Thai document

Thai2ps is used to convert plain text file to postscript file.You can use ghostscript(gs) to print your Thai document. For better quality document, you have to use (La)TeX.

Latex and Thai language

Dr. Manop Wongsaisuwan first tried to use Thai language with latex. He wrote some perl script as filter for latex source code that contains Thai language. Then pass the result to latex. Mr. Vuthichai Ampornaramvech used this concept and wrote a program in C language, cttex, to handle this. It runs faster and makes Thai word segmentation based on dictionary. Cttex also fixes the position of Thai characters in word, so SARA and WANNAYUK will be placed in the beautiful position.

You can find Thai latex filter from

Latex's configuration for Thai language

You must have latex installed in your computer. First, download Thai postscript (Type1) fonts, tfm fonts and Thai style file. These fonts are needed by Latex. This is the list of files you should download.

tfm fonts:
    dbtt.tfm    dbttb.tfm   dbttbi.tfm  dbtti.tfm
postscript fonts:
    dbtt.pfa    dbttb.pfa   dbttbi.pfa  dbtti.pfa
style files:
    thai.sty sakka.sty 
Thai Latex filter:
Sample Latex file:
    ttex.ttex test.ttex

There is latex's directory at /usr/lib/texmf/texmf/ (RedHat 5.0). I will call /usr/lib/texmf/texmf/ as " $texroot " . We will concentrate at $texroot/texmf/ directory. In $texroot/texmf/ directory, there are many files about tex's configuration. You have to edit files in dvips, fonts, tex subdirectories.

Add the following lines to $texroot/texmf/dvips/misc/

dbtt  DBThaiText <dbtt.pfa
dbttb DBThaiTextBold <dbttb.pfa
dbttbi DBThaiTextBoldItalic <dbttbi.pfa
dbtti DBThaiTextItalic <dbtti.pfa

Make a new directories and copy files to the appropriate directories.

%mkdir /usr/lib/texmf/texmf/fonts/tfm/public/thai
%mkdir /usr/lib/texmf/texmf/fonts/type1/public/thai
%mkdir /usr/lib/texmf/texmf/tex/generic/thai
%cp *.tfm /usr/lib/texmf/texmf/fonts/tfm/public/thai
%cp *.pfa /usr/lib/texmf/texmf/fonts/type1/public/thai
%cp *.sty /usr/lib/texmf/texmf/tex/generic/thai

Run texhash or MakeTeXls-R(in some system) to update Tex database.

texhash: updating /usr/lib/texmf/texmf/ls-R ...
texhash: Done.

Use Thai LaTeX filter

We can use cttex as filter like this,

%cttex < ttex.ttex > ttex.tex
C-TTeX $Revivsion: 1.15 $
Usage : cttex [cutcode] < infile > outfile
Usage : cutcode=0 forces operation in HTML mode.
Build-in dictionary size: 9945 words
%latex ttex.tex
%xdvi ttex.dvi
You can convert dvi file to postscript file by,

%dvips -o ttex.dvi

Finally, you can print by using gs or lpr. You must configure printer before printing. See man-pages of printcap, gs, lpr for more information.

Editing LaTex source file

For new latex user, lyx is helpful. But I recommend to use mule to edit Thai latex source file because mule supports Thai language and it is a powerful editor. You may take a look a Thai Latex tutorial.

3.3 X Application Resources

Because Xt based applications allow user to configure the applications by resources. We can make the menu or label to be Thai language.

For example, if you want xman to display Thai labels. You may add these lines in your .Xdefaults

!!  Xman section
Xman*Font:                          thai8x16
Xman*helpButton.Label:              ช่วย
Xman*quitButton.Label:              ออก
Xman*manpageButton.Label:           คู่มือการใช้

You can use the same idea to set window manager to be more Thai environment too.

3.4 Thai Extension for Linux (TE)

Thai Extension for Linux is a installation package comes with applicaions and Thai fonts. You don't have to configure Linux system and applications by yourself. Let TE do configuration task for you. After installation, you can use Thai language suddenly. Get TE from

Next Previous Contents