Add a PyMOL builder to SCons and generalize PYMOL_PATH setup.
[thesis.git] / src / package / asyprocess.sty
1 %% LaTeX2e file `asyprocess.sty'
2 %% generated by the `filecontents' environment
3 %% from source `asyfig' on 2010/02/25.
4 %%
5 \ProvidesPackage{asyprocess}
6 \nofiles
7
8 \RequirePackage{ifmtarg,ifpdf,catchfile,ifplatform,color,graphicx}
9 \RequirePackage[active,tightpage]{preview}
10
11 \def\@par@macro{\par}
12
13 \def\asy@status{asyprocess-statusfile.txt}
14
15 \edef\@tempa{\detokenize{-comp}}
16 \@temptokena{\def\asy@strip@comp#1}
17 \expandafter\the\expandafter\@temptokena\@tempa#2\@nil{%
18   \@ifmtarg{#2}{%
19     \errorstopmode
20     \PackageError{asyprocess}{%
21       The \string\jobname\space of this compilation must end with `-comp'%
22     }{%
23       You must set the \cmd\jobname\ with the equivalent of^^J\space\space
24       pdflatex -jobname=XYZ-comp ...%
25     }
26   }{}%
27   \edef\asy@compname{#1}}
28 \expandafter\expandafter\expandafter
29   \asy@strip@comp\expandafter\jobname\@tempa\@nil
30
31 \newcommand\ProcessAsy{%
32   \immediate\write18{%
33     asy -wait -inlinetex -tex \ifpdf pdf\fi latex
34       \asy@compname\space 2> \asy@status}%
35   \CatchFileDef{\@tempb}{\asy@status}{}%
36   \immediate\write18{\ifwindows del \else rm \fi \asy@status}
37   \ifx\@tempb\@par@macro
38     \expandafter\@gobble
39   \else
40     \g@addto@macro\@tempb{^^J^^J%
41       ------------ ASY ERROR ------------^^J%
42       -----------------------------------}%
43     \expandafter\@firstofone
44   \fi{%
45      \errorstopmode
46      \typeout{%
47        -----------------------------------^^J%
48        ------------ ASY ERROR ------------^^J}
49      \typeout{\expandafter\strip@prefix\meaning\@tempb}
50      \batchmode
51      \end{document}}}
52
53 \newcommand\ShowAsy{%
54   \begin{preview}
55     \input{\asy@compname_}
56   \end{preview}}
57
58 \AtBeginDocument{\InputIfFileExists{\asy@compname_.pre}{}{}}
59