Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

LATEX

<poonlap

at linux.thai.net>

: ..
: ..
: ..

.. 2541 [1] .
sgml html, latex . .. 2546
LATEX Thai Linux
Working Group. LATEX
. .
1) , 2) 3)
. .
:
http://linux.thai.net/cgi-bin/viewcvs.cgi/docs/thailatex doc/
PDF:
http://linux.thai.net/plone/TLWG/thailatex/

TEX

LATEX

2.1
3

LAT

EX

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

LATEX
3.1 . .
3.2 LATEX . . .
3.3 - Class file . . .
3.4 - package . . . .
3.5 LATEX

4
4

.
.
.
.
.

5
5
5
5
6
6

LATEX
4.1 TFM (TEX Font Metric) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7
7

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

4.2
4.3
4.4
4.5
4.6

.......
GF (Glyph Font) . . . . . .
PK (Packed Font) . . . . .
AFM (Adobe Metric Font) .
Type1 . . . . . . . . . . .

.
.
.
.
.

7
7
7
7
7

LATEX

tTEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cttex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ThaiLATEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7
8
8
8

METAFONT

5.1
5.2
5.3
6

7.1
7.2
7.3
7.4
7.5

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

ThaiLATEX

. . . . . . .
. . . . . . . . . . . . .
latex . . . . . .
DVI . . . . . . . . . . .
PostScript PDF

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

9
9
10
11
11
12

8.1 . . . . . . . . . . . . . . . . . . . . .
8.2 . . . . . . . . . . . . . . . . . . . . . .
8.3 , .
8.4 . . . . . . . . . . . . .

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

13
13
14
16
16

LATEX

LATEX

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

17

10

17

LATEX .ttx
.1 .ttx . . . . . . . . . . . . . . . . . . . . . . . . .

18
19

19

20

21

21

1
2

LATEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2

5
10


3
4

dia . . . . . . . . . . . . . . . . . . . . . . . . . . .
gnuplot . . . . . . . . . . . . . . . . . . . . . . . .

19
20

1
2
3
4

LATEX
LATEX . . . . . . . . .
. . . . . . . . . .
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

6
14
15
15

LATEX

1 TEX
TEX[2] (typesetter) Donald Knuth Stanford
..1977. The TEX book TEX TEX is a new typesetting system
intended for the creation of beautiful books - and especially for books that contain a lot of mathematics. By
preparing a manuscript in TEX format, you will be telling a computer exactly how the manuscript is to be
transformed into pages whose typographic quality is comparable to that of the worlds finest printer.
TEX (word processor) WYSIWYG - What You See
Is What You Get. TEX LATEX .
, . TEX
, tex ,
dvi (device independent). TEX.
dvi . dvi
. , X Window xdvi,
PostScript dvips PostScript .

LATEX

, TEX Leslie Lamport[3]


TEX. LATEX TEX . Knuth
TEX , LATEX . LATEX
..1985 . LATEX LATEX 2
LATEX3. LATEX LATEX ,
LATEX [4].
LATEX

2.1

LATEX
TEX LATEX LATEX.

, .
TEX LATEX http://www.tug.org

LATEX

(platform) Windows, Mac, UNIX .


LATEX (human readable)
.
, (device independent).
TEX , limn

Pn

1
k=1 k2

TEX LATEX.
Kerning .1
algorithm hyphen .2
PostScript PDF (Portable Document Format).
1
2 hyphen

Kerning

2
6

LATEX

3 LATEX
(.tex)

.aux
.idx
.toc
.lof
.lot

Format file (.fmt)


Class and package file (.cls, .sty)
Font metrics (.tfm)
Font definition (.fd)

LaTeX

Transcript file (.lis, .log)

(.dvi)

PS

Poscript

1: LATEX

3.1

LATEX dvi.

1 LATEX

.
.tex.3 (text editor)
emacs vi. , latex .
texmf , . latex
.aux, .idx, .toc . .dvi
.

3.2

LATEX

1 LATEX .
/usr/share/texmf $TEXMF.
.

3.3

- Class file

