| 1 |
%% xyimport.tex from $Id: xyimport.doc,v 3.13 2011/03/14 20:14:00 krisrose Exp $ |
| 2 |
%% |
| 3 |
%% Xy-pic ``Import feature'' option. |
| 4 |
%% Copyright (c) 1993-1997 Ross Moore <[email protected]> |
| 5 |
%% |
| 6 |
%% This file is part of the Xy-pic package for graphs and diagrams in TeX. |
| 7 |
%% See the companion README and INSTALL files for further information. |
| 8 |
%% Copyright (c) 1991-2011 Kristoffer H. Rose <[email protected]> |
| 9 |
%% |
| 10 |
%% The Xy-pic package is free software; you can redistribute it and/or modify |
| 11 |
%% it under the terms of the GNU General Public License as published by the |
| 12 |
%% Free Software Foundation; either version 2 of the License, or (at your |
| 13 |
%% option) any later version. |
| 14 |
%% |
| 15 |
%% The Xy-pic package is distributed in the hope that it will be useful, but |
| 16 |
%% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 17 |
%% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 18 |
%% for more details. |
| 19 |
%% |
| 20 |
%% You should have received a copy of the GNU General Public License along |
| 21 |
%% with this package; if not, see http://www.gnu.org/licenses/. |
| 22 |
%% |
| 23 |
\ifx\xyloaded\undefined \input xy \fi |
| 24 |
\xyprovide{import}{Import graphics extension}{\stripRCS$Revision: 3.13 $}% |
| 25 |
{Ross Moore}{[email protected]}% |
| 26 |
{Mathematics Department, Macquarie University, NSW~2109, Australia} |
| 27 |
\xydef@\xyimport#1#{\xyimport@{#1}} |
| 28 |
\xydef@\xyimport@#1#2{\xydelayimport@{#1}{#2}} |
| 29 |
\xydef@\xydelayimport@#1#2{\xy@@ix@{#1{#2}}% |
| 30 |
\xy@@{\expandafter\xyextern@\the\toks9}} |
| 31 |
\xydef@\xyextern@(#1,#2){\hbox\bgroup\R@c=#1\p@ \U@c=#2\p@\xyextern@i} |
| 32 |
\xydef@\xyextern@i#1#{\DN@{#1}% |
| 33 |
\ifx\next@\empty \L@c=\z@ \D@c=\z@ \DN@{\xyextern@x}% |
| 34 |
\else \DN@{\xyextern@ii#1}\fi \next@ } |
| 35 |
\xydef@\xyextern@ii(#1,#2){\L@c=#1\p@ \D@c=#2\p@ |
| 36 |
\advance\R@c-\L@c \advance\U@c-\D@c \xyextern@x} |
| 37 |
\xydef@\xyimportdefault@{3} |
| 38 |
\xydef@\xyexportwarning@#1#2#3{\xywarning@{% |
| 39 |
#1 for import has zero #2; using \xyimportdefault@#3 default}} |
| 40 |
\xydef@\xyextern@x#1{\toks@={\egroup\L@c=}\setboxz@h{#1}% |
| 41 |
\dimen@ii=\L@c \advance\dimen@ii\R@c \dimen@=\wdz@ |
| 42 |
\ifdim\dimen@=\z@ \xyexportwarning@{graphic}{width}{cm}% |
| 43 |
\dimen@=\xyimportdefault@ cm\fi |
| 44 |
\ifdim\dimen@ii=\z@ \xyexportwarning@{coords}{width}{unit}% |
| 45 |
\dimen@ii=\xyimportdefault@\p@\fi |
| 46 |
\quotient@\next@\dimen@\dimen@ii \dimen@=\next@\p@ |
| 47 |
\edef\tmp@{\expandafter\removePT@\the\L@c}\L@c=\tmp@\dimen@ |
| 48 |
\expandafter\addtotoks@\expandafter{\the\L@c\relax\R@c=}% |
| 49 |
\edef\tmp@{\expandafter\removePT@\the\R@c}\R@c=\tmp@\dimen@ |
| 50 |
\expandafter\addtotoks@\expandafter{\the\R@c\relax\setbase@\z@\z@}% |
| 51 |
\expandafter\addtotoks@\expandafter{\expandafter{\the\dimen@}\z@\D@c=}% |
| 52 |
\dimen@ii=\U@c \advance\dimen@ii\D@c \dimen@=\ht\z@\advance\dimen@\dp\z@ |
| 53 |
\ifdim\dimen@=\z@ \xyexportwarning@{graphic}{height}{cm}% |
| 54 |
\dimen@=\xyimportdefault@ cm\fi |
| 55 |
\ifdim\dimen@ii=\z@ \xyexportwarning@{coords}{height}{unit}% |
| 56 |
\dimen@ii=\xyimportdefault@\p@\fi |
| 57 |
\quotient@\next@\dimen@\dimen@ii \dimen@=\next@\p@ |
| 58 |
\edef\tmp@{\expandafter\removePT@\the\D@c}\D@c=\tmp@\dimen@ |
| 59 |
\expandafter\addtotoks@\expandafter{\the\D@c\relax\U@c=}% |
| 60 |
\edef\tmp@{\expandafter\removePT@\the\U@c}\U@c=\tmp@\dimen@ |
| 61 |
\expandafter\addtotoks@\expandafter{\the\U@c\relax\setbase@@\z@}% |
| 62 |
\expandafter\addtotoks@\expandafter{\expandafter{\the\dimen@}}% |
| 63 |
\setboxz@h{\kern-\L@c\lower\D@c\boxz@\kern\L@c}% |
| 64 |
\wd\z@=\z@ \ht\z@=\z@ \dp\z@=\z@ \boxz@ \the\toks@ \X@c=\z@ \Y@c=\z@ |
| 65 |
\ifdim\X@min>-\L@c \X@min=-\L@c \fi \ifdim\X@max<\R@c \X@max=\R@c \fi |
| 66 |
\ifdim\Y@min>-\D@c \Y@min=-\D@c \fi \ifdim\Y@max<\U@c \Y@max=\U@c \fi |
| 67 |
\idfromc@{import}\POS } |
| 68 |
\xyendinput |