From 27857ca589be3f98c25a2ecda780f1c0984519ae Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 20 Oct 2009 20:51:31 +0000 Subject: asyfig update (20oct09) git-svn-id: svn://tug.org/texlive/trunk@15849 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/asyfig/asyalign.sty | 87 +++++++++++++++++++++++ Master/texmf-dist/tex/latex/asyfig/asyprocess.sty | 59 +++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/asyfig/asyalign.sty create mode 100644 Master/texmf-dist/tex/latex/asyfig/asyprocess.sty (limited to 'Master') diff --git a/Master/texmf-dist/tex/latex/asyfig/asyalign.sty b/Master/texmf-dist/tex/latex/asyfig/asyalign.sty new file mode 100644 index 00000000000..12660db504f --- /dev/null +++ b/Master/texmf-dist/tex/latex/asyfig/asyalign.sty @@ -0,0 +1,87 @@ +%% LaTeX2e file `asyalign.sty' +%% generated by the `filecontents' environment +%% from source `asyfig' on 2009/06/30. +%% +\ProvidesPackage{asyalign} + +% This package provides code for placing Asymptote labels inline in \LaTeX\ documents. It is adapted from code that is usually included within Aymptote's \|_.pre| file, which provides a \LaTeX\ preamble for |asy| processing; this preamble is skipped with the \pkg{asyfig} package since all figures inherit the preamble from that of the main document. + +\RequirePackage{ifpdf} + +\newbox\ASYbox +\newdimen\ASYdimen + +\long\def\ASYbase#1#2{% + \leavevmode + \setbox\ASYbox\hbox{#1}% + \ASYdimen=\ht\ASYbox + \setbox\ASYbox\hbox{#2}% + \lower\ASYdimen\box\ASYbox +} + +\ifpdf + + \long\def\ASYaligned(#1,#2)(#3,#4)#5#6#7{% + \leavevmode + \setbox\ASYbox\hbox{#7}% + \setbox\ASYbox\hbox{% + \ASYdimen\ht\ASYbox + \advance\ASYdimen\dp\ASYbox + \kern#3\wd\ASYbox + \raise#4\ASYdimen + \box\ASYbox + }% + \put(#1,#2){% + #5\wd\ASYbox 0pt\dp\ASYbox 0pt\ht\ASYbox 0pt\box\ASYbox#6% + }% + } + + \long\def\ASYalignT(#1,#2)(#3,#4)#5#6{% + \ASYaligned(#1,#2)(#3,#4){% + \special{pdf:q #5 0 0 cm}% + }{% + \special{pdf:Q}% + }{#6}% + } + + \long\def\ASYalign(#1,#2)(#3,#4)#5{\ASYaligned(#1,#2)(#3,#4){}{}{#5}} + + \let\ASYraw\@firstofone + +\else + + \long\def\ASYaligned(#1,#2)(#3,#4)#5#6#7{% + \leavevmode + \setbox\ASYbox\hbox{#7}% + \setbox\ASYbox\hbox{% + \ASYdimen\ht\ASYbox% + \advance\ASYdimen\dp\ASYbox + \kern#3\wd\ASYbox + \raise#4\ASYdimen + \box\ASYbox + }% + \put(#1,#2){#5\wd\ASYbox 0pt\dp\ASYbox 0pt\ht\ASYbox 0pt\box\ASYbox#6}% + } + + \long\def\ASYalignT(#1,#2)(#3,#4)#5#6{% + \ASYaligned(#1,#2)(#3,#4){% + \special{% + ps:gsave currentpoint currentpoint translate + [#5 0 0] concat neg exch neg exch translate% + }% + }{% + \special{ps:currentpoint grestore moveto}% + }{#6}% + } + + \long\def\ASYalign(#1,#2)(#3,#4)#5{\ASYaligned(#1,#2)(#3,#4){}{}{#5}} + + \def\ASYraw#1{% + currentpoint currentpoint translate matrix currentmatrix + 100 12 div -100 12 div scale + #1 + setmatrix neg exch neg exch translate% + } + +\fi + diff --git a/Master/texmf-dist/tex/latex/asyfig/asyprocess.sty b/Master/texmf-dist/tex/latex/asyfig/asyprocess.sty new file mode 100644 index 00000000000..0213d0005b6 --- /dev/null +++ b/Master/texmf-dist/tex/latex/asyfig/asyprocess.sty @@ -0,0 +1,59 @@ +%% LaTeX2e file `asyprocess.sty' +%% generated by the `filecontents' environment +%% from source `asyfig' on 2009/06/30. +%% +\ProvidesPackage{asyprocess} +\nofiles + +\RequirePackage{ifmtarg,ifpdf,catchfile,ifplatform,color,graphicx} +\RequirePackage[active,tightpage]{preview} + +\def\@par@macro{\par} + +\def\asy@status{asyprocess-statusfile.txt} + +\edef\@tempa{\detokenize{-comp}} +\@temptokena{\def\asy@strip@comp#1} +\expandafter\the\expandafter\@temptokena\@tempa#2\@nil{% + \@ifmtarg{#2}{% + \errorstopmode + \PackageError{asyprocess}{% + The \string\jobname\space of this compilation must end with `-comp'% + }{% + You must set the \cmd\jobname\ with the equivalent of^^J\space\space + pdflatex -jobname=XYZ-comp ...% + } + }{}% + \edef\asy@compname{#1}} +\expandafter\expandafter\expandafter + \asy@strip@comp\expandafter\jobname\@tempa\@nil + +\newcommand\ProcessAsy{% + \immediate\write18{% + asy -wait -inlinetex -tex \ifpdf pdf\fi latex + \asy@compname\space 2> \asy@status}% + \CatchFileDef{\@tempb}{\asy@status}{}% + \immediate\write18{\ifwindows del \else rm \fi \asy@status} + \ifx\@tempb\@par@macro + \expandafter\@gobble + \else + \g@addto@macro\@tempb{^^J^^J% + ------------ ASY ERROR ------------^^J% + -----------------------------------}% + \expandafter\@firstofone + \fi{% + \errorstopmode + \typeout{% + -----------------------------------^^J% + ------------ ASY ERROR ------------^^J} + \typeout{\expandafter\strip@prefix\meaning\@tempb} + \batchmode + \end{document}}} + +\newcommand\ShowAsy{% + \begin{preview} + \input{\asy@compname_} + \end{preview}} + +\AtBeginDocument{\InputIfFileExists{\asy@compname_.pre}{}{}} + -- cgit v1.2.3