summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pb-diagram/pb-xy.sty
blob: f5cadd5a51e3c9ef6da1a29812f0c8e20ae549d8 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
% pb-xy.sty: Xypic arrow enhancements for pb-diagram.sty
% Author: Bill Richter <richter@math.nwu.edu>
% Version Number: 5.0
% Version Date: 20 Oct 1998
%
% Copyright (c) 1998 by Bill Richter
%
%	This program 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.
%
%	This program 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 program; if not, write to the Free Software
%	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%
% This style file should be loaded as follows:
%	\usepackage[cmtip,arrow]{xy}
%	\usepackage{pb-diagram,pb-xy}
%
% This code adds to the "diagram" environment the use of
% Xypic fancy arrow heads and tails, as well as additional arrow
% directions.  Most of the options defined here can be
% combined arbitrarily.
%

\makeatother
\def\PBXYarat{\ar@}%
\makeatletter

\newcount\PBXYxsize
\newcount\PBXYysize

\def\pbxy@tail{{}}%
\def\pbxy@mid{-}%
\def\pbxy@head{>}%

\@namedef{dgo@}{%
   \let\dg@VECTOR=\PBXYvector
   \def\pbxy@tail{{}}\def\pbxy@mid{-}\def\pbxy@head{>}%
   \dg@LBLPOS=\dgARROWPARTS \divide\dg@LBLPOS\tw@}% from pb-diagram.sty

\@namedef{dgo@-}{\def\pbxy@head{{}}}%
\@namedef{dgo@!}{\def\pbxy@mid{{}}\def\pbxy@head{{}}%
	\let\dg@VECTOR=\dg@novector}% from pb-diagram.sty
