Add a PyMOL builder to SCons and generalize PYMOL_PATH setup.
[thesis.git] / tex / src / figures / asy / asyprocess
1 #!/bin/bash
2 #
3 # Process Asymptote files for asyfig inclusion.
4 #
5 # usage: asyprocess [LATEX OPTIONS] -- [ASY-FILE] ...
6 #
7 # There are also the special options:
8 # --texinputs=STR the value of which is prepended to the kpsewhich
9 #                 default for TEXINPUTS (module search path).
10 # --pretex=STR    the value of which is used for the LaTeX preamble.
11 LATEX=pdflatex
12 PRETEX="\documentclass{article}"
13 LATEX_OPTIONS=""
14 TEXINPUTS=""
15
16 # process options
17 while [ "$1" != "--" ] && [ -n "$1" ]; do
18   if [ "${1:0:12}" == "--texinputs=" ]; then
19     TEXINPUTS="${1:12}"
20   elif [ "${1:0:9}" == "--pretex=" ]; then
21     PRETEX="${1:9}"
22   else
23     LATEX_OPTIONS="$LATEX_OPTIONS $1"
24   fi
25   shift
26 done
27 if [ "$1" == "--" ]; then shift; fi
28
29 for file in $*; do
30   echo "Process '$file' with '$LATEX_OPTIONS'"
31   echo "Searching $TEXINPUTS"
32   TEXINPUTS="$TEXINPUTS:" \
33     $LATEX -shell-escape -jobname="${file}-comp" -interaction=batchmode \
34     $LATEX_OPTIONS \
35     "$PRETEX \usepackage{asyprocess}\ProcessAsy \begin{document}\ShowAsy \end{document}" || exit 1
36 done
37
38 exit 0