diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/thailatex/scripts/tlatex')
-rw-r--r-- | Master/texmf-dist/source/latex/thailatex/scripts/tlatex | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/thailatex/scripts/tlatex b/Master/texmf-dist/source/latex/thailatex/scripts/tlatex new file mode 100644 index 00000000000..2f368a04da7 --- /dev/null +++ b/Master/texmf-dist/source/latex/thailatex/scripts/tlatex @@ -0,0 +1,62 @@ +#! /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= +case `file --mime $LATEXFILEORG` in + *charset=utf-8*) + if which swath > /dev/null; then + WORDSEG="swath -f latex -u u,u" + else + echo "Cannot find swath to process UTF-8 source" + exit 1 + fi + ;; + *) + 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 + ;; +esac + +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 |