-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtextify.sh
executable file
·66 lines (57 loc) · 1.18 KB
/
textify.sh
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
SCRDIR=$(readlink -f $0)
SCRDIR=$(dirname $SCRDIR)
IN=$1
if [ "x$IN" == "x" ]
then
echo No input provided
echo usage: textify.sh file.tex
exit -1;
fi
#echo SCRDIR:$SCRDIR
export TEXINPUTS=$SCRDIR/common:
if [ -d $SCRDIR/tex/main/bin ]
then
export PATH=$SCRDIR/tex/main/bin/x86_64-linux:$PATH
fi
TEX=pdflatex
mkdir -p $SCRDIR/aux
mkdir -p $SCRDIR/pdf
export AUX=$SCRDIR/aux
DIR=$(dirname $IN)
FILE=$(basename $IN)
PDF=${FILE%.*}.pdf
OUT=$SCRDIR/pdf/$PDF
if [ $OUT -nt $IN ]
then
echo "Omitting $IN"
exit 0;
fi
echo "Textify $IN"
mkdir -p $AUX/$DIR
cd $DIR
#echo AUX : $AUX
#echo DIR : $DIR
#echo TEX : $TEX
#echo FILE: $FILE
#echo PDF : $PDF
#echo OUT : $OUT
#echo IN : $IN
if ! $TEX -interaction=nonstopmode -halt-on-error -output-directory=$AUX/$DIR $FILE >error.log 2>&1
then
cat error.log
echo Stoped on error at $IN
exit -1;
else
$TEX -interaction=nonstopmode -halt-on-error -output-directory=$AUX/$DIR $FILE >error.log 2>&1
$TEX -interaction=nonstopmode -halt-on-error -output-directory=$AUX/$DIR $FILE >error.log 2>&1
if [ -f "$AUX/$DIR/$PDF" ]
then
mv $AUX/$DIR/$PDF $OUT
else
echo pdf not created at $IN
exit -2;
fi
fi
rm error.log
exit 0;