File: tlatex

package info (click to toggle)
thailatex 0.2.5.cvs20020221
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,008 kB
  • ctags: 3
  • sloc: sh: 786; makefile: 286; lisp: 7
file content (50 lines) | stat: -rwxr-xr-x 996 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#! /bin/sh -e
#
# Written by Chanop Silpa-Anan <chanop@debian.org>
#
# You have every right to do anything with this file.
# Use with care.
#

if [ $# -ne 1 ]; then
  echo "Usage:"
  echo "  $0 latexfile[.tex]"
  exit 1
fi

LATEXFILEORG=
if [ -e $1 ]; then
  LATEXFILEORG="$1"
elif [ -e $1.tex ]; then
  LATEXFILEORG="$1.tex"
else
  echo "File not found: $1[.tex]"
  exit 1
fi

echo "Found: $LATEXFILEORG"
LATEXFILENEW=`echo $LATEXFILEORG | sed -e "s/.tex/.ttex/"`
LATEXFILENAME=`echo $LATEXFILEORG | sed -e "s/.tex//"`

WORDSEG=
if which swath > /dev/null; then
  WORDSEG="swath -f latex"
elif which cttex > /dev/null; then
  WORDSEG="cttex -W"
else
  echo "Cannot find either swath or cttex"
  exit 1
fi

echo "Using: $WORDSEG for Thai word segmentation"
$WORDSEG < $LATEXFILEORG > $LATEXFILENEW
echo "Running LaTeX pass 1"
latex $LATEXFILENEW
#echo "Running BibTeX"
#bibtex $LATEXFILENAME
echo "Running LaTeX pass 2"
latex $LATEXFILENEW
echo "Running LaTeX pass 3"
latex $LATEXFILENEW

exit 0