4 # Author: Markus Wenzel, TU Muenchen
5 # License: GPL (GNU GENERAL PUBLIC LICENSE)
7 # DESCRIPTION: prepare theory session document
10 PRG="$(basename "$0")"
15 echo "Usage: $PRG [OPTIONS] [DIR]"
18 echo " -c cleanup -- be aggressive in removing old stuff"
19 echo " -o FORMAT specify output format: dvi (default), dvi.gz, ps,"
23 echo " Prepare the theory session document in DIR (default 'document')"
24 echo " producing the specified output format."
36 ## process command line
44 while getopts "co:v" OPT
62 shift $(($OPTIND - 1))
68 [ "$#" -ge 1 ] && { DIR="$1"; shift; }
70 [ "$#" -ne 0 ] && usage
78 dvi | dvi.gz | ps | ps.gz | pdf)
81 fail "Bad output format '$OUTFORMAT'"
91 [ -n "$CLEAN" ] && rm -f *.aux *.out
94 "$ISATOOL" latex -o "$FMT" && \
95 "$ISATOOL" latex -o bbl && \
96 "$ISATOOL" latex -o "$FMT"
98 "$ISATOOL" latex -o "$FMT"
103 cd "$DIR" || fail "Bad directory '$DIR'"
105 [ -n "$CLEAN" ] && rm -f "../document.$OUTFORMAT"
107 if [ -f IsaMakefile ]; then
108 "$ISATOOL" make "$OUTFORMAT"
110 elif [ "$OUTFORMAT" = pdf ]; then
112 "$ISATOOL" latex -o pdf && \
113 { if [ -n "$ISABELLE_THUMBPDF" ]; then
114 "$ISATOOL" latex -o png && \
115 "$ISATOOL" latex -o pdf
120 "$ISATOOL" latex -o "$OUTFORMAT"
124 if [ "$RC" -eq 0 -a -f "root.$OUTFORMAT" ]; then
125 cp -f "root.$OUTFORMAT" "../document.$OUTFORMAT" && \
126 [ -n "$VERBOSE" ] && echo "$(cd ..; echo "Prepared $PWD/document.$OUTFORMAT")" >&2
136 [ "$RC" -ne 0 ] && fail "Failed to prepare document in directory '$DIR'"
139 [ -n "$CLEAN" ] && rm -rf "$DIR"