Hi,

The attachement is the first draft of "how to set up lyx to write Thai
document".

I have the translated version in Thai too, but would like to get the format
on this one corrected first.


regards,

Chanop

p.s. it was prepared with lyx-1.1.6fix1
-- 
 ##########################################
 #Chanop Silpa-Anan                       #
 #gpg @ http://dynax.anu.edu.au/chanop.asc#
 ##########################################
#LyX 1.1 created this file. For more info see http://www.lyx.org/
\lyxformat 218
\textclass article
\language english
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize default
\spacing single 
\papersize Default
\paperpackage widemarginsa4
\use_geometry 0
\use_amsmath 0
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle empty

\layout Title


\series bold 
LyX-Thai-microHOWTO
\layout Author

by Chanop Silpa-Anan <[EMAIL PROTECTED]>
\layout Date

20th February 2001
\layout Section

Introduction
\layout Standard

This article is a short introduction about 
\begin_inset Quotes eld
\end_inset 


\emph on 
How to use LyX in writing a Thai document
\emph default 

\begin_inset Quotes erd
\end_inset 

.
 This document is written based on LyX version 1.1.6fix1.
 There are two major things to do in order to write Thai in LyX; setting
 up LyX, and setting up LaTeX.
 You may find an up--to--date version of this document at 
\family sans 
http://dynax.anu.edu.au/linux/
\family default 
.
\layout Section

Setting Up LyX
\layout Standard

There are two things that you need to set up in order to type (and see)
 Thai in LyX,
\layout Itemize

Thai font,
\layout Itemize

and Thai keyboard.
\layout Subsection

Thai Font
\layout Standard

LyX use system fonts from X window system
\begin_float footnote 
\layout Standard

The author uses LyX on X window system on Linux.
\end_float 
, therefore, you need to install some Thai fonts for X in order to use them
 in LyX.
 You may use native X font (
\family typewriter 
.bdf
\family default 
 and 
\family typewriter 
.pcf
\family default 
 format), Type 1 font, or True Type font.
 Consult 
\begin_inset Quotes eld
\end_inset 


\emph on 
Font-HOWTO
\emph default 

\begin_inset Quotes erd
\end_inset 

 and 
\begin_inset Quotes eld
\end_inset 


\emph on 
TT-Debian mini HOWTO
\emph default 

\begin_inset Quotes erd
\end_inset 

 for more details about installing font.
 You may wish to browse 
\family sans 
http://dynax.anu.edu.au/linux/
\family default 
 and 
\family sans 
http://linux.thai.net/
\family default 
 for more information on setting up Thai fonts.
\layout Standard

Personally I use Thai True Type font with X and LyX.
 If you have problem setting up Thai True Type font (which is not really
 a straight forward task yet), you may drop me an email.
 I am willing to help.
 
\layout Standard

There are several Thai X fonts around.
 I have some Thai fonts packaged for 
\emph on 
Debian
\emph default 
.
 These packages starts to appear in Debian since Woody (not yet release
 at the time of writing).
 Here is the URL that you may find some Thai fonts, 
\family sans 
ftp://opensource.thai.net/pub/linux-tle/SOURCES/
\family default 
.
\layout Standard

You have to tell LyX to use Thai font for displaying the document.
 In LyX 1.1.6, you can do that by selecting 
\family sans 
\bar under 
E
\bar default 
dit
\family default 
\SpecialChar \menuseparator

\family sans 
\bar under 
P
\bar default 
references,
\family default 
 
\family sans 
Look\SpecialChar ~
&\SpecialChar ~
Feel
\family default 
 tab, 
\family sans 
Screen\SpecialChar ~
Fonts
\family default 
 tab, and selecting Thai fonts for 
\family sans 
Roman
\family default 
, 
\family sans 
Sans\SpecialChar ~
Serif
\family default 
, and 
\family sans 
Typewriter
\family default 
 fonts.
 
\family sans 
Encoding
\family default 
 should be 
\emph on 

\begin_inset Quotes eld
\end_inset 


\emph default 
tis620
\emph on 
-0
\emph default 

\begin_inset Quotes erd
\end_inset 

 according to the current standard.
 You may set up these settings in 
\family typewriter 
~/.lyx/lyxrc
\family default 
 like I do by putting the following lines in the file.
