-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile_listings
executable file
·41 lines (41 loc) · 1.32 KB
/
compile_listings
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
#!/bin/bash
for D in listings/*; do
if [ -d "${D}" ]; then
# Compile without cropping.
# References to other files are interpreted relative to the
# root directory.
for F in ${D}/*_page.tex; do
if [ -f "${F}" ]; then
echo "###### Compiling ${F} ######"
pdflatex --shell-escape --output-directory "${D}" "${F}"
fi
done
# Compile with cropping.
# Careful: References to other files are interpreted relative
# to the file, not to the root directory.
for F in ${D}/*_crop.tex; do
if [ -f "${F}" ]; then
echo "###### Compiling and cropping ${F} ######"
pushd "${D}"
pdflatex --shell-escape "$(basename $F)"
pdfcrop "$(basename -s .tex ${F}).pdf" \
"$(basename -s .tex ${F}).pdf"
popd
fi
done
# Compile with BibTeX and cropping.
# References to other files are interpreted relative to the
# root directory.
for F in ${D}/*_bib.tex; do
if [ -f "${F}" ]; then
echo "###### Compiling and cropping ${F} ######"
pdflatex --output-directory "${D}" "${F}"
bibtex "${F%.tex}.aux"
pdflatex --output-directory "${D}" "${F}"
pdflatex --output-directory "${D}" "${F}"
pdfcrop "${D}/$(basename -s .tex ${F}).pdf" \
"${D}/$(basename -s .tex ${F}).pdf"
fi
done
fi
done