(.cls) . (book.cls),
(report.cls), (article.cls) (letter.cls).
3
.ttx

.tex .
5

3.4 - package

LATEX

LATEX input file


.tex, .ltx
A
L TEX input file () .tex .ttx
TEX formatted output file
.dvi
TEX transcript file
.log, .texlog, .lis, .list
METAFONT sources file
.mf
Font definition file
.fd
Font image file
.pk
Font metrics file
.tfm
String pool file
.pool, .poo, .pol
Format file
.fmt
A
L TEX layout, structure file
.clo, .cls, .dtx, .sty
A
L TEX auxiliary file
.aux
Table of contents file
.toc
List of figures file
.lof
List of tables file
.lot
BibTEX related files
.bbl, .bib, .blg, .bst
Index and MakeIndex related files
.idx, .ilg, .ind, .ist
1: LATEX
\documentclass :
\documentclass{article}

3.4

- package

(.sty) (style file)


. \usepackage :
\usepackage[thai]{babel}
\usepackage{a4}

babel .
A4.

3.5

LATEX

.
.tex.
. , .ttx
.tex .

LATEX

4 LATEX
LATEX TFM, VF, METAFONT.

4.1

TFM (TEX Font Metric)

.tfm, . , , ,
. tex dvi driver (xdvi, dvips, ).
METAFONT pltotf. TFM AFM (Adobe Font Metric)
afm2tfm. Norasi, Garuda DBThaiText.

4.2

METAFONT

METAFONT TEX . Knuth METAFONT (series) The TEX Book . TFM GF (Glyph Font)

MF.

4.3

GF (Glyph Font)

GF (bitmap) .
(resolution).

4.4
GF.

4.5

.gf

.gf

PK (Packed Font)
PK GF (compress) gstopk.

AFM (Adobe Metric Font)

AFM metric PostScript . TFM afm2tfm.


AFM Type1 pf2afm.

4.6

Type1

PostScript .
(a = ascii, b = binary)

LATEX

.pfa

.pfb. .pfa

.pfb

LATEX (end-user)
LATEX , LATEX , LATEX LATEX
.
.
LATEX Typesetter
ThaiTeX ,
2538. LATEX .
LATEX . LATEX
.
7

LATEX

5.1

tTEX

TEX USL RMIT .


USL METAFONT .tfm .pk
TEX USL METAFONT
RMIT macro .
.

5.1

tTEX

.. 1993 [6] LATEX


Tokyo Institute of Technology (TIT) . AFM
TFM perl script ttex 8 7 (LATEX
8 ) .
. filter LATEX .
dvi. dvips dvi PostScript .
ttex , X window , 7
(macro) TEX .

5.2

cttex

, [5] ttex filter C cttex.


ttex. .
.pk PostScript gsf2pk . (preview) X
window . macro thai.sty . LATEX 8
7 . ThaiLATEX
LATEX.
1998 LATEX . LATEX
LATEX . LATEX PostScript(Type1)
.pk xdvi gsf2pk Type1 .pk
.pk .

5.3

ThaiLATEX

..1999 ThaiLATEX
Babel .
DBThaiText Norasi LATEX . cttex
New Font Selection System (NFSS), Bebel .
. cttex ,
ThaiLATEX Ligature LATEX .
LATEX . cttex ,
swath .
ThaiLATEX Thai Linux Working Group .
, , . ThaiLATEX
http://linux.thai.net/cvs

LATEX

6 ThaiLATEX
(package) ThaiLATEX CVS
4
$ export CVSROOT=:pserver:anonymous@linux.thai.net:/home/cvs
$ cvs login
Logging in to :pserver:anonymous@linux.thai.net:2401/home/cvs
CVS password: *** ***
$ cvs co software/thailatex
$ cvs co software/cttex
$ cvs co software/swath

ThaiLATEX, swath cttex root


#
#
#
#
#
#
#
#
#
#
#
#

cd software/thailatex
./autogen.sh
./configure
make; make install
cd ../swath
./autogen.sh
./configure
make; make install
cd ../cttex
make
cp cttex /usr/bin
gzip cttex.1 > /usr/share/man/man1/cttex.1.gz

