Debian Codegraph @

texmf-dist/tex/generic/xypic/xytpic.tex

raw
1 %% xytpic.tex from $Id: xytpic.doc,v 3.7 2011/03/14 20:14:00 krisrose Exp $
2 %%
3 %% Xy-pic ``tpic'' TPIC backend, for lines, curves and fills.
4 %% Copyright (c) 1995-1996 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{tpic}{TPIC backend}{\stripRCS$Revision: 3.7 $}%
25 {Ross Moore}{[email protected]}%
26 {Mathematics Department, Macquarie University, NSW~2109, Australia}
27 \xynew@{if}\ifTPICspecials@
28 \xydef@\UseTPICspecials{\TPICspecials@true}
29 \xydef@\NoTPICspecials{\TPICspecials@false}
30 \xynew@{count}\xytpic@cnt
31 \xydef@\xytpic@max{300}
32 \xydef@\maxTPICpoints#1{\count@=#1 \relax
33 \ifnum\count@>\tw@ \edef\xytpic@max{\the\count@}%
34 \else\expandafter\xyTPICmaxwarning@\expandafter{\the\count@}\fi}
35 \xydef@\xyTPICmaxwarning@#1{max points must be at least 2, #1 invalid}
36 \xydef@\xytpic@style@@{\xytpic@fp}
37 \xydef@\xytpic@reset@{\gdef\xytpic@style@@{\xytpic@fp}%
38 \global\xytpic@cnt=\z@ }
39 \xydef@\xytpic@set@#1{\xdef\xytpic@style@@{\noexpand#1}}
40 \xydef@\xytpic@pn#1{\xyTPIC@special{pn #1}}
41 \xydef@\xytpic@pa#1#2{\global\advance\xytpic@cnt\@ne\relax
42 \ifnum\xytpic@cnt=\xytpic@max\relax \xyTPIC@special{pa #1 #2}%
43 \kern-\X@c\raise-\Y@c\hbox{\xytpic@style@@}\kern\X@c
44 \global\xytpic@cnt=\@ne \relax\fi \xyTPIC@special{pa #1 #2}}
45 \xydef@\xytpic@fp{\xyTPIC@special{fp}}
46 \xydef@\xytpic@ip{\xyTPIC@special{ip}}
47 \xydef@\xytpic@da#1{\xyTPIC@special{da #1}}
48 \xydef@\xytpic@dt#1{\xyTPIC@special{dt #1}}
49 \xydef@\xytpic@sp#1{\xyTPIC@special{sp #1}}
50 \xydef@\xytpic@ar#1#2#3#4#5#6{\xyTPIC@special{ar #1 #2 #3 #4 #5 #6}}
51 \xydef@\xytpic@ia#1#2#3#4#5#6{\xyTPIC@special{ia #1 #2 #3 #4 #5 #6}}
52 \xydef@\xytpic@sh#1{\xyTPIC@special{sh #1}}
53 \xydef@\xytpic@wh{\xyTPIC@special{sh 0}}
54 \xydef@\xytpic@bk{\xyTPIC@special{sh 1}}
55 \xydef@\xyTPIC@special#1{\special{#1}}
56 \xydef@\xyTPIC@noisy#1{\W@{TPIC: #1}\special{#1}}
57 \xydef@\NoisyTPIC{\let\xyTPIC@special=\xyTPIC@noisy}
58 \xydef@\xyTPICsplit@#1#2{\setboxz@h{#1\boxz@#2}}%
59 \xydef@\xytpic@pt#1{\dimen@=#1\divide\dimen@ by72
60 \multiply\dimen@ by 1000 \advance\[email protected]\p@
61 \count@=\dimen@ \divide\count@\p@ }
62 \xydef@\xytpic@in#1{\dimen@=#1\divide\dimen@ by72
63 \edef\next@{\expandafter\removePT@\the\dimen@}}%
64 \xydef@\xytpic@dot@@{\xytpic@pa00}
65 \xydef@\xytpic@width@{\xytpic@pt{\xylinethick@}%
66 \expandafter\xytpic@pn\expandafter{\the\count@}}
67 \xydef@\xytpic@line{%
68 \xytpic@dot@@ \xytpic@pt{-\d@X}\count@@=\count@
69 \xytpic@pt\d@Y \edef\next@{{\the\count@@}{\the\count@}}%
70 \expandafter\xytpic@pa\next@ \xytpic@style@@ \xytpic@reset@ }
71 \xydef@\xytpic@solid@@{\xytpic@set@\xytpic@fp}
72 \xydef@\xytpic@dashed@@{\xytpic@in\xydashl@ \xytpic@dad}
73 \xydef@\xytpic@dotted@@{\dimen@=.5\xydashl@ \xytpic@in\dimen@ \xytpic@dtd}
74 \xydef@\xytpic@dad{\expandafter\xytpic@set@\expandafter{%
75 \expandafter\xytpic@da\expandafter{\next@}}}
76 \xydef@\xytpic@dtd{\expandafter\xytpic@set@\expandafter{%
77 \expandafter\xytpic@dt\expandafter{\next@}}}
78 \xydef@\xytpic@polysolid@{\xytpic@set@\xytpic@fp}
79 \xydef@\xytpic@polydashed@#1{\count@=#1 \xytpic@dad}
80 \xydef@\xytpic@polydotted@#1{\count@=#1 \xytpic@dtd}
81 \xydef@\xytpic@postpoly@{\xytpic@style@@ \xytpic@reset@}
82 \xydef@\TPICalternative@#1#2{%
83 \expandafter\global\expandafter\let\csname origxy#2@\endcsname=#1%
84 \xdef#1{\noexpand\ifTPICspecials@
85 \noexpand\expandafter\expandafter\noexpand\csname xytpic@#2@\endcsname
86 \noexpand\else
87 \noexpand\expandafter\expandafter\noexpand\csname origxy#2@\endcsname
88 \noexpand\fi}}%
89 \xydef@\setupxyTPIC@{\xywarning@{using TPIC specials}%
90 \TPICalternative@{\solid@}{solid}%
91 \TPICalternative@{\dash@}{dashed}%
92 \TPICalternative@{\point@}{point}%
93 \TPICalternative@{\circhar@@}{circhar}%
94 \TPICalternative@{\splinesolid@}{splinesolid}%
95 \xywithoption{frame}{\xyinputorelse@{xytp-f}{}\xyuncatcodes}%
96 \let\setupxyTPIC@=\reloadxyTPIC@
97 \activateTPIC@ }
98 \xydef@\xyunloadTPIC@{\xywarning@{TPIC specials turned off}%
99 \xywithoption{curve}{\xysetup@@\uninstallTPICcurves@ }%
100 \xywithoption{line}{\xysetup@@\uninstallTPICline@ }%
101 \xywithoption{frame}{\xysetup@@\uninstallTPICframes@ }%
102 \TPICspecials@false
103 \let\setupxyTPIC@=\reloadxyTPIC@ }
104 \xydef@\activateTPIC@{%
105 \xywithoption{line}{\xysetup@@\installTPICline@}%
106 \xywithoption{curve}{\xysetup@@\installTPICcurves@}%
107 \xywithoption{frame}{\xysetup@@\installTPICframes@}%
108 \TPICspecials@true }
109 \xydef@\reloadxyTPIC@{\xywarning@{TPIC specials back on}\activateTPIC@ }
110 \xydef@\xytpic@solid@{%
111 \ifInvisible@ \let\next@=\no@@
112 \else \DN@{\xyTPICstraight@{\xytpic@solid@@ \xytpic@line}}\fi
113 \next@ }
114 \xydef@\xytpic@dashed@{\line@
115 \def\Connect@@{\xyTPICstraight@{\xytpic@dashed@@ \xytpic@line}}}
116 \xydef@\xytpic@point@{\xytpic@dot@@\xytpic@fp\egroup
117 \Invisible@false \Hidden@false \def\Leftness@{.5}\def\Upness@{.5}\ctipEdge@
118 \def\Drop@@{\styledboxz@}%
119 \def\Connect@@{\xyTPICstraight@{\xytpic@dotted@@ \xytpic@line}}}
120 \xydef@\xyTPICstraight@#1{\setupDirection@
121 \edef\Creset@@{\cfromthec@ \pfromthep@ \DirectionfromtheDirection@}%
122 \DN@##1##2{\def\checkoverlap@@{%
123 \ifdim##1\X@p>##1\X@c \let\next@=\relax \fi
124 \ifdim##2\Y@p>##2\Y@c \let\next@=\relax \fi}}%
125 \edef\nextii@{{\sd@X}{\sd@Y}}\expandafter\next@\nextii@
126 \noCshavep@@ \edef\Cshavep@@{\pfromthep@ \noexpand\resetDirection@}%
127 \noCshavec@@ \edef\Cshavec@@{\cfromthec@ \noexpand\resetDirection@}%
128 \ifHidden@\else
129 \ifdim\Y@c>\Y@max \Y@max=\Y@c \fi \ifdim\Y@p>\Y@max \Y@max=\Y@p \fi
130 \ifdim\Y@c<\Y@min \Y@min=\Y@c \fi \ifdim\Y@p<\Y@min \Y@min=\Y@p \fi
131 \ifdim\X@c>\X@max \X@max=\X@c \fi \ifdim\X@p>\X@max \X@max=\X@p \fi
132 \ifdim\X@c<\X@min \X@min=\X@c \fi \ifdim\X@p<\X@min \X@min=\X@p \fi \fi
133 \ifInvisible@\let\next@=\relax \else
134 \DN@{\setboxz@h{\kern\X@c \raise\Y@c\hbox{#1}}%
135 \ht\z@=\z@ \wd\z@=\z@ \dp\z@=\z@ {\Drop@@}}%
136 \fi
137 \checkoverlap@@
138 \ifdim\d@X=\z@ \ifdim\d@Y=\z@ \DN@{\relax}\fi\fi \next@
139 \def\Cslidep@@{\noCslidep@@}\def\Cslidec@@{\noCslidec@@}%
140 \def\Calong@@{\noCalong@@}\Creset@@ }
141 \xydef@\xytpic@splinesolid@{\xyTPICspline@\xytpic@fp }
142 \xydef@\xytpic@splinedashed@{\xytpic@in\xydashl@\expandafter\xyTPICspline@
143 \expandafter{\expandafter\xytpic@da\expandafter{\next@}}}
144 \xydef@\xytpic@splinedotted@{\xytpic@in{.5\xydashl@}\expandafter\xyTPICspline@
145 \expandafter{\expandafter\xytpic@dt\expandafter{\next@}}}
146 \xydef@\xyTPICspline@#1{\setbox\splinebox@=\copy\voidb@x
147 \SloppyCurves
148 \global\xytpic@cnt=\@ne \xytpic@set@{#1}%
149 \def\splineextra@@{\xyTPICspline@dot}%
150 \def\xycrvdrop@{ }\def\xycrvconn@{}\splineset@@ \xytpic@style@@}
151 \xydef@\xyTPICspline@dot{\xytpic@pt{\X@c}\count@@=\count@
152 \xytpic@pt{-\Y@c}\edef\next@{{\the\count@@}{\the\count@}}%
153 \expandafter\xytpic@pa\next@ }
154 \xydef@\xyTPIClinewidth@#1{\xytpic@pt{#1}\edef\next@{\the\count@}}
155 \xydef@\installTPICline@{%
156 \let\xylinewidth@@=\xylinewidth@
157 \let\xylineSpecial@@=\xytpic@pn
158 \let\transxyline@@=\xyTPIClinewidth@ }
159 \xydef@\uninstallTPICline@{\UnloadLine@}%
160 \xydef@\xydoTPICcircle@#1{\DN@{#1}%
161 \ifx\next@\empty\DN@{\xyTPICfullcircle@}%
162 \else\expandafter\DNii@\expandafter{\addDASH@{}}%
163 \ifx\next@\nextii@\DN@{\L@=\R@ \xyTPICfullcircle@}%
164 \else\DN@{\dosolidcircle@{#1}}\fi\fi \next@ }
165 \xydef@\xyTPICfullcircle@{\xyTPICpartcircle@{00}0\twoPi@}%
166 \xydef@\xyTPICpartcircle@#1#2#3{%
167 \xytpic@pt{\R@}\expandafter\DNii@\expandafter{\the\count@}%
168 \xytpic@pt{\L@}\edef\next@{#1{\nextii@}{\the\count@}{#2}{#3}}%
169 \expandafter\xytpic@ar\next@ }
170 \xydef@\qartPi@{0.7853981}
171 \xydef@\tartPi@{2.3561944}
172 \xydef@\xytpic@circhar@#1{\xytpic@width@\ifcase#1%
173 \xytpic@pt{\R@}\edef\next@{{{\the\count@}0}}%
174 \expandafter\xyTPICcirchar@i\next@{\tartPi@}{\fullPi@}\kern\partroottwo\R@
175 \or
176 \xytpic@pt{\halfroottwo\R@}\edef\next@{{{\the\count@}0}}%
177 \expandafter\xyTPICcirchar@i\next@{\halfPi@}{\tartPi@}\kern\halfroottwo\R@
178 \or
179 \xytpic@pt{\z@}\edef\next@{{{\the\count@}0}}%
180 \expandafter\xyTPICcirchar@i\next@{\qartPi@}{\halfPi@}\kern\halfroottwo\R@
181 \or
182 \xytpic@pt{-\halfroottwo\R@}\edef\next@{{{\the\count@}0}}%
183 \expandafter\xyTPICcirchar@i\next@0{\qartPi@}\kern\partroottwo\R@
184 \or
185 \xytpic@pt{-\halfroottwo\R@}\edef\next@{{{\the\count@}0}}%
186 \expandafter\xyTPICcirchar@i\next@{-\qartPi@}0\kern\partroottwo\R@
187 \or
188 \xytpic@pt{\z@}\edef\next@{{{\the\count@}0}}%
189 \expandafter\xyTPICcirchar@i\next@{-\halfPi@}{-\qartPi@}\kern\halfroottwo\R@
190 \or
191 \xytpic@pt{\halfroottwo\R@}\edef\next@{{{\the\count@}0}}%
192 \expandafter\xyTPICcirchar@i\next@{-\tartPi@}{-\halfPi@}\kern\halfroottwo\R@
193 \or
194 \xytpic@pt{\R@}\edef\next@{{{\the\count@}0}}%
195 \expandafter\xyTPICcirchar@i\next@{-\fullPi@}{-\tartPi@}\kern\partroottwo\R@
196 \fi}
197 \xydef@\xyTPICcirchar@i#1#2#3{\L@=\R@ \xyTPICpartcircle@{#1}{#2}{#3}}
198 \xydef@\xyTPIC@spline@ii@{\DN@{\xy@spline@ii}%
199 \ifx\splineSTYLE@\empty\DN@{\xyTPICqspline@{0}}%
200 \else\expandafter\DNii@\expandafter{\addDASH@{}}%
201 \ifx\splineSTYLE@\nextii@\DN@{\xyTPICqspline@{0}}%
202 \else\expandafter\DNii@\expandafter{\addDOT@{}}%
203 \ifx\splineSTYLE@\nextii@\DN@{\xyTPICqspline@{-.5}}%
204 \else\expandafter\expandafter\expandafter\DNii@\expandafter\expandafter
205 \expandafter{\expandafter\addDASH@\addDASH@{}}%
206 \ifx\splineSTYLE@\nextii@\DN@{\xyTPICqspline@{}}%
207 \fi\fi\fi\fi
208 \next@ }%
209 \xydef@\xyTPIC@accumulate{\xytpic@pt\X@c \count@@=\count@
210 \xytpic@pt{-\Y@c}\edef\next@{{\the\count@@}{\the\count@}}%
211 \expandafter\xytpic@pa\next@ }
212 \xydef@\xyTPICqspline@#1{\xytpic@width@
213 \xytpic@in{#1\xydashl@}\expandafter\gdef\expandafter\xytpic@style@@
214 \expandafter{\expandafter\xytpic@sp\expandafter{\next@}}%
215 \save@ \cfromp@ \xyTPIC@accumulate
216 \edef\smapp@@{\s@bot}\smapxy@i{\xyTPIC@accumulate}%
217 \leave@ \xyTPIC@accumulate \xytpic@style@@ \xytpic@reset@
218 \enter@{}\xy@spline@x }
219 \xydef@\installTPICcurves@{%
220 \let\dosolidcircle@@=\xydoTPICcircle@
221 \let\xy@spline@ii@@=\xyTPIC@spline@ii@
222 }
223 \xydef@\uninstallTPICcurves@{%
224 \let\dosolidcircle@@=\dosolidcircle@
225 \let\xy@spline@ii@@=\xy@spline@ii }
226 \xywithoption{frame}{\xyinputorelse@{xytp-f}{}}
227 \xydef@\uninstallTPICframes@{\UnloadFrames@}
228 \xyendinput