forked from andygrunwald/FOM-LaTeX-Template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.sh
executable file
·62 lines (54 loc) · 1.33 KB
/
compile.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
#!/usr/bin/env bash
#Run the Script from the folder you are in...
CURRENT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
compile=""
biberarg=""
CMD_LATEX=lualatex
echo "Compiling in Language: $1"
if [ "$1" = "en" ] || [ "$2" = "en" ] ; then
compile='$CMD_LATEX --shell-escape --jobname="thesis_englisch" "\def\FOMEN{}\input{$CURRENT_DIR/thesis_main.tex}"'
biberarg="$CURRENT_DIR/thesis_englisch"
else
compile='$CMD_LATEX --shell-escape "$CURRENT_DIR/thesis_main.tex"'
biberarg="$CURRENT_DIR/thesis_main"
fi
eval "$compile"
RETVAL="$?"
if [[ "${RETVAL}" -ne 0 ]] ; then
echo "First $CMD_LATEX run failed"
exit ${RETVAL}
fi
biber "$biberarg"
RETVAL="$?"
if [[ "${RETVAL}" -ne 0 ]] ; then
echo "biber run failed"
exit ${RETVAL}
fi
eval "$compile"
RETVAL="$?"
if [[ "${RETVAL}" -ne 0 ]] ; then
echo "Second $CMD_LATEX run failed"
exit ${RETVAL}
fi
eval "$compile"
RETVAL="$?"
if [[ "${RETVAL}" -ne 0 ]] ; then
echo "Third $CMD_LATEX run failed"
exit ${RETVAL}
fi
rm *.bbl 2> /dev/null
rm *.blg 2> /dev/null
rm *.aux 2> /dev/null
rm *.bcf 2> /dev/null
rm *.ilg 2> /dev/null
rm *.lof 2> /dev/null
rm *.log 2> /dev/null
rm *.lot 2> /dev/null
rm *.nlo 2> /dev/null
rm *.nls* 2> /dev/null
rm *.out 2> /dev/null
rm *.toc 2> /dev/null
rm *.run.xml 2> /dev/null
rm *.lot 2> /dev/null
echo "PDF Compile: Success"
exit 0