, Thai Linux Working Group (TLWG), http://linux.thai.net.

7 LATEX
7.1

LATEX .ttx
. (editor) vi,
emacs, gedit . (encode) TIS-620.
UTF-8 iconv .
$ iconv -f UTF-8 -t TIS-620 < FILE_UTF-8.ttx > FILE_TIS-620.ttx

emacs ( 2).
. LATEX
.

latex-mode

LATEX

7.2

.ttx latex
. LATEX swath cttex
LATEX .

2: emacs
thailatexfile.ttx
thailatexfile.tex, thailatexfile.dvi .

7.2

swath

$ swath -f latex < thailatexfile.ttx > thailatexfile.tex

cttex5 .
cttex .

cttex

swath.

$ cttex -W < thailatexfile.ttx > thailatexfile.tex


5 cttex

1.22 -W .

10

LATEX

7.3

latex

swath cttex {\wbr} .


{\wbr}{\wbr}. \wbr
(space) . LATEX ,
\wbr LATEX .
swath cttex, ( thailatexfile.tex)
( thailatexfile.ttx). .tex
. ,
.

7.3

latex

thailatexfile.tex . latex
--translate-file=cp8bit.tcx .
latex .tex .
$ latex --translate-file=cp8bit.tcx thailatexfile
This is TeX, Version 3.14159 (Web2C 7.3.1)
(thailatexfile.tex
LaTeX2e <2000/06/01>
Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, i
talian, nohyphenation, loaded.
(/usr/share/texmf/tex/latex/base/article.cls
Document Class: article 2000/05/19 v1.4b Standard LaTeX document class
(/usr/share/texmf/tex/latex/base/size10.clo))
......
[8] [9] (thailatexfile.aux)
LaTeX Font Warning: Some font shapes were not available, defaults substituted.
)
(see the transcript file for additional information)
Output written on thailatexfile.dvi (9 pages, 39252 bytes).
Transcript written on thailatexfile.log.

thailatexfile.dvi .
, .
--translate-file=cp8bit.tcx latex 8
bit. . alias
$ alias latex=latex --translate-file=cp8bit.tcx
$ latex thailatexfile

7.4

DVI

DVI dvi , dvi


.
11

LATEX

7.5

PostScript PDF

xdvi
xdvi

dvi X Window.

$ xdvi thailatexfile.dvi &

xdvi pk , MakeTeXPK pk (resolution)


.
dvips

dvi PostScript dvips


$ dvips -t a4 -Ppdf -o thailatexfile.ps thailatexfile.dvi

dvips PostScript
. -t a4 A4. -Ppdf
Type1. LATEX .
PDF .
PostScript gv, ggv, kghostview .

PostScript PostScript .
PostScript, ghostscript PostScript PDF
.
$ lpr thailatexfile.ps

$ lp thailatexfile.ps

7.5

PostScript PDF

PDF PostScript ps2pdf. ps2pdf


PDF .
$ ps2pdf thailatexfile.ps

PDF X Window xpdf, gv, ggv . Acrobat Reader


Adobe PDF . PDF LATEX
(presentation) .

12

8
.
EX LATEX 2 [7] .

LAT

% (comment)
\documentclass{article}
\usepackage[thai]{babel}
\usepackage{a4}
\begin{document}

.
\end{document}
LATEX (preamble) .
, . \begin{document}
\end{document}.

8.1

TEX \ .
\documentclass{article} . :
\documentclass[OPTION1,OPTION2,...]{CLASS}

.
\usepackage[thai]{babel}

thainumber thai.
.
\usepackage[thai,thainumber]{babel}

\usepackage
\usepackage[OPTION1,OPTION2,...]{PACKAGE}

graphics EPS
. LATEX http://www.tug.org.
% (comment). % .
, :
LATEX

\title{TITLE}
\author{AUTHOR_NAME}
\date{DATE or \today{}}

, \maketitle .

13

8
Class
book
report
article

