Thursday, February 4, 2010

How to setup Thai LaTex in Windows

This article is gather information for setup Thai LaTex from sites in the bottom of page (most of article translate from this). I try to explain step by step with image description for newbie who want to used greatest typeset software, Thai LaTex. You haven't spend any penny to use this software but for you might spend a lot of time instead. So, I hope is article would save someone time for setup Thai LaTex.

Because my first time set it up questions are on Cygwin, so in this article I try to more describe step on Cygwin. For setup ThaiLaTex most of it I gather from this which great describe but I gather to one place to easier follow.

Step 1 Download Miktex latest version from http://miktex.org/, currently last stable version is 2.8. Install Miktex to default folder such as c:\Program Files\MiKTeX 2.8 for version 2.8. It might take quiet long installation time because it have to transfer a lot of package files.


Step 2 Download Cygwin and install
2.1 Go to http://www.cygwin.com/ and download setup.exe
2.2 Run setup .exe
2.3 Select "Install from Internet"

2.4 Select path for install Cygwin currently I used "C:\Program Files\Cygwin"
* if you got warning dialog "You should not choose a root path that include spaces in directory names. Proceed anyway?" click Yes

2.5 Select local package directory, this folder is where downloading package stored.

2.6 Select Direct Connection

2.7 Choose available download site, normally the first one is ok. Click Next

2.8 It will start downloading setup.ini which kept information about package for CygWin

2.9 In select packages page, type 'make' to search dialog. It will filter package which contain 'make' program, which are Devel and X11.


2.10 Click on 'Default' text after 'Devel' heading. Wait for a few seconds, text will be changed to 'Install'. Click on plus button '+' in front of Devel, will show program those will be installed.

2.11 Again type 'tetex' to search dialog and click on 'Default' text next to 'Text' heading. Text after 'Text' will be changed from 'Default' to 'Install'.
*note: TeTex is obsolete use texlive instead

2.12 Click Next button it will downloading the 'make' and 'tetext' program and install to your computer.

Step 3 Download Thailatex fonts from http://tug.ctan.org/tex-archive/language/thai/thailatex/

3.1 Extract this folder to C:\thailatex

3.2 Open Cygwin by go to start > Program > Cygwin Bash Shell

3.3 Browse to thailatex folder by type command

cd /cygdrive/c/thailatex


3.4 Type command

make

3.5 Type command

make install

3.6 Close Cygwin

Step 4
4.1 Go to c:\thailatex\fonts\ and copy files
Ithuni.enc , thailigs.enc to C:\Program Files\MiKTeX 2.8\dvips\base
thai.map to C:\Program Files\MiKTeX 2.8\dvips\config
thai.map to C:\Program Files\MiKTeX 2.8\fonts\map\dvips
4.2 Go to c:\thailatex\babel copy files .fd, .def, .ldf and .sty to C:\Program Files\MiKTeX 2.8\tex\generic\babel


*Tip: to copy selected file type I suggest to use window search and look for *.fd, *.def, *.ldf, *.sty in current folder to avoid mistake.

4.3 Go to c:\thailatex\fonts\ coply files (create sub-folder 'thai' for target)
to searching files using search in windows is suggestion because there are a lot of files
*.afm to C:\Program Files\MiKTeX 2.8\fonts\afm\public\thai
*.tfm to C:\Program Files\MiKTeX 2.8\fonts\tfm\public\thai
*.pfb to C:\Program Files\MiKTeX 2.8\fonts\type1\public\thai
*.vf to C:\Program Files\MiKTeX 2.8\fonts\vf\public\thai

4.4 Go to windows command line (start > run > type 'cmd')
4.5 Type command

initexmf --edit-config-file updmap

and insert text 'Map thai.map' and save file

4.6 Update Miktex , type command

initexmf -v --mkmaps -u

Step 5 Test
5.1 open notepad copy and paste below code, when 'norasi' is font name there are another font name that you can used see example http://thailatex.files.wordpress.com/2009/08/thaitest.pdf

\documentclass{report}
\usepackage[thai]{babel}
\usepackage{thswitch}

\begin{document}

\usefont{LTH}{norasi}{m}{n}
สวัสดีชาวโลก
\end{document}

5.2 Create new folder c:\testlatex
5.3 Saved file to c:\testlatex\simple.tex
5.4 Go to windows command line type

latex simple

you should got simple.dvi, double click or open it by Yap. Yap is program to view file .dvi and normally Yap was installed from Miktex package.

5.5 Type command

dvipdfm simple.dvi

now you got simple.pdf to used

Step 6 Using SWATH (Smart Word Analysis for THai) which is a word segmentation for Thai.
6.1 Download swath from http://swath.googlecode.com/files/swath.zip
6.2 Extract to C:\swath
6.3 Open notepad and type

c:\swath\swath -f latex -d c:\swath\swath < %1.ttx > %1.tex

saved as sw.bat
6.4 Renamed file c:\testlatex\simple.tex to simple.ttx. *This is convention to create file in format .ttx and convert to .tex using SWATH.
6.5 Go to windows commandline type

sw simple

6.6 Type command

latex simple

you will got simple.dvi those segment word by SWATH

Saving your time instead of using two (or more) commands each time by create batch file name thailatex.bat

c:\swath\swath -f latex -d c:\swath\swath < %1.ttx > %1.tex
latex %1
makeindex %1
bibtex %1
latex %1
latex %1

and save to C:\Program Files\MiKTeX 2.8\miktex\bin\thailatex.bat (makeindex and bibtex is another program to manage index and reference)

next time you create new filename.ttx you just type command

thailatex filename

and you will got filename.dvi

Thanks so much to

http://thailatex.wordpress.com/latex-%E0%B8%AD%E0%B8%A2%E0%B9%88%E0%B8%B2%E0%B8%87%E0%B9%84%E0%B8%A3%E0%B9%84%E0%B8%A1%E0%B9%88%E0%B9%83%E0%B8%AB%E0%B9%89%E0%B8%9B%E0%B8%A7%E0%B8%94%E0%B8%AB%E0%B8%B1%E0%B8%A7/miktex-25-26-with-thai/
http://www.bloggang.com/viewblog.php?id=suntrust&date=22-04-2008&group=3&gblog=1
http://ichris.ws/latex-5
http://physics3.sut.ac.th/miktexthai.html
http://linux.thai.net/~thep/
http://code.google.com/p/swath/

No comments:

Post a Comment