3 LATEXFLAGS
="-file-line-error -halt-on-error"
5 docs
=( thesis presentation
)
12 [[ "$1" != *.tex
&& "$1" != *.pre
]] && fn
="$1.tex" || fn
="$1"
14 grep -Po '(?<=\\input{).*(?=})|(?<=\\include{).*(?=})' $fn |\
15 while read l
; do deps
"$l"; done
19 for dep
in $
(deps
"$1"); do
20 [ "$dep" -nt "$2" ] && return 0
26 pdflatex
$LATEXFLAGS -ini -jobname="$2" "&pdflatex $1\dump"
31 pdflatex
$LATEXFLAGS $1
32 grep -q '^\\bibdata{' $1.aux
&& bibtex
$1
33 grep -q '\@istfilename' $1.aux
&& makeglossaries
$1
34 [ -f $1.idx
] && makeindex
$1
36 trap RETURN
rm -v $tmpf
37 pdflatex
$LATEXFLAGS $1 |
tee $tmpf
38 grep -Fiq "Rerun" $tmpf && pdflatex
$LATEXFLAGS $1
44 if [ ! -f $1.tex
]; then
45 log
"Skipping $1, no tex available"
48 [ -f preamble.tex
] && pre
=preamble.tex
49 [ -f $1.pre
] && pre
=$1.pre
51 if [ ! -z $pre ]; then
53 recompile
$pre $1.
fmt\
55 || log
"preamble up to date"
59 recompile
"$1.tex" "$1.pdf"\
61 || log
"document up to date"
66 while [ $# -ne 0 ]; do
68 rm -fv $1.
{acn
,acr
,alg
,aux
,bbl
,blg
,idl
,idx
,ilg
,ind
,fmt,glg
,glo
,gls
,\
69 ist
,loa
,lof
,log
,lol
,lot
,nav
,out
,pdf
,snm
,tdo
,toc
}
75 for doc
in "${docs[@]}"; do
80 while [ $# -ne 0 ]; do
81 if [ $1 = "clean" ]; then
84 else clean
"${docs[@]}"