(option)
10pt
11pt
12pt
a4paper
a5paper
b5paper
b4paper
landscape
twoside
oneside
onecolumn
twocolumn
titlepage
notitlepage
draft
final
leqno
fleqn

8.2

10 point
11 point
12 point
A4 ( letter)
A5
B5
B4

()
2
( book, report)
( article)

()
()
(
)

2: LATEX

8.2

\begin{document} \end{document}.

\begin{document}
....
content
....
\end{document}

6 (Kinnari), (Norasi), (Garuda), DBThaiText,


PseudoMono (Purisa) 3. PseudoMono monospace
. .

LATEX \Huge,
\huge, \LARGE, \Large, \large, \normalsize, \small, \footnotesize, \scriptsize \tiny.
:
14

(postscript)
Kinnari
KinnariBold
KinnariItalic
KinnariBoldItalic
Norasi
Norasi-Bold
Norasi-Italic
Norasi-BoldItalic
DBThaiText
DBThaiTextBold
DBThaiTextItalic
DBThaiTextBoldItalic
Garuda
GarudaBold
GarudaItalic
GarudaBoldItalic
PseudoMono
PseudoMonoBold
PseudoMonoItalic
PseudoMonoBold
Purisa

8.2

, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,

\usefont{LTH}{kinnari}{m}{n}
\usefont{LTH}{kinnari}{b}{n}
\usefont{LTH}{kinnari}{m}{it}
\usefont{LTH}{kinnari}{b}{it}
\usefont{LTH}{norasi}{m}{n}
\usefont{LTH}{norasi}{b}{n}
\usefont{LTH}{norasi}{m}{it}
\usefont{LTH}{norasi}{b}{it}
\usefont{LTH}{dbtt}{m}{n}
\usefont{LTH}{dbtt}{b}{n}
\usefont{LTH}{dbtt}{m}{it}
\usefont{LTH}{dbtt}{b}{it}
\usefont{LTH}{garuda}{m}{n}
\usefont{LTH}{garuda}{b}{n}
\usefont{LTH}{garuda}{m}{it}
\usefont{LTH}{garuda}{b}{it}
\usefont{LTH}{pmono}{m}{n}
\usefont{LTH}{pmono}{b}{n}
\usefont{LTH}{pmono}{m}{it}
\usefont{LTH}{pmono}{b}{it}
\usefont{LTH}{purisa}{m}{n}

,
,
,
,

,
,
,
,

, ,

3:

