| 1 |
%% LaTeX2e file `asyalign.sty' |
| 2 |
%% generated by the `filecontents' environment |
| 3 |
%% from source `asyfig' on 2010/03/20. |
| 4 |
%% |
| 5 |
\ProvidesPackage{asyalign} |
| 6 |
|
| 7 |
% This package provides code for placing Asymptote labels inline in \LaTeX\ documents. It is adapted from code that is usually included within Aymptote's \<filename>|_.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. |
| 8 |
|
| 9 |
\RequirePackage{ifpdf} |
| 10 |
|
| 11 |
\newbox\ASYbox |
| 12 |
\newdimen\ASYdimen |
| 13 |
|
| 14 |
\long\def\ASYbase#1#2{% |
| 15 |
\leavevmode |
| 16 |
\setbox\ASYbox\hbox{#1}% |
| 17 |
\ASYdimen=\ht\ASYbox |
| 18 |
\setbox\ASYbox\hbox{#2}% |
| 19 |
\lower\ASYdimen\box\ASYbox |
| 20 |
} |
| 21 |
|
| 22 |
\ifpdf |
| 23 |
|
| 24 |
\long\def\ASYaligned(#1,#2)(#3,#4)#5#6#7{% |
| 25 |
\leavevmode |
| 26 |
\setbox\ASYbox\hbox{#7}% |
| 27 |
\setbox\ASYbox\hbox{% |
| 28 |
\ASYdimen\ht\ASYbox |
| 29 |
\advance\ASYdimen\dp\ASYbox |
| 30 |
\kern#3\wd\ASYbox |
| 31 |
\raise#4\ASYdimen |
| 32 |
\box\ASYbox |
| 33 |
}% |
| 34 |
\put(#1,#2){% |
| 35 |
#5\wd\ASYbox 0pt\dp\ASYbox 0pt\ht\ASYbox 0pt\box\ASYbox#6% |
| 36 |
}% |
| 37 |
} |
| 38 |
|
| 39 |
\long\def\ASYalignT(#1,#2)(#3,#4)#5#6{% |
| 40 |
\ASYaligned(#1,#2)(#3,#4){% |
| 41 |
\special{pdf:q #5 0 0 cm}% |
| 42 |
}{% |
| 43 |
\special{pdf:Q}% |
| 44 |
}{#6}% |
| 45 |
} |
| 46 |
|
| 47 |
\long\def\ASYalign(#1,#2)(#3,#4)#5{\ASYaligned(#1,#2)(#3,#4){}{}{#5}} |
| 48 |
|
| 49 |
\let\ASYraw\@firstofone |
| 50 |
|
| 51 |
\else |
| 52 |
|
| 53 |
\long\def\ASYaligned(#1,#2)(#3,#4)#5#6#7{% |
| 54 |
\leavevmode |
| 55 |
\setbox\ASYbox\hbox{#7}% |
| 56 |
\setbox\ASYbox\hbox{% |
| 57 |
\ASYdimen\ht\ASYbox% |
| 58 |
\advance\ASYdimen\dp\ASYbox |
| 59 |
\kern#3\wd\ASYbox |
| 60 |
\raise#4\ASYdimen |
| 61 |
\box\ASYbox |
| 62 |
}% |
| 63 |
\put(#1,#2){#5\wd\ASYbox 0pt\dp\ASYbox 0pt\ht\ASYbox 0pt\box\ASYbox#6}% |
| 64 |
} |
| 65 |
|
| 66 |
\long\def\ASYalignT(#1,#2)(#3,#4)#5#6{% |
| 67 |
\ASYaligned(#1,#2)(#3,#4){% |
| 68 |
\special{% |
| 69 |
ps:gsave currentpoint currentpoint translate |
| 70 |
[#5 0 0] concat neg exch neg exch translate% |
| 71 |
}% |
| 72 |
}{% |
| 73 |
\special{ps:currentpoint grestore moveto}% |
| 74 |
}{#6}% |
| 75 |
} |
| 76 |
|
| 77 |
\long\def\ASYalign(#1,#2)(#3,#4)#5{\ASYaligned(#1,#2)(#3,#4){}{}{#5}} |
| 78 |
|
| 79 |
\def\ASYraw#1{% |
| 80 |
currentpoint currentpoint translate matrix currentmatrix |
| 81 |
100 12 div -100 12 div scale |
| 82 |
#1 |
| 83 |
setmatrix neg exch neg exch translate% |
| 84 |
} |
| 85 |
|
| 86 |
\fi |
| 87 |
|