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