summaryrefslogtreecommitdiff
path: root/macros/lamstex/inputs/acompat.tex
blob: 9ac20a9e986356559ae7ea9bc555d9313a2ddbeb (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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
% ACOMPAT.TEX  VERSION 2.0
% COPYRIGHT (C) 1991 BY THE TEXPLORATORS CORPORATION
% ALL RIGHTS RESERVED

% THIS FILE SHOULD NOT BE CHANGED IN ANY WAY. 

%% This file allows certain modifications that might be desired
%% if an old AmS-TeX file has to be run through LamS-TeX.

%% First of all
%%
%%      \manualtags
%%
%% causes \tag to revert to its AmS-TeX usage: instead of
%% simply typing
%%
%%      $$ x=y \tag $$
%%
%% and expecting LamS-TeX to supply the \tag number automatically,
%% one would type an explicit \tag like
%%
%%      $$ x=y \tag 3 $$
%%
%% which would give the tag (3) [the formatting of the tag 
%% number can still be changed with \newstyle\tag].
%%
%% It is possible to specify \manualtags within a group if
%% only part of a paper uses the AmS-TeX conventions.

%% Similarly, the command
%%
%%     \amstexCDs
%%
%% makes \CD act exactly as in AmS-TeX, with no &'s, and 
%% with @>>> and @<<< for horizontal arrows, @ AAA and @ VVV for 
%% vertical arrows, @. for an `empty arrow', @= for a horizontal
%% long equal sign, and @| or @\vert for a vertical long equal sign.
%% Moreover, @))) and @((( can be used for @>>> and @<<< --- an 
%% addition made in version 2.0 of AmS-TeX.
%%
%% \amstexCDs can also be used within a group, in case some \CD's
%% are in the AmS-TeX format, while others are in LamS-TeX format.


%% By the way, once this file has been \input, @>>> and @<<< 
%% can even be used in math mode, outside of commutative diagrams,
%% just as in AmS-TeX, giving the same result as LamS-TeX's 
%% \East and \West. [But you can't use the alternatives @((( and @)))
%% this way.]


%% Although \amstexCDs allows \CD's from an old AmS-TeX file to
%% be used with LamS-TeX, note that these rectangular \CD's will 
%% not look the same as those produced by LamS-TeX.  However,
%% there is also \OCD...\endOCD  (`old \CD'), which gives exactly the
%% same diagrams as ordinary LamS-TeX diagrams, but which requires
%% only rather modest amounts of editing.  For example, instead of
%%
%%      \amstexCDs
%%      $$
%%      \CD
%%      G @)\alpha)\beta) H @= K @>\alpha>\beta > L\\
%%      @VfVgV @AfAgA  @|  @. \\
%%      G' @(\alpha(\beta( H' @. K' @<\alpha<\beta< L'
%%      \endCD
%%      $$
%%
%% you can type
%%
%%      $$
%%      \OCD
%%      G @VfVgV @)\alpha)\beta) H @= K @>\alpha>\beta > L\\
%%      %
%%      G' @(\alpha(\beta( H' @AfAgA @. K' @| @<\alpha<\beta< L'
%%      \endOCD
%%      $$
%%
%% and get a commutative diagram that looks exactly like those normally
%% produced by LamS-TeX.
%%
%% The changes that have to be made are covered by the following rules:
%% 
%% (1) The `rows' with vertical arrows are eliminated.
%% (2) Vertical arrows should instead be placed after the vertex at 
%%     which they start. In other words, @VVV arrows should be placed
%%     after the vertex above, and @AAA arrows should be placed after 
%%     the vertex below; a vertical long equal sign, @| or @\vert, is
%%     to be treated like @AAA (i.e., it is thought of as pointing
%%     upwards).
%% (3) These vertical arrows always go BEFORE any horizontal arrow
%%     at the vertex.
%% (4) Horizontal `empty arrows' are retained, but vertical ones
%%     are eliminated.
%%
%% Note that \OCD...\endOCD will give \tsize labels, the default for
%% commutative diagrams in LamS-TeX, but if \amstexCD's is specified,
%% then \CD...\endCD gives \ssize labels, the default in AmS-TeX. 
%% If you want \OCD...\endOCD to give \ssize labels, type 
%% \ssizeCDlabels\OCD ... \endOCD. 


