forked from espressomd/espresso
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlatexit.sh.in
executable file
·82 lines (73 loc) · 2.57 KB
/
latexit.sh.in
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/sh
# Copyright (C) 2012,2013,2014 The ESPResSo project
# Copyright (C) 2010,2011,2012 Olaf Lenz
#
# This file is part of ESPResSo.
#
# ESPResSo is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ESPResSo is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
SRCDIR=$1
BASEFILENAME=$2
TEXINPUTS=.:$SRCDIR:@abs_srcdir@:
BIBINPUTS=.:$SRCDIR:
export TEXINPUTS BIBINPUTS
echo "TEXINPUTS=$TEXINPUTS"
ESPRESSO_VERSION=`cd @abs_top_srcdir@; sh config/genversion.sh -rd`
echo "ESPRESSO_VERSION=$ESPRESSO_VERSION"
PDFLATEX="@PDFLATEX@ -halt-on-error -interaction=batchmode"
LATEXLINE="\\def\\esversion{$ESPRESSO_VERSION}\\input{$BASEFILENAME.tex}"
echo "Running LaTeX stage 1..."
$PDFLATEX $LATEXLINE
EC=$?
if test $EC -ne 0; then
echo "ERROR: LaTeX stage 1 failed."
echo "These are the last 20 lines of $BASEFILENAME.log:"
echo "--------------------------------------------"
tail -n 20 $BASEFILENAME.log
echo "--------------------------------------------"
test -f $BASEFILENAME.pdf && rm $BASEFILENAME.pdf
exit $EC
fi
echo "Running bibtex..."
# Don't fail on bibtex error: it fails if no .bib-file is there!
@BIBTEX@ $BASEFILENAME
echo "Running LaTeX stage 2..."
$PDFLATEX $LATEXLINE
EC=$?
if test $EC -ne 0; then
echo "ERROR: LaTeX stage 2 failed."
echo "These are the last 20 lines of $BASEFILENAME.log:"
echo "--------------------------------------------"
tail -n 20 $BASEFILENAME.log
echo "--------------------------------------------"
test -f $BASEFILENAME.pdf && rm $BASEFILENAME.pdf
exit $EC
fi
if test -e $BASEFILENAME.idx; then
echo "Running makeindex..."
@MAKEINDEX@ $BASEFILENAME || exit $?
fi
echo "Running LaTeX stage 3..."
$PDFLATEX $LATEXLINE
EC=$?
if test $EC -ne 0; then
echo "ERROR: LaTeX stage 3 failed."
echo "These are the last 20 lines of $BASEFILENAME.log:"
echo "--------------------------------------------"
tail -n 20 $BASEFILENAME.log
echo "--------------------------------------------"
test -f $BASEFILENAME.pdf && rm $BASEFILENAME.pdf
exit $EC
fi
echo "See LaTeX output in $BASEFILENAME.log."