\layout LyX-Code


\backslash 
screen_font_roman "-*-angsanaupc" 
\layout LyX-Code


\backslash 
screen_font_sans "-*-cordiaupc" 
\layout LyX-Code


\backslash 
screen_font_typewriter "-*-courier monothai"
\layout LyX-Code


\backslash 
screen_font_encoding tis620-0
\layout Subsection

Thai Keyboard Map
\layout Standard

I contribute Thai Kedmanee
\begin_float footnote 
\layout Standard

I choose to use Kedmanee instead of Kesmanee (which might be a proper translatio
n, however they have similar pronunciation) because my cousin name in English
 is 
\noun on 
Kedmanee
\noun default 
 (beautiful actress).
\end_float 
 keymap (
\family typewriter 
thai-kedmanee.kmap
\family default 
) to LyX which should be included in the distribution since LyX-1.1.6fix2.
 If you cannot find the keymap in your LyX distribution, you may find it
 at 
\family sans 
http://dynax.anu.edu.au/linux/
\family default 
.
\layout Standard

You can set up Thai Kedmanee keymap by using 
\family sans 
\bar under 
E
\bar default 
dit
\family default 
\SpecialChar \menuseparator

\family sans 
\bar under 
P
\bar default 
references
\family default 
, 
\family sans 
Lang\SpecialChar ~
Opts
\family default 
 tab, 
\family sans 
Language
\family default 
 tab, and check on the 
\family sans 
\bar under 
K
\bar default 
eyboard\SpecialChar ~
map
\family default 
.
 You may select 
\begin_inset Quotes eld
\end_inset 

null
\begin_inset Quotes erd
\end_inset 

 as the 
\family sans 
\bar under 
1
\bar default 
st
\family default 
 keymap and 
\begin_inset Quotes eld
\end_inset 

thai-kedmanee
\begin_inset Quotes erd
\end_inset 

 as the 
\family sans 
\bar under 
2
\bar default 
nd
\family default 
 keymap.
 On the other hand, you can put the following settings in 
\family typewriter 
~/.lyx/lyxrc
\family default 
.
\layout LyX-Code


\backslash 
kbmap true
\layout LyX-Code


\backslash 
kbmap_primary null
\layout LyX-Code


\backslash 
kbmap_secondary thai-kedmanee
\layout LyX-Code


\backslash 
bind 
\begin_inset Quotes eld
\end_inset 

C-backslash
\begin_inset Quotes erd
\end_inset 

 
\begin_inset Quotes eld
\end_inset 

keymap-toggle
\begin_inset Quotes erd
\end_inset 


\layout Standard

In the above, I bind 
\family sans 
C--backslash
\family default 
 for toggling Thai Kedmanee keyboard and native keyboard map.
 This 
\family sans 
C--backslash
\family default 
 is similar to Emacs usual key binding for selecting input method.
 You may use 
\family sans 
M--k\SpecialChar ~
1
\family default 
 to select primary keymap, and 
\family sans 
M--k\SpecialChar ~
2
\family default 
 to select secondary keymap according to current default LyX key binding.
\layout Section

Setting Up LaTeX
\layout Standard

You need the Thai Babel LaTeX implementation in order to 
\emph on 
really
\emph default 
 write a Thai document with LyX.
 You can the Thai LaTeX at 
\family sans 
ftp://opensource.thai.net/pub/linux-tle/SOURCES/
\family default 
.
 
\layout Standard

After downloading, it is just a matter of,
\layout LyX-Code

unpack the tarball && cd
\layout LyX-Code

./configure
\layout LyX-Code

make
\layout LyX-Code

make install
\layout Standard

You might have to specify some parameters (where your TeX is) during 
\family typewriter 
./configure
\family default 
.
 Consult the package documentation for more information.
\layout Standard

If you are using Debian, thailatex package will be available shortly.
 You can use 
\family typewriter 
apt
\family default 
 to download and install binary and source package from my site by putting
 the following line in your 
\family typewriter 
/etc/apt/sources.list
\family default 
,
\layout LyX-Code

deb http://dynax.anu.edu.au/debian sid thailatex
\layout LyX-Code

deb-src http://dynax.anu.edu.au/debian sid thailatex
\layout Standard