\@namedef{dgo@..}{\def\pbxy@mid{.}}%
\@namedef{dgo@--}{\def\pbxy@mid{--}}%	
\@namedef{dgo@<>}{\def\pbxy@tail{<}\def\pbxy@head{>}}%
\@namedef{dgo@=}{\def\pbxy@mid{2{-}}\def\pbxy@head{{}}}%
\@namedef{dgo@'}{\def\pbxy@head{^{>}}}%
\@namedef{dgo@`}{\def\pbxy@head{_{>}}}%
\@namedef{dgo@A}{\def\pbxy@head{>>}}%
\@namedef{dgo@V}{\def\pbxy@tail{>}}%
\@namedef{dgo@J}{\def\pbxy@tail{^{(}}}%
\@namedef{dgo@L}{\def\pbxy@tail{_{(}}}%
\@namedef{dgo@S}{\def\pbxy@mid{~}}%
\@namedef{dgo@T}{\def\pbxy@tail{|}}%

\def\PBXYvector(#1,#2)#3{%
   \PBXYxsize#3\relax
   \ifnum#1<\z@\multiply\PBXYxsize\m@ne\fi
   \PBXYysize\PBXYxsize\relax
   \ifnum#1=\z@
      \PBXYxsize\z@
      \ifnum#2<\z@\multiply\PBXYysize\m@ne\fi
   \else
      \multiply\PBXYysize#2\relax\divide\PBXYysize#1\relax
   \fi
   \edef\PBXYarrow{\noexpand\PBXYarat{\pbxy@tail\pbxy@mid\pbxy@head}}%
   \ifnum#1<\z@
      \makebox(\PBXYxsize,\PBXYysize){%
         \begin{xy} 0;<\unitlength,\z@>:%
            \PBXYarrow(\PBXYxsize,\PBXYysize)%
         \end{xy}%
      }%
   \else
      {\begin{xy} <\unitlength,\z@>:%
         \PBXYarrow(\PBXYxsize,\PBXYysize)%
      \end{xy}}%
   \fi
}

\def\dgt@nee{\dg@DX=\tw@ \dg@DY=\@ne \dg@SIZE=\tw@}%
\def\dgt@see{\dg@DX=\tw@ \dg@DY=\m@ne \dg@SIZE=\tw@}%
\def\dgt@nww{\dg@DX=-\tw@ \dg@DY=\@ne \dg@SIZE=\tw@}%
\def\dgt@sww{\dg@DX=-\tw@ \dg@DY=\m@ne \dg@SIZE=\tw@}%
\def\dgt@neee{\dg@DX=\thr@@ \dg@DY=\@ne \dg@SIZE=\thr@@}%
\def\dgt@nnne{\dg@DX=\@ne \dg@DY=\thr@@ \dg@SIZE=\@ne}%
\def\dgt@nnnw{\dg@DX=\m@ne \dg@DY=\thr@@ \dg@SIZE=\@ne}%
\def\dgt@nwww{\dg@DX=-\thr@@ \dg@DY=\@ne \dg@SIZE=\thr@@}%
\def\dgt@swww{\dg@DX=-\thr@@ \dg@DY=\m@ne \dg@SIZE=\thr@@}%
\def\dgt@sssw{\dg@DX=\m@ne \dg@DY=-\thr@@ \dg@SIZE=\@ne}%
\def\dgt@ssse{\dg@DX=\@ne \dg@DY=-\thr@@ \dg@SIZE=\@ne}%
\def\dgt@seee{\dg@DX=\thr@@ \dg@DY=\m@ne \dg@SIZE=\thr@@}%
\def\dgt@nneee{\dg@DX=\thr@@ \dg@DY=\tw@ \dg@SIZE=\thr@@}%
\def\dgt@nnnee{\dg@DX=\tw@ \dg@DY=\thr@@ \dg@SIZE=\tw@}%
\def\dgt@nnnww{\dg@DX=-\tw@ \dg@DY=\thr@@ \dg@SIZE=\tw@}%
\def\dgt@nnwww{\dg@DX=-\thr@@ \dg@DY=\tw@ \dg@SIZE=\thr@@}%
\def\dgt@sswww{\dg@DX=-\thr@@ \dg@DY=-\tw@ \dg@SIZE=\thr@@}%
\def\dgt@sssww{\dg@DX=-\tw@ \dg@DY=-\thr@@ \dg@SIZE=\tw@}%
\def\dgt@sssee{\dg@DX=\tw@ \dg@DY=-\thr@@ \dg@SIZE=\tw@}%
\def\dgt@sseee{\dg@DX=\thr@@ \dg@DY=-\tw@ \dg@SIZE=\thr@@}%

% approximate aspect ratio by half-integer betw 1/2 and 4
%
\def\dggeometry{
   \dg@ZTEMP=\dg@XGRID \multiply\dg@ZTEMP\tw@
   \ifnum\dg@YGRID=\z@ \dg@ZTEMP=\tw@
   \else \divide\dg@ZTEMP\dg@YGRID \fi
   \ifnum\dg@ZTEMP>8\relax \dg@ZTEMP=8\relax \fi
   \ifnum\dg@ZTEMP<\@ne \dg@ZTEMP=\@ne \fi
   \unitlength=1sp\relax
   \ifnum\dg@ZTEMP<\tw@
      % round aspect ratio up toward 2:2, widen rect
      \advance\dg@ZTEMP\@ne
      \multiply\unitlength\dg@YGRID
      \dg@XGRID=\dg@ZTEMP \dg@YGRID=\tw@
      \dg@rmcommondiv\tw@\dg@XGRID\dg@YGRID
      \divide\unitlength\dg@YGRID
   \else
      % round aspect ratio down toward 2:2, tallen rect
      \multiply\unitlength\dg@XGRID
      \dg@XGRID=\dg@ZTEMP \dg@YGRID=\tw@
      \dg@rmcommondiv\tw@\dg@XGRID\dg@YGRID
      \divide\unitlength\dg@XGRID
   \fi
   \divide\unitlength\@m\relax}%