| 1 | #! /bin/sh |
| 2 | |
| 3 | set -ex |
| 4 | jobname=$1 opts=$2 file=$3 preamble=$4 |
| 5 | |
| 6 | case ",$opts," in |
| 7 | *,pdf,*) tex=pdflatex ext=pdf;; |
| 8 | *) tex=latex ext=dvi;; |
| 9 | esac |
| 10 | |
| 11 | for i in toc lot lof aux ind idx ilg bbl blg log; do |
| 12 | rm -f "$jobname".$i |
| 13 | done |
| 14 | |
| 15 | $tex -jobname "$jobname" "\\relax $preamble \\input $file" |
| 16 | case ",$opts," in *,bibtex,*) bibtex "$jobname".aux || :;; esac |
| 17 | $tex -jobname "$jobname" "\\relax $preamble \\input $file" |
| 18 | $tex -jobname "$jobname" "\\relax $preamble \\input $file" |
| 19 | case ",$opts," in |
| 20 | *,index=*,*) |
| 21 | ist=$(echo "$opts" | sed 's:.*,index=\([^,]*\),.*$:\1:') |
| 22 | makeindex -s"$ist" "$jobname".idx |
| 23 | ;; |
| 24 | esac |
| 25 | $tex -jobname "$jobname" "\\relax $preamble \\input $file" |
| 26 | |
| 27 | echo timestamp >"$jobname".$ext-stamp |