%% In LamS-TeX, \endCD is actually part of the `syntax' for \CD, not
%% an independent control sequence.  So if you tried 
%%
%%    \define\cd{\CD}
%%    \define\endcd{\endCD}
%%
%% then \cd...\endcd would not work.  However, you could
%%
%%    \define\cd#1\endcd{\CD#1\endCD}
%%
%% and then you could use \cd...\endcd instead of \CD...\endCD. 
%% The same holds for \OCD...\endOCD.  So you could, for example,
%%
%%    \define\ocd#1\endocd{\ssizeCDlabels\OCD#1\endOCD}
%%
%% and then use \ocd...\endocd to have \ssizeCDlabels automatically.
%% (You could even
%%
%%    \predefine\OCDoriginal{\OCD}
%%    \redefine\OCD#1\endOCD{\ssizeCDlabels\OCDoriginal#1\endOCD}
%%
%% if you wanted to use \OCD...\endOCD and have \ssizeCDlabels
%% automatically.)


\catcode`\@=11
\let\alloc@\alloc@
\def\manualtags{\def\maketag@@@@##1\maketag@{\hbox{\tag@S{\tag@F
  \ignorespaces##1\unskip}}}}
\let\CD@\CD
\atdef@>#1>#2>{\ampersand@                                               
 \setboxz@h{$\m@th\ssize\;{#1}\;\;$}%                                    
 \setbox\tw@\hbox{$\m@th\ssize\;{#2}\;\;$}%                               
 \setbox4=\hbox{$\m@th#2$}%                                            
 \ifCD@\global\bigaw@\minCDaw@\else\global\bigaw@\minaw@\fi           
 \ifdim\wdz@>\bigaw@\global\bigaw@\wdz@\fi
 \ifdim\wd\tw@>\bigaw@\global\bigaw@\wd\tw@\fi                            
 \ifCD@\hskip.5em\fi                                                 
 \ifdim\wd4 >\z@
  \mathrel{\mathop{\hbox to\bigaw@{\rightarrowfill}}\limits^{#1}_{#2}}%   
 \else\mathrel{\mathop{\hbox to\bigaw@{\rightarrowfill}}\limits^{#1}}\fi
 \ifCD@\hskip.5em\fi
 \ampersand@}%
\atdef@<#1<#2<{\ampersand@\setboxz@h{$\m@th\ssize\;\;{#1}\;$}%
 \setbox\tw@\hbox{$\m@th\ssize\;\;{#2}\;$}\setbox4=\hbox{$\m@th#2$}%
 \ifCD@\global\bigaw@\minCDaw@\else\global\bigaw@\minaw@\fi
 \ifdim\wdz@>\bigaw@\global\bigaw@\wdz@\fi
 \ifdim\wd\tw@>\bigaw@\global\bigaw@\wd\tw@\fi
 \ifCD@\hskip.5em\fi
 \ifdim\wd4 >\z@
  \mathrel{\mathop{\hbox to\bigaw@{\leftarrowfill}}\limits^{#1}_{#2}}\else
  \mathrel{\mathop{\hbox to\bigaw@{\leftarrowfill}}\limits^{#1}}\fi
 \ifCD@\hskip.5em\fi\ampersand@}
\let\ampersand@\relax
\newdimen\minCDaw@
\minCDaw@2.5pc
\def\minCDarrowwidth#1{\RIfMIfI@\onlydmatherr@\minCDarrowwidth
 \else\minCDaw@#1\relax\fi\else\onlydmatherr@\minCDarrowwidth\fi}
\newdimen\bigaw@
\newif\ifCD@
\def\amstexCDs{%
 \atdef@ A##1A##2A{\llap{$\m@th\vcenter{\hbox
  {$\ssize##1$}}$}\Big\uparrow\rlap{$\m@th\vcenter{\hbox{$\ssize##2$}}$}&&}%
 \atdef@ V##1V##2V{\llap{$\m@th\vcenter{\hbox{$\ssize##1$}}$}%
  \Big\downarrow\rlap{$\m@th\vcenter{\hbox{$\ssize##2$}}$}&&}%
 \atdef@={&\hskip.5em\mathrel
  {\vbox{\hrule width\minCDaw@\vskip3\ex@\hrule width
  \minCDaw@}}\hskip.5em&}%
 \atdef@|{\Big\Vert&&}%
 \atdef@\vert{\Big\Vert&&}%
 \def\pretend##1\haswidth##2{\setboxz@h{$\m@th\scriptstyle{##2}$}\hbox
  to\wdz@{\hfill$\m@th\scriptstyle{##1}$\hfill}}%
 \atdef@.{&&}%
 \atdef@)##1)##2){\ampersand@
  \setboxz@h{$\m@th\ssize\;{##1}\;\;$}%
  \setbox\tw@\hbox{$\m@th\ssize\;{##2}\;\;$}%
  \setbox4=\hbox{$\m@th##2$}%
  \ifCD@
  \global\bigaw@\minCDaw@\else\global\bigaw@\minaw@\fi
  \ifdim\wdz@>\bigaw@\global\bigaw@\wdz@\fi
  \ifdim\wd\tw@>\bigaw@\global\bigaw@\wd\tw@\fi
  \ifCD@\hskip.5em\fi
  \ifdim\wd4 >\z@
   \mathrel{\mathop{\hbox to\bigaw@{\rightarrowfill}}\limits^{##1}_{##2}}%
  \else\mathrel{\mathop{\hbox to\bigaw@{\rightarrowfill}}\limits^{##1}}\fi
  \ifCD@\hskip.5em\fi
  \ampersand@}%
 \atdef@(##1(##2({\ampersand@\setboxz@h{$\m@th\ssize\;\;{##1}\;$}%
  \setbox\tw@\hbox{$\m@th\ssize\;\;{##2}\;$}\setbox4=\hbox{$\m@th##2$}%
  \ifCD@\global\bigaw@\minCDaw@\else\global\bigaw@\minaw@\fi
  \ifdim\wdz@>\bigaw@\global\bigaw@\wdz@\fi
  \ifdim\wd\tw@>\bigaw@\global\bigaw@\wd\tw@\fi
  \ifCD@\hskip.5em\fi
  \ifdim\wd4 >\z@
   \mathrel{\mathop{\hbox to\bigaw@{\leftarrowfill}}\limits^{##1}_{##2}}\else
   \mathrel{\mathop{\hbox to\bigaw@{\leftarrowfill}}\limits^{##1}}\fi
  \ifCD@\hskip.5em\fi\ampersand@}%
 \def\CD{\bgroup
  \vspace@\relax\iffalse{\fi\let\ampersand@&\iffalse}\fi
  \CD@true\vcenter\bgroup\Let@\tabskip\z@skip\baselineskip20\ex@
  \lineskip3\ex@\lineskiplimit3\ex@\halign\bgroup
  &\hfill$\m@th####$\hfill\crcr}
 \def\endCD{\crcr\egroup\egroup\egroup}%
}
\def\OCD{\bgroup
 \DN@{\let\leftparens@}\expandafter\next@\csname\string @(\endcsname
 \atdef@.{&}%
 \atdef@)##1)##2){\options@true\begingroup\optioncodes@
  \L@{##1}\l@{##2}\leftparens@1,0)&}%
 \atdef@>##1>##2>{\options@true\begingroup\optioncodes@
  \L@{##1}\l@{##2}\leftparens@1,0)&}%
 \atdef@(##1(##2({\options@true\begingroup\optioncodes@
  \L@{##1}\l@{##2}\zero@ h\one@ e\leftparens@1,0)&}%
 \atdef@<##1<##2<{\options@true\begingroup\optioncodes@
  \L@{##1}\l@{##2}\zero@ h\one@ e\leftparens@1,0)&}%
 \atdef@ A##1A##2A{\options@true\begingroup\optioncodes@
  \L@{##1}\l@{##2}\leftparens@0,1)}%
 \atdef@ V##1V##2V{\options@true\begingroup\optioncodes@
  \L@{##1}\l@{##2}\leftparens@0,-1)}%
 \atdef@={\options@true\begingroup\optioncodes@
  \a@=\leftparens@1,0)&}%
 \atdef@|{\options@true\begingroup\optioncodes@
  \a@=\leftparens@0,1)}%
 \atdef@\vert{\options@true\begingroup\optioncodes@
  \a@=\leftparens@0,1)}%
 \def\next@##1\endOCD{\CD@##1\endCD\egroup}%
 \next@}
\def\alloc@#1#2#3#4#5{\global\advance\count1#1by\@ne
 \ch@ck#1#4#2\allocationnumber=\count1#1
 \global#3#5=\allocationnumber
 \wlog{\string#5=\string#2\the\allocationnumber}}
\catcode`\@=\active