Debian Codegraph @

texmf-dist/tex/latex/pb-diagram/pb-lams.sty

raw
1 % pb-lams.sty: LAMS-TeX font enhancements for pb-diagram.sty
2 % Author: Paul Burchard <[email protected]>
3 % Version Number: 5.0
4 % Version Date: 20 Oct 1998
5 %
6 % Copyright (c) 1997, 1998 by Paul Burchard
7 %
8 % This program is free software; you can redistribute it and/or modify
9 % it under the terms of the GNU General Public License as published by
10 % the Free Software Foundation; either version 2 of the License, or
11 % (at your option) any later version.
12 %
13 % This program is distributed in the hope that it will be useful,
14 % but WITHOUT ANY WARRANTY; without even the implied warranty of
15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 % GNU General Public License for more details.
17 %
18 % You should have received a copy of the GNU General Public License
19 % along with this program; if not, write to the Free Software
20 % Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 %
22 % This style file should be loaded *AFTER* pb-diagram.sty and
23 % lamsarrow.sty. It should be loaded as follows:
24 % \usepackage{pb-diagram,lamsarrow,pb-lams}
25 %
26 % This code adds to the "diagram" environment the use of
27 % fancy arrow heads and tails, as well as additional arrow
28 % directions. Most of the options defined here can be
29 % combined arbitrarily.
30 %
31
32 \@ifundefined{diagram}{%
33 \@latexerr{The pb-lams style option requires pb-diagram}%
34 {You must include the pb-diagram package prior to pb-lams.}}{}
35 \@ifundefined{lamsvector}{%
36 \@latexerr{The pb-lams style option requires lamsarrow}%
37 {You must include the lamsarrow package prior to pb-lams.}}{}
38
39 \newif\ifdg@LATEXGEOM \dg@LATEXGEOMfalse
40
41 \@namedef{dgo@}{%
42 \let\dg@VECTOR=\lamsvector
43 \lamsshaft{?}\lamssource{?}\lamstarget{?}%
44 \dg@LBLPOS=\dgARROWPARTS \divide\dg@LBLPOS\tw@\relax}%
45 \@namedef{dgo@..}{\lamsshaft{.}}%
46 \@namedef{dgo@<>}{\lamssource{^}\lamstarget{^}}%
47 \@namedef{dgo@=}{\lamsshaft{=}}%
48 \@namedef{dgo@-}{\lamstarget{0}}%
49 \@namedef{dgo@'}{\lamstarget{'}}%
50 \@namedef{dgo@`}{\lamstarget{`}}%
51 \@namedef{dgo@A}{\lamstarget{A}}%
52 \@namedef{dgo@V}{\lamssource{V}}%
53 \@namedef{dgo@J}{\lamssource{J}}%
54 \@namedef{dgo@L}{\lamssource{L}}%
55 \@namedef{dgo@S}{\lamssource{S}}%
56 %
57 % approximate aspect ratio by half-integer betw 1/2 and 3
58 % (or betw 1/2 and 2 if 3:1 arrow detected)
59 %
60 \def\dggeometry{
61 \dg@ZTEMP=\dg@XGRID \multiply\dg@ZTEMP\tw@
62 \ifnum\dg@YGRID=\z@ \dg@ZTEMP=\tw@
63 \else \divide\dg@ZTEMP\dg@YGRID \fi
64 % font limit cutoffs
65 \ifnum\dg@ZTEMP>6\relax \dg@ZTEMP=6\relax \fi
66 \ifdg@LATEXGEOM\ifnum\dg@ZTEMP>\f@ur \dg@ZTEMP=\f@ur \fi\fi
67 \ifnum\dg@ZTEMP<\@ne \dg@ZTEMP=\@ne \fi
68 \unitlength=1sp\relax
69 \ifnum\dg@ZTEMP<\tw@
70 % round aspect ratio up toward 2:2, widen rect
71 \advance\dg@ZTEMP\@ne
72 \multiply\unitlength\dg@YGRID
73 \dg@XGRID=\dg@ZTEMP \dg@YGRID=\tw@
74 \dg@rmcommondiv\tw@\dg@XGRID\dg@YGRID
75 \divide\unitlength\dg@YGRID
76 \else
77 % round aspect ratio down toward 2:2, tallen rect
78 \multiply\unitlength\dg@XGRID
79 \dg@XGRID=\dg@ZTEMP \dg@YGRID=\tw@
80 \dg@rmcommondiv\tw@\dg@XGRID\dg@YGRID
81 \divide\unitlength\dg@XGRID
82 \fi
83 \divide\unitlength\@m\relax
84 \dg@LATEXGEOMfalse}
85 %
86 % Bugwards-compatibility mode for versions 3.6 and earlier.
87 % Enable it with \let\dggeometry=\dgoldgeometry
88 %
89 \def\dgoldgeometry{
90 \dg@ZTEMP=\dg@XGRID \multiply\dg@ZTEMP\tw@
91 \ifnum\dg@YGRID=\z@ \dg@ZTEMP=\tw@
92 \else \divide\dg@ZTEMP\dg@YGRID \fi
93 % font limit cutoffs
94 \ifnum\dg@ZTEMP>6\relax \dg@ZTEMP=6\relax \fi
95 \ifdg@LATEXGEOM\ifnum\dg@ZTEMP>\f@ur \dg@ZTEMP=\f@ur \fi\fi
96 \ifnum\dg@ZTEMP<\@ne \dg@ZTEMP=\@ne \fi
97 % The following calculation is garbled!
98 \unitlength=2sp\relax
99 \ifnum\dg@ZTEMP<\tw@
100 % round aspect ratio up toward 2:2, widen rect
101 \advance\dg@ZTEMP\@ne
102 \multiply\unitlength\dg@YGRID \divide\unitlength\tw@
103 \else
104 % round aspect ratio down toward 2:2, tallen rect
105 \multiply\unitlength\dg@XGRID \divide\unitlength\dg@ZTEMP
106 \fi
107 \dg@XGRID=\dg@ZTEMP \dg@YGRID=\tw@
108 \dg@rmcommondiv\tw@\dg@XGRID\dg@YGRID
109 \divide\unitlength\dg@YGRID \divide\unitlength\@m
110 \dg@LATEXGEOMfalse}
111 %
112 % new directions
113 \def\dgt@nee{\dg@DX=\tw@ \dg@DY=\@ne \dg@SIZE=\tw@}%
114 \def\dgt@see{\dg@DX=\tw@ \dg@DY=\m@ne \dg@SIZE=\tw@}%
115 \def\dgt@nww{\dg@DX=-\tw@ \dg@DY=\@ne \dg@SIZE=\tw@}%
116 \def\dgt@sww{\dg@DX=-\tw@ \dg@DY=\m@ne \dg@SIZE=\tw@}%
117 \def\dgt@nnne{\dg@DX=\@ne \dg@DY=\thr@@ \dg@SIZE=\@ne}%
118 \def\dgt@nnnw{\dg@DX=\m@ne \dg@DY=\thr@@ \dg@SIZE=\@ne}%
119 \def\dgt@sssw{\dg@DX=\m@ne \dg@DY=-\thr@@ \dg@SIZE=\@ne}%
120 \def\dgt@ssse{\dg@DX=\@ne \dg@DY=-\thr@@ \dg@SIZE=\@ne}%
121 \def\dgt@nnnee{\dg@DX=\tw@ \dg@DY=\thr@@ \dg@SIZE=\tw@}%
122 \def\dgt@nnnww{\dg@DX=-\tw@ \dg@DY=\thr@@ \dg@SIZE=\tw@}%
123 \def\dgt@sssww{\dg@DX=-\tw@ \dg@DY=-\thr@@ \dg@SIZE=\tw@}%
124 \def\dgt@sssee{\dg@DX=\tw@ \dg@DY=-\thr@@ \dg@SIZE=\tw@}%
125 %
126 % these are only drawn approx correct in some aspect ratios:
127 \def\dgt@nneee{\dg@DX=\thr@@ \dg@DY=\tw@ \dg@SIZE=\thr@@}%
128 \def\dgt@nnwww{\dg@DX=-\thr@@ \dg@DY=\tw@ \dg@SIZE=\thr@@}%
129 \def\dgt@sswww{\dg@DX=-\thr@@ \dg@DY=-\tw@ \dg@SIZE=\thr@@}%
130 \def\dgt@sseee{\dg@DX=\thr@@ \dg@DY=-\tw@ \dg@SIZE=\thr@@}%
131 %
132 % these only work with LaTeX-compatible aspect ratios:
133 % must set this globally to see it later!!!
134 \def\dgt@neee{\dg@DX=\thr@@ \dg@DY=\@ne \dg@SIZE=\thr@@
135 \global\dg@LATEXGEOMtrue}%
136 \def\dgt@nwww{\dg@DX=-\thr@@ \dg@DY=\@ne \dg@SIZE=\thr@@
137 \global\dg@LATEXGEOMtrue}%
138 \def\dgt@swww{\dg@DX=-\thr@@ \dg@DY=\m@ne \dg@SIZE=\thr@@
139 \global\dg@LATEXGEOMtrue}%
140 \def\dgt@seee{\dg@DX=\thr@@ \dg@DY=\m@ne \dg@SIZE=\thr@@
141 \global\dg@LATEXGEOMtrue}%
142