4 # Author: Markus Wenzel, TU Muenchen
6 # DESCRIPTION: prepare theory session document
14 echo "Usage: $PRG [OPTIONS] [DIR]"
17 echo " -c cleanup -- be aggressive in removing old stuff"
18 echo " -n NAME specify document name (default 'document')"
19 echo " -o FORMAT specify output format: dvi (default), dvi.gz, ps, ps.gz, pdf"
20 echo " -t TAGS specify tagged region markup"
22 echo " Prepare the theory session document in DIR (default 'document')"
23 echo " producing the specified output format."
35 ## process command line
44 while getopts "cn:o:t:" OPT
65 shift $(($OPTIND - 1))
71 [ "$#" -ge 1 ] && { DIR="$1"; shift; }
73 [ "$#" -ne 0 ] && usage
81 dvi | dvi.gz | ps | ps.gz | pdf)
84 fail "Bad output format '$OUTFORMAT'"
89 # tagged region markup
99 echo "\\isafoldtag{${TAG:1}}"
102 echo "\\isadroptag{${TAG:1}}"
105 echo "\\isakeeptag{${TAG:1}}"
108 echo "\\isakeeptag{${TAG}}"
118 function pre_latex ()
121 [ -n "$CLEAN" ] && rm -f *.aux *.out *.ind *.idx *.ilg *.bbl *.blg *.log
122 "$ISATOOL" latex -o sty && \
123 "$ISATOOL" latex -o "$FMT" && \
124 { [ ! -f root.bib ] || "$ISATOOL" latex -o bbl; } && \
125 { [ ! -f root.idx ] || "$ISATOOL" latex -o idx; } && \
126 "$ISATOOL" latex -o "$FMT"
130 cd "$DIR" || fail "Bad directory '$DIR'"
132 [ -n "$CLEAN" ] && rm -f "../$NAME.$OUTFORMAT"
136 if [ -f IsaMakefile ]; then
137 "$ISATOOL" make "$OUTFORMAT"
139 elif [ "$OUTFORMAT" = pdf ]; then
141 "$ISATOOL" latex -o pdf && \
145 "$ISATOOL" latex -o "$OUTFORMAT"
149 if [ "$RC" -eq 0 -a -f "root.$OUTFORMAT" ]; then
150 cp -f "root.$OUTFORMAT" "../$NAME.$OUTFORMAT"
160 [ "$RC" -ne 0 ] && fail "Document preparation failure in directory '$DIR'"
163 [ -n "$CLEAN" ] && rm -rf "$DIR"