forked from Anthchirp/bsg2tex
-
Notifications
You must be signed in to change notification settings - Fork 1
/
3compile
executable file
·44 lines (40 loc) · 1.6 KB
/
3compile
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
#!/bin/bash
#
# bsg3compile, Version vom 1. März 2014
# CC-BY Florian Zumkeller-Quast
# Angelehnt an 3compile.cmd, CC-BY Markus Gerstel
#
# Aufruf: bsg3compile.sh "/home/.../Pfad/zur/La.tex"
# Drag&Drop sollte ebenfalls funktionieren in den meisten DE
#
# Es werden 3 PDF-Dateien erstellt:
# -anonym.pdf Gekürzte/Anonymisierte Fassung
# -print.pdf Druckfassung für Briefpapier
# -volltext.pdf Ungekürzte Fassung für Verfahrensbeteiligte
# Da Dateien nicht überschrieben werden können, wenn sie offen sind, wird
# wärend dem Bau der PDF-Dateien von der Verwendung von z.B. Acrobat Reader
# abgeraten.
# Das Script läuft aber wunderbar zusammen mit z.B. SumatraPDF. Das zeigt
# dann auch quasi live Änderungen an, während im Hintergrund LaTeX rumlatext.
FILE=$1;
for MODE in "volltext" "anonym" "print";
do
TEXPATH=${FILE/%.tex/-${MODE}.tex}
if [ ! -e "${TEXPATH}" ]; then
echo "\\documentclass[${MODE}]{bsg2tex}" > $TEXPATH
echo "\\input{${FILE}}" >> $TEXPATH
fi;
AUXFILE="${FILE/%.tex/-${MODE}.aux}"
# pdflatex jeweils solange iterieren bis .aux-Datei konvergiert oder Fehler auftreten
until diff "${AUXFILE}" "${AUXFILE/%.aux/.aux.sec}" 2>&1 > /dev/null;
do
if [ -e "${AUXFILE}" ]; then
cp -a "${AUXFILE}" "${AUXFILE/%.aux/.aux.sec}"
fi;
pdflatex "${TEXPATH}"
done;
rm "${FILE/%.tex/-${MODE}.aux.sec}"
rm "${FILE/%.tex/-${MODE}.log}"
rm "${FILE/%.tex/-${MODE}.tex}"
rm "${FILE/%.tex/-${MODE}.out}"
done;