{\Huge \LaTeX{}

{\huge \LaTeX{}

LATEX
LATEX

}
LATEX
{\Large \LaTeX{} }
LATEX
{\large \LaTeX{} }
LATEX
{\normalsize \LaTeX{} }
LATEX
{\small \LaTeX{} }
LATEX
{\footnotesize \LaTeX{} } LATEX
{\scriptsize \LaTeX{} }
L TEX
{\tiny \LaTeX{} }

{\LARGE \LaTeX{}

LATEX

4:
15

8.3

8.3

, .
6 .
LATEX
LATEX




, , ,

,









8.4

LATEX makeindex latex


latex makeindex ( 1 ).
-T 7 . latex
--translate-file=cp8bit.tcx . (locale)
th TH.TIS-620.
% LANG=th_TH.TIS-620 makeindex -T thailatexfile
This is makeindex, version 2.14 [02-Oct-2002] (kpathsea + Thai support).
Scanning input file thailatexfile.idx....done (24 entries accepted,
0 rejected).
Sorting entries....done (111 comparisons).
Generating output file thailatexfile.ind....done (60 lines written,
0 warnings).
Output written in thailatexfile.ind.
Transcript written in thailatexfile.ilg.
6
7 makeindex

16

10
LANG=th TH.TIS-620 , LANG=th TH.TIS-620
makeindex .

9 LATEX
LATEX
LATEX 2 8
http://linux.thai.net/plone/Members/poonlap/latex/lshort.pdf
LATEX
http://linux.thai.net/thep/doc
Angsana ThaiLATEX
http://linux.thai.net/plone/Members/poonlap/latex/angsana.html
hyphenation patgen/opatgen
http://linux.thai.net/plone/Members/poonlap/latex/hyphenation

for Thai Ichris.


http://ichris.ws/latex

LATEX

LATEX 2 .
http://www.ie.eng.chula.ac.th/2004/staff/pramual/books/latex/
LYX/LATEX-Thai-microHOWTO
http://thai.rsise.anu.edu.au/linux/document/th LyX-Thai-microHOWTO/
MiKTeX Thai Extension Donzakh.
http://miktexthai.sourceforge.net/

10
Abiword, Koffice, OpenOffice, Pladao
. (layout). LATEX ,
LATEX .
LATEX.
, .
LATEX
.

8 http://www.ctan.org/tex-archive/info/lshort/english/lshort.pdf

17

LATEX

.TTX

LATEX

.ttx

.ttx .tex
1. \include{another file}9 another file.tex
. include
.
2. .tex latex
.
3. .

.tex . 10 .

.ttx

\usepackage{sverb}
\newcounter{filenum}
\makeatletter
\newenvironment{thwbr}%
{\verbwrite{\jobname.\thefilenum.th}}
{\endverbwrite
\@input@{\jobname.\thefilenum.wbr}
\stepcounter{filenum}}
\makeatother

environment thwbr. latex, environment


environment .th.
\begin{thwbr}
..... Thai paragraph, English or mixed .....
\end{thwbr}

latex ( cttex).
$ for th in *.th; do wbr=echo $th | sed s/\.th/\.wbr/;\
cttex -W < $th > $wbr; done

.wbr

9 .
10 tlwg-development

18

latex

newsgroup

.1

.1

.ttx

.ttx

1.
2. environment, \begin{thwbr}
environment environment .

...

\end{thwbr}.

3. latex swath cttex .


$ latex thailatexfile.tex
$ for th in *.th; do wbr=echo $th | sed s/\.th/\.wbr/;\
cttex -W < $th > $wbr; done
$ latex thailatexfile.tex

alias .


.
EPS (Encapsulated PostScript) , .
xfig, tgif, dia .
xfig dia (PostScript) .
http://linux.thai.net/Members/poonlap
LATEX

10

15

3: dia
19


dia .
inkscape.

dia

0.90 .


gnuplot (command-line interface).
2 3 .
, , .
gnuplot EPS .
http://linux.thai.net/Members/poonlap

sin(x)
0.6 * sin(2 *x)

0.8
0.6
0.4
y

0.2
0
-0.2
-0.4
-0.6
-0.8
-1

-10

-5

0
x

4: gnuplot

20

10

[1] .

LATEX, ftp://ftp.nectec.or.th/pub/mirror
/thailinux/docs/ZzzThai/thailatex html

[2] Donald E. Knuth. The TEXbook, Volume A of Computers and Typesetting, Addison-Wesley, Reading,
Massachusetts, second edition, 1984, ISBN 0-201-13448-9.
[3] Leslie Lamport. LATEX: A Document Preparation System. Addison-Wesley, Reading, Massachusetts,
second edition, 1994, ISBN 0-201-52983-1.
[4] Michel Goossens, Frank Mittelbach and Alexander Samarin. The
Reading, Massachusetts, 1994, ISBN 0-201-54199-8.

LATEX

Companion. Addison-Wesley,

[5] , TEX LATEX


http://thaigate.rd.nacsis.ac.jp/files/ttex.html
[6] , Typesetter ThaiTEX TEX
http://thaigate.rd.nacsis.ac.jp/files/ttex.html
[7] , LATEX 2
http://www.ctan.org/tex-archive/info/lshort/thai

21


babel, 6, 8
, 13
cttex, 8
, 10
device independent, 4
dvi, 11
dvips, 12
xdvi, 12
LATEX,

PDF, 12
PostScript, 12
swath, 8
, 10
TEX, 4
, 5
, 6
, 7
AFM, 7

METAFONT,

PK, 7
TFM, 7
Type1, 7
, 14, 15
, 6
, 13
, 9
, 19
dia, 19
gnuplot, 20
,
, 13

22

You might also like