summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pb-diagram/pb-lams.sty
blob: 33d802966f6409f680f9b39cbfb9b8d023f9b882 (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
134
135
136
137
138
139
140
141
142
% pb-lams.sty: LAMS-TeX font enhancements for pb-diagram.sty
% Author: Paul Burchard <burchard@pobox.com>
% Version Number: 5.0
% Version Date: 20 Oct 1998
%
% Copyright (c) 1997, 1998 by Paul Burchard
%
%	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 *AFTER* pb-diagram.sty and
% lamsarrow.sty.  It should be loaded as follows:
%	\usepackage{pb-diagram,lamsarrow,pb-lams}
%
% This code adds to the "diagram" environment the use of
% fancy arrow heads and tails, as well as additional arrow
% directions.  Most of the options defined here can be
% combined arbitrarily.
%

\@ifundefined{diagram}{%
   \@latexerr{The pb-lams style option requires pb-diagram}%
   {You must include the pb-diagram package prior to pb-lams.}}{}
\@ifundefined{lamsvector}{%
   \@latexerr{The pb-lams style option requires lamsarrow}%
   {You must include the lamsarrow package prior to pb-lams.}}{}

\newif\ifdg@LATEXGEOM \dg@LATEXGEOMfalse

\@namedef{dgo@}{%
   \let\dg@VECTOR=\lamsvector
   \lamsshaft{?}\lamssource{?}\lamstarget{?}%
   \dg@LBLPOS=\dgARROWPARTS \divide\dg@LBLPOS\tw@\relax}%
\@namedef{dgo@..}{\lamsshaft{.}}%
\@namedef{dgo@<>}{\lamssource{^}\lamstarget{^}}%
\@namedef{dgo@=}{\lamsshaft{=}}%
\@namedef{dgo@-}{\lamstarget{0}}%
\@namedef{dgo@'}{\lamstarget{'}}%
\@namedef{dgo@`}{\lamstarget{`}}%
\@namedef{dgo@A}{\lamstarget{A}}%
\@namedef{dgo@V}{\lamssource{V}}%
\@namedef{dgo@J}{\lamssource{J}}%
\@namedef{dgo@L}{\lamssource{L}}%
\@namedef{dgo@S}{\lamssource{S}}%
%
% approximate aspect ratio by half-integer betw 1/2 and 3
% (or betw 1/2 and 2 if 3:1 arrow detected)
%
\def\dggeometry{
   \dg@ZTEMP=\dg@XGRID \multiply\dg@ZTEMP\tw@
   \ifnum\dg@YGRID=\z@ \dg@ZTEMP=\tw@
   \else \divide\dg@ZTEMP\dg@YGRID \fi
   % font limit cutoffs
   \ifnum\dg@ZTEMP>6\relax \dg@ZTEMP=6\relax \fi
   \ifdg@LATEXGEOM\ifnum\dg@ZTEMP>\f@ur \dg@ZTEMP=\f@ur \fi\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
   \dg@LATEXGEOMfalse}
%
% Bugwards-compatibility mode for versions 3.6 and earlier.
% Enable it with \let\dggeometry=\dgoldgeometry
%
\def\dgoldgeometry{
   \dg@ZTEMP=\dg@XGRID \multiply\dg@ZTEMP\tw@
   \ifnum\dg@YGRID=\z@ \dg@ZTEMP=\tw@
   \else \divide\dg@ZTEMP\dg@YGRID \fi
   % font limit cutoffs
   \ifnum\dg@ZTEMP>6\relax \dg@ZTEMP=6\relax \fi
   \ifdg@LATEXGEOM\ifnum\dg@ZTEMP>\f@ur \dg@ZTEMP=\f@ur \fi\fi
   \ifnum\dg@ZTEMP<\@ne \dg@ZTEMP=\@ne \fi
   % The following calculation is garbled!
   \unitlength=2sp\relax
   \ifnum\dg@ZTEMP<\tw@
      % round aspect ratio up toward 2:2, widen rect
      \advance\dg@ZTEMP\@ne
      \multiply\unitlength\dg@YGRID \divide\unitlength\tw@
   \else
      % round aspect ratio down toward 2:2, tallen rect
      \multiply\unitlength\dg@XGRID \divide\unitlength\dg@ZTEMP
   \fi
   \dg@XGRID=\dg@ZTEMP \dg@YGRID=\tw@
   \dg@rmcommondiv\tw@\dg@XGRID\dg@YGRID
   \divide\unitlength\dg@YGRID \divide\unitlength\@m
   \dg@LATEXGEOMfalse}
%
% new directions
\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@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@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@nnnee{\dg@DX=\tw@ \dg@DY=\thr@@ \dg@SIZE=\tw@}%
\def\dgt@nnnww{\dg@DX=-\tw@ \dg@DY=\thr@@ \dg@SIZE=\tw@}%
\def\dgt@sssww{\dg@DX=-\tw@ \dg@DY=-\thr@@ \dg@SIZE=\tw@}%
\def\dgt@sssee{\dg@DX=\tw@ \dg@DY=-\thr@@ \dg@SIZE=\tw@}%
%
% these are only drawn approx correct in some aspect ratios:
\def\dgt@nneee{\dg@DX=\thr@@ \dg@DY=\tw@ \dg@SIZE=\thr@@}%
\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@sseee{\dg@DX=\thr@@ \dg@DY=-\tw@ \dg@SIZE=\thr@@}%
%
% these only work with LaTeX-compatible aspect ratios:
% must set this globally to see it later!!!
\def\dgt@neee{\dg@DX=\thr@@ \dg@DY=\@ne \dg@SIZE=\thr@@
   \global\dg@LATEXGEOMtrue}%
\def\dgt@nwww{\dg@DX=-\thr@@ \dg@DY=\@ne \dg@SIZE=\thr@@
   \global\dg@LATEXGEOMtrue}%
\def\dgt@swww{\dg@DX=-\thr@@ \dg@DY=\m@ne \dg@SIZE=\thr@@
   \global\dg@LATEXGEOMtrue}%
\def\dgt@seee{\dg@DX=\thr@@ \dg@DY=\m@ne \dg@SIZE=\thr@@
   \global\dg@LATEXGEOMtrue}%