You can use ftp protocol instead of http if you like.
\layout Standard

In order for LaTeX to break the sentence in Thai language properly, it needs
 a word separator program.
 Nectec (
\family sans 
http://www.nectec.or.th/
\family default 
)
\layout Standard

Thai LaTeX needs word separator program.
 Nectec 
\begin_inset LatexCommand \url{http://www.nectec.or.th/}

\end_inset 

, distributes swath as binary rpm for linux i386 at 
\family sans 
ftp://opensource.thai.net/pub/linux-tle/3.0/TLE/
\family default 
.
 I use 
\family typewriter 
alien
\family default 
 to convert swath from 
\family typewriter 
.rpm
\family default 
 to 
\family typewriter 
.deb
\family default 
.
 I heard a rumor that swath will be released in source form very soon.
\layout Standard

The other word separator program that can be used is 
\family typewriter 
cttex
\family default 
.
 You can download it from 
\family sans 
http://thaigate.rd.nacsis.ac.jp/files/ttex.html
\family default 
.
 Since 
\family typewriter 
cttex
\family default 
 was written for the other implementation of Thai LaTeX, you cannot use
 this program directly.
 However, 
\family typewriter 
cttex
\family default 
 in HTML mode works like swath.
 What you need to do is to patch it such that it use 
\family typewriter 

\begin_inset Quotes eld
\end_inset 


\backslash 
wbr\SpecialChar ~

\begin_inset Quotes eld
\end_inset 


\family default 
 instead of 
\family typewriter 

\begin_inset Quotes eld
\end_inset 

<WBR>
\begin_inset Quotes erd
\end_inset 


\family default 
 for breaking Thai words.
 I'm asking the author of 
\family typewriter 
cttex
\family default 
 to put a proper license on the software so that I can redistributed the
 patched code.
\layout Section

Writing Thai Documents with LyX
\layout Standard

After you have set up Thai fonts and Thai LaTeX according to article previous
 sections in this article, you may use LyX to write Thai documents according
 to the following tips (procedure).
\layout Enumerate

Set 
\family sans 
\bar under 
L
\bar default 
ayout
\family default 
\SpecialChar \menuseparator

\family sans 
\bar under 
D
\bar default 
ocument,
\family default 
 
\family sans 
Language
\family default 
 pop up, 
\family sans 
Language
\family default 
 option to 
\begin_inset Quotes eld
\end_inset 

thai
\begin_inset Quotes erd
\end_inset 


\begin_float footnote 
\layout Standard

If you cannot do this, upgrade to the latest LyX (1.1.6fix2 or later).
 I sent the patch to LyX before the release of 1.1.6fix2.
\end_float 
\layout Enumerate

Set 
\family sans 
\bar under 
L
\bar default 
ayout
\family default 
\SpecialChar \menuseparator

\family sans 
\bar under 
D
\bar default 
ocument,
\family default 
 
\family sans 
Language
\family default 
 pop up, 
\family sans 
Encoding
\family default 
 option to 
\begin_inset Quotes eld
\end_inset 

default
\begin_inset Quotes erd
\end_inset 


\begin_float footnote 
\layout Standard

There is no input encoding (inputenc package) for Thai language yet.
\end_float 
\layout Enumerate

Export your document to latex by 
\family sans 
\bar under 
F
\bar default 
ile
\family default 
\SpecialChar \menuseparator

\family sans 
\bar under 
E
\bar default 
xport
\family default 
\SpecialChar \menuseparator

\family sans 
\bar under 
L
\bar default 
atex
\family default 
.
 And compile the 
\family typewriter 
.tex
\family default 
 file as follow,
\begin_float footnote 
\layout Standard

I will try to find how to do this within LyX.
\end_float 
\layout LyX-Code

swath -f latex < exportdoc.tex > exportdoc.ttex
\layout LyX-Code

latex exportdoc.ttex
\layout Standard

or
\layout LyX-Code

cttex -W < exportdoc.tex > exportdoc.ttex
\layout LyX-Code

latex exportdoc.ttex
\layout Section

Conclusion
\layout Standard

I have been happily writing Thai document with LyX for a while already.
 I wish you enjoy writing Thai document with LyX too.
\layout LyX-Code

\the_end

Reply via email to