1
% This should appear in a file named diagram.tex
2
% Copyright 1988,1989 Michael Barr
3
% Department of Mathematics and Statistics
5
% 805 Sherbrooke St., W
6
% Montreal, Quebec, Canada
9
% barr@triples.math.mcgill.ca
11
% All commercial rights reserved. May be freely distributed
12
% and used with the following exceptions:
13
% 1. No commercial use without explicit permission.
14
% 2. It may not be used by any employee of a telephone
16
% 3. It may not be distributed without this notice.
18
% Last revised 91-05-04
20
% Ascii character test:
21
% 32: 33: ! 34: " 35: # 36: $ 37: % 38: & 39: '
22
% 40: ( 41: ) 42: * 43: + 44: , 45: - 46: . 47: /
23
% 48: 0 49: 1 50: 2 51: 3 52: 4 53: 5 54: 6 55: 7
24
% 56: 8 57: 9 58: : 59: ; 60: < 61: = 62: > 63: ?
25
% 64: @ 65: A 66: B 67: C 68: D 69: E 70: F 71: G
26
% 72: H 73: I 74: J 75: K 76: L 77: M 78: N 79: O
27
% 80: P 81: Q 82: R 83: S 84: T 85: U 86: V 87: W
28
% 88: X 89: Y 90: Z 91: [ 92: \ 93: ] 94: ^ 95: _
29
% 96: ` 97: a 98: b 99: c 100: d 101: e 102: f 103: g
30
% 104: h 105: i 106: j 107: k 108: l 109: m 110: n 111: o
31
% 112: p 113: q 114: r 115: s 116: t 117: u 118: v 119: w
32
% 120: x 121: y 122: z 123: { 124: | 125: } 126: ~
37
\def\diagram{\m@th\leftwidth=\z@ \rightwidth=\z@ \topheight=\z@
38
\botheight=\z@ \setbox\@picbox\hbox\bgroup}
40
\def\enddiagram{\egroup\wd\@picbox\rightwidth\unitlength
41
\ht\@picbox\topheight\unitlength \dp\@picbox\botheight\unitlength
42
\hskip\leftwidth\unitlength\box\@picbox}
44
\def\bfig{\begin{diagram}}
45
\def\efig{\end{diagram}}
46
\newcount\wideness \newcount\leftwidth \newcount\rightwidth
47
\newcount\highness \newcount\topheight \newcount\botheight
49
\def\ratchet#1#2{\ifnum#1<#2 \global #1=#2 \fi}
51
\def\putbox(#1,#2)#3{%
52
\horsize{\wideness}{#3} \divide\wideness by 2
53
{\advance\wideness by #1 \ratchet{\rightwidth}{\wideness}}
54
{\advance\wideness by -#1 \ratchet{\leftwidth}{\wideness}}
55
\vertsize{\highness}{#3} \divide\highness by 2
56
{\advance\highness by #2 \ratchet{\topheight}{\highness}}
57
{\advance\highness by -#2 \ratchet{\botheight}{\highness}}
58
\put(#1,#2){\makebox(0,0){$#3$}}}
60
\def\putlbox(#1,#2)#3{%
61
\horsize{\wideness}{#3}
62
{\advance\wideness by #1 \ratchet{\rightwidth}{\wideness}}
63
{\ratchet{\leftwidth}{-#1}}
64
\vertsize{\highness}{#3} \divide\highness by 2
65
{\advance\highness by #2 \ratchet{\topheight}{\highness}}
66
{\advance\highness by -#2 \ratchet{\botheight}{\highness}}
67
\put(#1,#2){\makebox(0,0)[l]{$#3$}}}
69
\def\putrbox(#1,#2)#3{%
70
\horsize{\wideness}{#3}
71
{\ratchet{\rightwidth}{#1}}
72
{\advance\wideness by -#1 \ratchet{\leftwidth}{\wideness}}
73
\vertsize{\highness}{#3} \divide\highness by 2
74
{\advance\highness by #2 \ratchet{\topheight}{\highness}}
75
{\advance\highness by -#2 \ratchet{\botheight}{\highness}}
76
\put(#1,#2){\makebox(0,0)[r]{$#3$}}}
79
\def\adjust[#1]{} % For compatibility
104
\newcount\arrowlength
110
\newsavebox{\tempboxa}%
111
\newsavebox{\tempboxb}%
112
\newsavebox{\tempboxc}%
116
\def\setw@dth#1#2{\setbox\z@\hbox{\m@th$#1$}\w@dth=\wd\z@
117
\setbox\@ne\hbox{\m@th$#2$}\ifnum\w@dth<\wd\@ne \w@dth=\wd\@ne \fi
118
\advance\w@dth by 1.2em}
120
%The definitions below look more elaborate than they need to be.
121
%The reason is that an empty asscript will still cause extra vertical
122
%spacing and the only way to avoid ugly extra space seems to be using
123
%some such method as this.
125
\def\t@^#1_#2{\allowbreak\def\n@one{#1}\def\n@two{#2}\mathrel
127
\mathop{\hbox to \w@dth{\rightarrowfill}}\limits
128
\ifx\n@one\empty\else ^{\box\z@}\fi
129
\ifx\n@two\empty\else _{\box\@ne}\fi}}
130
%\def\t@^#1_#2{\mathrel{\mathop{\hbox{\rightarrowfill}}\limits
131
%^{\mkern12mu#1\mkern12mu}_{\mkern12mu#2\mkern12mu}}}
132
\def\t@@^#1{\@ifnextchar_{\t@^{#1}}{\t@^{#1}_{}}}
133
\def\to{\@ifnextchar^{\t@@}{\t@@^{}}}
135
\def\t@left^#1_#2{\def\n@one{#1}\def\n@two{#2}\mathrel{\setw@dth{#1}{#2}
136
\mathop{\hbox to \w@dth{\leftarrowfill}}\limits
137
\ifx\n@one\empty\else ^{\box\z@}\fi
138
\ifx\n@two\empty\else _{\box\@ne}\fi}}
139
%\def\t@left^#1_#2{\mathrel{\mathop{\hbox{\leftarrowfill}}\limits
140
%^{\mkern12mu#1\mkern12mu}_{\mkern12mu#2\mkern12mu}}}
141
\def\t@@left^#1{\@ifnextchar_{\t@left^{#1}}{\t@left^{#1}_{}}}
142
\def\toleft{\@ifnextchar^{\t@@left}{\t@@left^{}}}
144
\def\two@^#1_#2{\allowbreak
145
\def\n@one{#1}\def\n@two{#2}\mathrel{\setw@dth{#1}{#2}
146
\mathop{\vcenter{\lineskip\z@\baselineskip\z@
147
\hbox to \w@dth{\rightarrowfill}%
148
\hbox to \w@dth{\rightarrowfill}}%
150
\ifx\n@one\empty\else ^{\box\z@}\fi
151
\ifx\n@two\empty\else _{\box\@ne}\fi}}
152
\def\tw@@^#1{\@ifnextchar _{\two@^{#1}}{\two@^{#1}_{}}}
153
\def\two{\@ifnextchar ^{\tw@@}{\tw@@^{}}}
155
\def\tofr@^#1_#2{\def\n@one{#1}\def\n@two{#2}\mathrel{\setw@dth{#1}{#2}
156
\mathop{\vcenter{\hbox to \w@dth{\rightarrowfill}\kern-1.7ex
157
\hbox to \w@dth{\leftarrowfill}}%
159
\ifx\n@one\empty\else ^{\box\z@}\fi
160
\ifx\n@two\empty\else _{\box\@ne}\fi}}
161
\def\t@fr@^#1{\@ifnextchar_ {\tofr@^{#1}}{\tofr@^{#1}_{}}}
162
\def\tofro{\@ifnextchar^ {\t@fr@}{\t@fr@^{}}}
164
\def\epi{\mathop{\mathchar"221\mkern -12mu\mathchar"221}\limits}
165
\def\leftepi{\mathop{\mathchar"220\mkern -12mu\mathchar"220}\limits}
166
\def\mon{\mathop{\m@th\hbox to
167
14.6\P@{\lasyb\char'51\hskip-2.1\P@$\arrext$\hss
168
$\mathord\rightarrow$}}\limits} % width of \epi
169
\def\leftmono{\mathrel{\m@th\hbox to
170
14.6\P@{$\mathord\leftarrow$\hss$\arrext$\hskip-2.1\P@\lasyb\char'50%
171
}}\limits} % width of \epi
172
\mathchardef\arrext="0200 % amr minus for arrow extension (see \into)
175
\setlength{\unitlength}{.01em}%
176
\def\settypes(#1,#2,#3){\arrowtypea#1 \arrowtypeb#2 \arrowtypec#3}
177
\def\settoheight#1#2{\setbox\@tempboxa\hbox{#2}#1\ht\@tempboxa\relax}%
178
\def\settodepth#1#2{\setbox\@tempboxa\hbox{#2}#1\dp\@tempboxa\relax}%
179
\def\settokens`#1`#2`#3`#4`{%
180
\def\tokena{#1}\def\tokenb{#2}\def\tokenc{#3}\def\tokend{#4}}
181
\def\setsqparms[#1`#2`#3`#4;#5`#6]{%
189
\def\setpos(#1,#2){\xpos=#1 \ypos#2}
193
\def\settriparms[#1`#2`#3;#4]{\settripairparms[#1`#2`#3`1`1;#4]}%
195
\def\settripairparms[#1`#2`#3`#4`#5;#6]{%
205
\def\resetparms{\settripairparms[1`1`1`1`1;500]\width 500}%default values%
209
\def\mvector(#1,#2)#3{%%
210
\put(0,0){\vector(#1,#2){#3}}%
211
\put(0,0){\vector(#1,#2){26}}%
213
\def\evector(#1,#2)#3{{%%
215
\put(0,0){\vector(#1,#2){\arrowlength}}%
216
\advance \arrowlength by-30
217
\put(0,0){\vector(#1,#2){\arrowlength}}%
221
\settowidth{\tempdimen}{$#2$}%
223
\divide #1 by\unitlength
227
\settoheight{\tempdimen}{$#2$}%
229
\settodepth{\tempdimen}{$#2$}%
230
\advance #1 by\tempdimen
231
\divide #1 by\unitlength
234
\def\putvector(#1,#2)(#3,#4)#5#6{{%
236
\putdashvector(#1,#2)(#3,#4)#5\arrowtype
239
\putdashvector(#1,#2)(#3,#4)#5\arrowtype
248
\advance \ypos by-\arrowlength
250
\tempcounta \arrowlength
251
\multiply \tempcounta by\rise
252
\divide \tempcounta by\run
254
\advance \xpos by\arrowlength
255
\advance \ypos by\tempcounta
257
\advance \xpos by-\arrowlength
258
\advance \ypos by-\tempcounta
261
\multiply \arrowtype by-1
266
\or \put(\xpos,\ypos){\vector(\run,\rise){\arrowlength}}%
267
\or \put(\xpos,\ypos){\mvector(\run,\rise)\arrowlength}%
268
\or \put(\xpos,\ypos){\evector(\run,\rise){\arrowlength}}%
272
\def\putsplitvector(#1,#2)#3#4{%%
279
\advance \halflength by-\gap
280
\divide \halflength by2
283
\or \put(\xpos,\ypos){\line(0,-1){\halflength}}%
284
\advance\ypos by-\halflength
285
\advance\ypos by-\gap
286
\put(\xpos,\ypos){\vector(0,-1){\halflength}}%
287
\or \put(\xpos,\ypos){\line(0,-1)\halflength}%
288
\put(\xpos,\ypos){\vector(0,-1)3}%
289
\advance\ypos by-\halflength
290
\advance\ypos by-\gap
291
\put(\xpos,\ypos){\vector(0,-1){\halflength}}%
292
\or \put(\xpos,\ypos){\line(0,-1)\halflength}%
293
\advance\ypos by-\halflength
294
\advance\ypos by-\gap
295
\put(\xpos,\ypos){\evector(0,-1){\halflength}}%
297
\else \arrowtype=-\arrowtype
299
\or \advance \ypos by-\arrowlength
300
\put(\xpos,\ypos){\line(0,1){\halflength}}%
301
\advance\ypos by\halflength
303
\put(\xpos,\ypos){\vector(0,1){\halflength}}%
304
\or \advance \ypos by-\arrowlength
305
\put(\xpos,\ypos){\line(0,1)\halflength}%
306
\put(\xpos,\ypos){\vector(0,1)3}%
307
\advance\ypos by\halflength
309
\put(\xpos,\ypos){\vector(0,1){\halflength}}%
310
\or \advance \ypos by-\arrowlength
311
\put(\xpos,\ypos){\line(0,1)\halflength}%
312
\advance\ypos by\halflength
314
\put(\xpos,\ypos){\evector(0,1){\halflength}}%
319
\def\putmorphism(#1)(#2,#3)[#4`#5`#6]#7#8#9{{%
323
\puthmorphism(#1)[#4`#5`#6]{#7}{#8}#9%
325
\putvmorphism(#1)[#4`#5`#6]{#7}{#8}#9%
344
\arrowtype=-\arrowtype
347
\multiply \width by\run
348
\divide \width by\rise
349
\ifnum \width<0 \width=-\width\fi
351
\if l#9 \width=-\width\fi
352
\putbox(\xpos,\ypos){#4}% %node 1
353
{\multiply \coefa by\arrowlength% %node 2
354
\advance\xpos by\coefa
355
\multiply \coefa by\rise
356
\divide \coefa by\run
357
\advance \ypos by\coefa
358
\putbox(\xpos,\ypos){#5} }%
359
{\multiply \coefa by\arrowlength% %label
361
\advance \xpos by\coefa
362
\advance \xpos by\width
363
\multiply \coefa by\rise
364
\divide \coefa by\run
365
\advance \ypos by\coefa
367
\putrbox(\xpos,\ypos){#6}%
369
\putlbox(\xpos,\ypos){#6}%
371
{\multiply \rise by-\coefc% %arrow
372
\multiply \run by-\coefc
373
\multiply \coefb by\arrowlength
374
\advance \xpos by\coefb
375
\multiply \coefb by\rise
376
\divide \coefb by\run
377
\advance \ypos by\coefb
378
\multiply \coefc by70
379
\advance \ypos by\coefc
380
\multiply \coefc by\run
381
\divide \coefc by\rise
382
\advance \xpos by\coefc
383
\multiply \coefa by140
384
\multiply \coefa by\run
385
\divide \coefa by\rise
386
\advance \arrowlength by\coefa
388
\or \put(\xpos,\ypos){\vector(\run,\rise){\arrowlength}}%
389
\or \put(\xpos,\ypos){\mvector(\run,\rise){\arrowlength}}%
390
\or \put(\xpos,\ypos){\evector(\run,\rise){\arrowlength}}%
394
\newcount\numbdashes \newcount\lengthdash \newcount\increment
396
\def\howmanydashes{% Actually returns both number and length
397
\numbdashes=\arrowlength \lengthdash=40
398
\divide\numbdashes by \lengthdash
399
\lengthdash=\arrowlength
400
\divide\lengthdash by \numbdashes
401
%This futzing around is to minimize round-off error.
402
\increment=\lengthdash
403
\multiply\lengthdash by 3
404
\divide\lengthdash by 5
407
\def\putdashvector(#1)(#2,#3)#4#5{%
408
\ifnum#3=0 \putdashhvector(#1){#4}#5
411
\putdashvvector(#1){#4}#5\fi\fi}
413
\def\putdashhvector(#1,#2)#3#4{{%
414
\arrowlength=#3 \howmanydashes
415
\multiput(#1,#2)(\increment,0){\numbdashes}%
416
{\vrule height .4pt width \lengthdash\unitlength}
417
\arrowtype=#4 \xpos=#1
418
\ifnum\arrowtype<0 \advance\arrowtype by 7 \fi
420
\or \advance\xpos by 10
421
\put(\xpos,#2){\vector(-1,0){\lengthdash}}
423
\put(\xpos,#2){\vector(-1,0){\lengthdash}}
424
\or \advance \xpos by 10
425
\put(\xpos,#2){\vector(-1,0){\lengthdash}}
426
\advance\xpos by \arrowlength
428
\put(\xpos,#2){\vector(-1,0){\lengthdash}}
429
\or \advance\xpos by 10
430
\put(\xpos,#2){\vector(-1,0){\lengthdash}}
431
\or \advance\xpos by \arrowlength
432
\advance\xpos by -\lengthdash
433
\put(\xpos,#2){\vector(1,0){\lengthdash}}
434
\or {\advance\xpos by 10
435
\put(\xpos,#2){\vector(1,0){\lengthdash}}}
436
\advance\xpos by \arrowlength
437
\advance\xpos by -\lengthdash
438
\put(\xpos,#2){\vector(1,0){\lengthdash}}
439
\or \advance\xpos by \arrowlength
440
\advance\xpos by -\lengthdash
441
\put(\xpos,#2){\vector(1,0){\lengthdash}}
443
\put(\xpos,#2){\vector(1,0){\lengthdash}}
447
\def\putdashvvector(#1,#2)#3#4{{%
448
\arrowlength=#3 \howmanydashes
449
\ypos=#2 \advance\ypos by -\arrowlength
450
\multiput(#1,#2)(0,\increment){\numbdashes}%
451
{\vrule width .4pt height \lengthdash\unitlength}
452
\arrowtype=#4 \ypos=#2
453
\ifnum\arrowtype<0 \advance\arrowtype by 7 \fi
455
\or \advance\ypos by \arrowlength \advance\ypos by -40
456
\put(#1,\ypos){\vector(0,1){\lengthdash}}
458
\put(#1,\ypos){\vector(0,1){\lengthdash}}
459
\or \advance\ypos by 10
460
\put(#1,\ypos){\vector(0,1){\lengthdash}}
461
\advance\ypos by \arrowlength \advance\ypos by -40
462
\put(#1,\ypos){\vector(0,1){\lengthdash}}
463
\or \advance\ypos by \arrowlength \advance\ypos by -40
464
\put(#1,\ypos){\vector(0,1){\lengthdash}}
465
\or \advance\ypos by 10
466
\put(#1,\ypos){\vector(0,-1){\lengthdash}}
467
\or \advance\ypos by 10
468
\put(#1,\ypos){\vector(0,-1){\lengthdash}}
469
\advance\ypos by \arrowlength \advance\ypos by -40
470
\put(#1,\ypos){\vector(0,-1){\lengthdash}}
471
\or \advance\ypos by 10
472
\put(#1,\ypos){\vector(0,-1){\lengthdash}}
474
\put(#1,\ypos){\vector(0,-1){\lengthdash}}
478
\def\puthmorphism(#1,#2)[#3`#4`#5]#6#7#8{{%
484
\putbox(\xpos,\ypos){#3\vphantom{#4}}%
485
{\advance \xpos by\arrowlength
486
\putbox(\xpos,\ypos){\vphantom{#3}#4}}%
487
\horsize{\tempcounta}{#3}%
488
\horsize{\tempcountb}{#4}%
489
\divide \tempcounta by2
490
\divide \tempcountb by2
491
\advance \tempcounta by30
492
\advance \tempcountb by30
493
\advance \xpos by\tempcounta
494
\advance \arrowlength by-\tempcounta
495
\advance \arrowlength by-\tempcountb
496
\putvector(\xpos,\ypos)(1,0)\arrowlength\arrowtype
497
\divide \arrowlength by2
498
\advance \xpos by\arrowlength
499
\vertsize{\tempcounta}{#5}%
500
\divide\tempcounta by2
501
\advance \tempcounta by20
503
\advance \ypos by\tempcounta
504
\putbox(\xpos,\ypos){#5}%
506
\advance \ypos by-\tempcounta
507
\putbox(\xpos,\ypos){#5}%
510
\def\putvmorphism(#1,#2)[#3`#4`#5]#6#7#8{{%
515
\settowidth{\xlen}{$#5$}%
516
\putbox(\xpos,\ypos){#3}%
517
{\advance \ypos by-\arrowlength
518
\putbox(\xpos,\ypos){#4}}%
519
{\advance\arrowlength by-140
523
\putsplitvector(\xpos,\ypos)\arrowlength\arrowtype
525
\putvector(\xpos,\ypos)(0,-1)\arrowlength\arrowtype
528
\putvector(\xpos,\ypos)(0,-1)\arrowlength\arrowtype
531
\divide \arrowlength by2
532
\advance\ypos by-\arrowlength
535
\putrbox(\xpos,\ypos){#5}%
538
\putlbox(\xpos,\ypos){#5}%
540
\putbox(\xpos,\ypos){#5}%
545
\def\putsquarep<#1>(#2)[#3;#4`#5`#6`#7]{{%
549
\puthmorphism(\xpos,\ypos)[\tokenc`\tokend`{#7}]{\width}{\arrowtyped}b%
550
\advance\ypos by \height
551
\puthmorphism(\xpos,\ypos)[\tokena`\tokenb`{#4}]{\width}{\arrowtypea}a%
552
\putvmorphism(\xpos,\ypos)[``{#5}]{\height}{\arrowtypeb}l%
553
\advance\xpos by \width
554
\putvmorphism(\xpos,\ypos)[``{#6}]{\height}{\arrowtypec}r%
557
\def\putsquare{\@ifnextchar <{\putsquarep}{\putsquarep%
558
<\arrowtypea`\arrowtypeb`\arrowtypec`\arrowtyped;\width`\height>}}
559
\def\square{\@ifnextchar< {\squarep}{\squarep
560
<\arrowtypea`\arrowtypeb`\arrowtypec`\arrowtyped;\width`\height>}}
562
\def\squarep<#1>[#2`#3`#4`#5;#6`#7`#8`#9]{{% % #2------>#3
563
\setsqparms[#1]% % | |
565
\putsquarep<\arrowtypea`\arrowtypeb`\arrowtypec`% % #7| |#8
566
\arrowtyped;\width`\height>% % | |
567
(0,0)[#2`#3`#4`{#5};#6`#7`#8`{#9}]% % | |
571
\def\putptrianglep<#1>(#2,#3)[#4`#5`#6;#7`#8`#9]{{%
574
\advance\ypos by \height
575
\puthmorphism(\xpos,\ypos)[#4`#5`{#7}]{\height}{\arrowtypea}a%
576
\putvmorphism(\xpos,\ypos)[`#6`{#8}]{\height}{\arrowtypeb}l%
577
\advance\xpos by\height
578
\putmorphism(\xpos,\ypos)(-1,-1)[``{#9}]{\height}{\arrowtypec}r%
581
\def\putptriangle{\@ifnextchar <{\putptrianglep}{\putptrianglep
582
<\arrowtypea`\arrowtypeb`\arrowtypec;\height>}}
583
\def\ptriangle{\@ifnextchar <{\ptrianglep}{\ptrianglep
584
<\arrowtypea`\arrowtypeb`\arrowtypec;\height>}}
586
\def\ptrianglep<#1>[#2`#3`#4;#5`#6`#7]{{%% % #2----->#3
587
\settriparms[#1]% % | /
589
\putptrianglep<\arrowtypea`\arrowtypeb`% % #6| /#7
590
\arrowtypec;\height>% % | /
591
(0,0)[#2`#3`#4;#5`#6`{#7}]% % | /
595
\def\putqtrianglep<#1>(#2,#3)[#4`#5`#6;#7`#8`#9]{{%
598
\advance\ypos by\height
599
\puthmorphism(\xpos,\ypos)[#4`#5`{#7}]{\height}{\arrowtypea}a%
600
\putmorphism(\xpos,\ypos)(1,-1)[``{#8}]{\height}{\arrowtypeb}l%
601
\advance\xpos by\height
602
\putvmorphism(\xpos,\ypos)[`#6`{#9}]{\height}{\arrowtypec}r%
605
\def\putqtriangle{\@ifnextchar <{\putqtrianglep}{\putqtrianglep
606
<\arrowtypea`\arrowtypeb`\arrowtypec;\height>}}
607
\def\qtriangle{\@ifnextchar <{\qtrianglep}{\qtrianglep
608
<\arrowtypea`\arrowtypeb`\arrowtypec;\height>}}
610
\def\qtrianglep<#1>[#2`#3`#4;#5`#6`#7]{{%% % #2----->#3
611
\settriparms[#1]% % \ |
614
\putqtrianglep<\arrowtypea`\arrowtypeb`% % \ |
615
\arrowtypec;\height>% % \ |
616
(0,0)[#2`#3`#4;#5`#6`{#7}]% % v v
620
\def\putdtrianglep<#1>(#2,#3)[#4`#5`#6;#7`#8`#9]{{%
623
\puthmorphism(\xpos,\ypos)[#5`#6`{#9}]{\height}{\arrowtypec}b%
624
\advance\xpos by \height \advance\ypos by\height
625
\putmorphism(\xpos,\ypos)(-1,-1)[``{#7}]{\height}{\arrowtypea}l%
626
\putvmorphism(\xpos,\ypos)[#4``{#8}]{\height}{\arrowtypeb}r%
629
\def\putdtriangle{\@ifnextchar <{\putdtrianglep}{\putdtrianglep
630
<\arrowtypea`\arrowtypeb`\arrowtypec;\height>}}
631
\def\dtriangle{\@ifnextchar <{\dtrianglep}{\dtrianglep
632
<\arrowtypea`\arrowtypeb`\arrowtypec;\height>}}
634
\def\dtrianglep<#1>[#2`#3`#4;#5`#6`#7]{{%% % / |
635
\settriparms[#1]% % / |
636
\width=\height % #5/ |#6
638
\putdtrianglep<\arrowtypea`\arrowtypeb`% % / |
639
\arrowtypec;\height>% % v v
640
(0,0)[#2`#3`#4;#5`#6`{#7}]% % #3----->#4
644
\def\putbtrianglep<#1>(#2,#3)[#4`#5`#6;#7`#8`#9]{{%
647
\puthmorphism(\xpos,\ypos)[#5`#6`{#9}]{\height}{\arrowtypec}b%
648
\advance\ypos by\height
649
\putmorphism(\xpos,\ypos)(1,-1)[``{#8}]{\height}{\arrowtypeb}r%
650
\putvmorphism(\xpos,\ypos)[#4``{#7}]{\height}{\arrowtypea}l%
653
\def\putbtriangle{\@ifnextchar <{\putbtrianglep}{\putbtrianglep
654
<\arrowtypea`\arrowtypeb`\arrowtypec;\height>}}
655
\def\btriangle{\@ifnextchar <{\btrianglep}{\btrianglep
656
<\arrowtypea`\arrowtypeb`\arrowtypec;\height>}}
658
\def\btrianglep<#1>[#2`#3`#4;#5`#6`#7]{{%% % | \
659
\settriparms[#1]% % | \
660
\width=\height % #5| \#6
662
\putbtrianglep<\arrowtypea`\arrowtypeb`% % | \
663
\arrowtypec;\height>% % v v
664
(0,0)[#2`#3`#4;#5`#6`{#7}]% % #3----->#4
668
\def\putAtrianglep<#1>(#2,#3)[#4`#5`#6;#7`#8`#9]{{%
671
{\multiply \height by2
672
\puthmorphism(\xpos,\ypos)[#5`#6`{#9}]{\height}{\arrowtypec}b}%
673
\advance\xpos by\height \advance\ypos by\height
674
\putmorphism(\xpos,\ypos)(-1,-1)[#4``{#7}]{\height}{\arrowtypea}l%
675
\putmorphism(\xpos,\ypos)(1,-1)[``{#8}]{\height}{\arrowtypeb}r%
678
\def\putAtriangle{\@ifnextchar <{\putAtrianglep}{\putAtrianglep
679
<\arrowtypea`\arrowtypeb`\arrowtypec;\height>}}
680
\def\Atriangle{\@ifnextchar <{\Atrianglep}{\Atrianglep
681
<\arrowtypea`\arrowtypeb`\arrowtypec;\height>}}
683
\def\Atrianglep<#1>[#2`#3`#4;#5`#6`#7]{{%% % / \
684
\settriparms[#1]% % / \
685
\width=\height % #5/ \#6
687
\putAtrianglep<\arrowtypea`\arrowtypeb`% % / \
688
\arrowtypec;\height>% % v v
689
(0,0)[#2`#3`#4;#5`#6`{#7}]% % #3------------>#4
693
\def\putAtrianglepairp<#1>(#2)[#3;#4`#5`#6`#7`#8]{{%
694
\settripairparms[#1]%
697
\puthmorphism(\xpos,\ypos)[\tokenb`\tokenc`{#7}]{\height}{\arrowtyped}b%
698
\advance\xpos by\height
699
\puthmorphism(\xpos,\ypos)[\phantom{\tokenc}`\tokend`{#8}]%
700
{\height}{\arrowtypee}b%
701
\advance\ypos by\height
702
\putmorphism(\xpos,\ypos)(-1,-1)[\tokena``{#4}]{\height}{\arrowtypea}l%
703
\putvmorphism(\xpos,\ypos)[``{#5}]{\height}{\arrowtypeb}m%
704
\putmorphism(\xpos,\ypos)(1,-1)[``{#6}]{\height}{\arrowtypec}r%
707
\def\putAtrianglepair{\@ifnextchar <{\putAtrianglepairp}{\putAtrianglepairp%
708
<\arrowtypea`\arrowtypeb`\arrowtypec`\arrowtyped`\arrowtypee;\height>}}
709
\def\Atrianglepair{\@ifnextchar <{\Atrianglepairp}{\Atrianglepairp%
710
<\arrowtypea`\arrowtypeb`\arrowtypec`\arrowtyped`\arrowtypee;\height>}}
712
\def\Atrianglepairp<#1>[#2;#3`#4`#5`#6`#7]{{% % #2a
713
\settripairparms[#1]% % / | \
714
\settokens`#2`% % / | \
715
\width=\height % #3/ #4 \#5
717
\putAtrianglepairp % / | \
718
<\arrowtypea`\arrowtypeb`\arrowtypec`% % v v v
719
\arrowtyped`\arrowtypee;\height>% % #2b---->#2c---->#2d
720
(0,0)[{#2};#3`#4`#5`#6`{#7}]% % #6 #7
724
\def\putVtrianglep<#1>(#2,#3)[#4`#5`#6;#7`#8`#9]{{%
727
\advance\ypos by\height
728
{\multiply\height by2
729
\puthmorphism(\xpos,\ypos)[#4`#5`{#7}]{\height}{\arrowtypea}a}%
730
\putmorphism(\xpos,\ypos)(1,-1)[`#6`{#8}]{\height}{\arrowtypeb}l%
731
\advance\xpos by\height
732
\advance\xpos by\height
733
\putmorphism(\xpos,\ypos)(-1,-1)[``{#9}]{\height}{\arrowtypec}r%
736
\def\putVtriangle{\@ifnextchar <{\putVtrianglep}{\putVtrianglep
737
<\arrowtypea`\arrowtypeb`\arrowtypec;\height>}}
738
\def\Vtriangle{\@ifnextchar <{\Vtrianglep}{\Vtrianglep
739
<\arrowtypea`\arrowtypeb`\arrowtypec;\height>}}
741
\def\Vtrianglep<#1>[#2`#3`#4;#5`#6`#7]{{%% % #2------------->#3
742
\settriparms[#1]% % \ /
745
\putVtrianglep<\arrowtypea`\arrowtypeb`% % \ /
746
\arrowtypec;\height>% % \ /
747
(0,0)[#2`#3`#4;#5`#6`{#7}]% % v v
751
\def\putVtrianglepairp<#1>(#2)[#3;#4`#5`#6`#7`#8]{{
752
\settripairparms[#1]%
755
\advance\ypos by\height
756
\putmorphism(\xpos,\ypos)(1,-1)[`\tokend`{#6}]{\height}{\arrowtypec}l%
757
\puthmorphism(\xpos,\ypos)[\tokena`\tokenb`{#4}]{\height}{\arrowtypea}a%
758
\advance\xpos by\height
759
\puthmorphism(\xpos,\ypos)[\phantom{\tokenb}`\tokenc`{#5}]%
760
{\height}{\arrowtypeb}a%
761
\putvmorphism(\xpos,\ypos)[``{#7}]{\height}{\arrowtyped}m%
762
\advance\xpos by\height
763
\putmorphism(\xpos,\ypos)(-1,-1)[``{#8}]{\height}{\arrowtypee}r%
766
\def\putVtrianglepair{\@ifnextchar <{\putVtrianglepairp}{\putVtrianglepairp%
767
<\arrowtypea`\arrowtypeb`\arrowtypec`\arrowtyped`\arrowtypee;\height>}}
768
\def\Vtrianglepair{\@ifnextchar <{\Vtrianglepairp}{\Vtrianglepairp%
769
<\arrowtypea`\arrowtypeb`\arrowtypec`\arrowtyped`\arrowtypee;\height>}}
771
\def\Vtrianglepairp<#1>[#2;#3`#4`#5`#6`#7]{{% % #2a---->#2b---->#2c
772
\settripairparms[#1]% % \ | /
773
\settokens`#2`% % \ | /
774
\diagram% % #5\ #6 /#7
775
\putVtrianglepairp % \ | /
776
<\arrowtypea`\arrowtypeb`\arrowtypec`% % \ | /
777
\arrowtyped`\arrowtypee;\height>% % v v v
778
(0,0)[{#2};#3`#4`#5`#6`{#7}]% % #2d
783
\def\putCtrianglep<#1>(#2,#3)[#4`#5`#6;#7`#8`#9]{{%
786
\advance\ypos by\height
787
\putmorphism(\xpos,\ypos)(1,-1)[``{#9}]{\height}{\arrowtypec}l%
788
\advance\xpos by\height
789
\advance\ypos by\height
790
\putmorphism(\xpos,\ypos)(-1,-1)[#4`#5`{#7}]{\height}{\arrowtypea}l%
791
{\multiply\height by 2
792
\putvmorphism(\xpos,\ypos)[`#6`{#8}]{\height}{\arrowtypeb}r}%
795
\def\putCtriangle{\@ifnextchar <{\putCtrianglep}{\putCtrianglep
796
<\arrowtypea`\arrowtypeb`\arrowtypec;\height>}}
797
\def\Ctriangle{\@ifnextchar <{\Ctrianglep}{\Ctrianglep
798
<\arrowtypea`\arrowtypeb`\arrowtypec;\height>}}
800
\def\Ctrianglep<#1>[#2`#3`#4;#5`#6`#7]{{%% % / |
801
\settriparms[#1]% % #5/ |
804
\putCtrianglep<\arrowtypea`\arrowtypeb`% % #3 |#6
805
\arrowtypec;\height>% % \ |
806
(0,0)[#2`#3`#4;#5`#6`{#7}]% % #7\ |
810
\def\putDtrianglep<#1>(#2,#3)[#4`#5`#6;#7`#8`#9]{{%
813
\advance\xpos by\height \advance\ypos by\height
814
\putmorphism(\xpos,\ypos)(-1,-1)[``{#9}]{\height}{\arrowtypec}r%
815
\advance\xpos by-\height \advance\ypos by\height
816
\putmorphism(\xpos,\ypos)(1,-1)[`#5`{#8}]{\height}{\arrowtypeb}r%
817
{\multiply\height by 2
818
\putvmorphism(\xpos,\ypos)[#4`#6`{#7}]{\height}{\arrowtypea}l}%
821
\def\putDtriangle{\@ifnextchar <{\putDtrianglep}{\putDtrianglep
822
<\arrowtypea`\arrowtypeb`\arrowtypec;\height>}}
823
\def\Dtriangle{\@ifnextchar <{\Dtrianglep}{\Dtrianglep
824
<\arrowtypea`\arrowtypeb`\arrowtypec;\height>}}
826
\def\Dtrianglep<#1>[#2`#3`#4;#5`#6`#7]{{%% % | \
827
\settriparms[#1]% % | \#6
830
\putDtrianglep<\arrowtypea`\arrowtypeb`% % #5| #3
831
\arrowtypec;\height>% % | /
832
(0,0)[#2`#3`#4;#5`#6`{#7}]% % | /#7
836
\def\setrecparms[#1`#2]{\width=#1 \height=#2}%
838
% #3b<-------#3a x #3b
852
% #3d<-------#3a x #3d
855
\def\recursep<#1`#2>[#3;#4`#5`#6`#7`#8]{{\m@th
858
\settowidth{\tempdimen}{$\tokena$}
860
\savebox{\tempboxa}{\hbox{$\tokenb$}}%
861
\savebox{\tempboxb}{\hbox{$\tokend$}}%
862
\savebox{\tempboxc}{\hbox{$#6$}}%
864
\savebox{\tempboxa}{\hbox{$\hbox{$\tokena$}\times\hbox{$\tokenb$}$}}%
865
\savebox{\tempboxb}{\hbox{$\hbox{$\tokena$}\times\hbox{$\tokend$}$}}%
866
\savebox{\tempboxc}{\hbox{$\hbox{$\tokena$}\times\hbox{$#6$}$}}%
871
\advance\xpos by \width
873
\putCtrianglep<-1`1`1;\ypos>(0,0)[`\tokenc`;#5`#6`{#7}]%
874
\puthmorphism(\ypos,0)[\tokend`\usebox{\tempboxb}`{#8}]{\width}{-1}b%
875
\puthmorphism(\ypos,\height)[\tokenb`\usebox{\tempboxa}`{#4}]{\width}{-1}a%
876
\advance\ypos by \width
877
\putvmorphism(\ypos,\height)[``\usebox{\tempboxc}]{\height}1r%
881
\def\recurse{\@ifnextchar <{\recursep}{\recursep<\width`\height>}}
883
\def\puttwohmorphisms(#1,#2)[#3`#4;#5`#6]#7#8#9{{%
884
% 1 and 2 are position, 3 and 4 are the nodes, 5 and 6 the labels,
885
% 7 the distance between node centers and 8 & 9 are the arrow types.
890
\puthmorphism(#1,#2)[#3`#4`]{#7}0a
893
\puthmorphism(#1,\ypos)[\phantom{#3}`\phantom{#4}`#5]{#7}{#8}a
895
\puthmorphism(#1,\ypos)[\phantom{#3}`\phantom{#4}`#6]{#7}{#9}b
898
\def\puttwovmorphisms(#1,#2)[#3`#4;#5`#6]#7#8#9{{%
899
% 1 and 2 are position, 3 and 4 are the nodes, 5 and 6 the labels,
900
% 7 the distance between node centers and 8 & 9 are the arrow types.
911
\putvmorphism(#1,#2)[#3`#4`]{#7}0a
914
\putvmorphism(\xpos,#2)[\phantom{#3}`\phantom{#4}`#5]{#7}{#8}l
916
\putvmorphism(\xpos,#2)[\phantom{#3}`\phantom{#4}`#6]{#7}{#9}r
919
\def\puthcoequalizer(#1)[#2`#3`#4;#5`#6`#7]#8#9{{%
920
% #1 is (\xpos,\ypos), the next 6 are the nodes and arrow labels
921
% #8 is the distance between each pair of nodes and #9 is the pos of #7
922
% either a (above) or b (below)
924
% #2 ===========> #3 --------> #4
928
\puttwohmorphisms(\xpos,\ypos)[#2`#3;#5`#6]{#8}11%
930
\puthmorphism(\xpos,\ypos)[\phantom{#3}`#4`#7]{#8}1{#9}
933
\def\putvcoequalizer(#1)[#2`#3`#4;#5`#6`#7]#8#9{{%
934
% #1 is (\xpos,\ypos), the next 6 are the nodes and arrow labels
935
% #8 is the distance between each pair of nodes and #9 is the pos of #7
936
% either l (left) or r (right)
954
\puttwovmorphisms(\xpos,\ypos)[#2`#3;#5`#6]{#8}11%
956
\putvmorphism(\xpos,\ypos)[\phantom{#3}`#4`#7]{#8}1{#9}
959
\def\putthreehmorphisms(#1)[#2`#3;#4`#5`#6]#7(#8)#9{{%
960
% Use: \putthreehmorphisms(xpos,ypos)[lnode`rnode;toplabel`midlabel%
961
% botlabel]{distance}(toparrowtype,midarrowtype,botarrowtype){position}
962
\setpos(#1) \settypes(#8)
964
\vertsize{\tempcounta}{#5}%
965
\vertsize{\tempcountb}{#6}%
966
\ifnum \tempcounta<\tempcountb \tempcounta=\tempcountb \fi
968
\vertsize{\tempcounta}{#4}%
969
\vertsize{\tempcountb}{#5}%
970
\ifnum \tempcounta<\tempcountb \tempcounta=\tempcountb \fi
972
\advance \tempcounta by 60
973
\puthmorphism(\xpos,\ypos)[#2`#3`#5]{#7}{\arrowtypeb}{#9}
974
\advance\ypos by \tempcounta
975
\puthmorphism(\xpos,\ypos)[\phantom{#2}`\phantom{#3}`#4]{#7}{\arrowtypea}{#9}
976
\advance\ypos by -\tempcounta \advance\ypos by -\tempcounta
977
\puthmorphism(\xpos,\ypos)[\phantom{#2}`\phantom{#3}`#6]{#7}{\arrowtypec}{#9}
980
\def\setarrowtoks[#1`#2`#3`#4`#5`#6]{%
988
\def\hex{\@ifnextchar <{\hexp}{\hexp<1000`400>}}
989
\def\hexp<#1`#2>[#3`#4`#5`#6`#7`#8;#9]{%
991
\yext=#2 \advance \yext by #2
992
\xext=#1 \advance\xext by \yext
994
\putCtriangle<-1`0`1;#2>(0,0)[`#5`;\tokb``\tokd]
995
\xext=#1 \yext=#2 \advance \yext by #2
996
\putsquare<1`0`0`1;\xext`\yext>(#2,0)[#3`#4`#7`#8;\toka```\tokf]
998
\putDtriangle<0`1`-1;#2>(\xext,0)[`#6`;`\tokc`\toke]
1001
%\def\doublecomplex[#1`#2`#3`#4`#5`#6`#7`#8`#9]{%
1003
%\putsquare<0`0`1`1;500`500>(0,1700)[`\vdots`\cdots`{#1};```]
1004
%\puthmorphism(500,1700)[\ph{#1}`\cdots`]{500}1a
1005
%\puthmorphism(1000,1700)[\ph{\cdots}`\ph{#2}`]{500}1a
1006
%\putsquare<0`1`1`1;700`500>(1500,1700)[\vdots`\vdots`{#2}`{#3};```]
1007
%\puthmorphism(2200,1700)[\ph{#3}`0`]{500}1a
1008
%\putvmorphism(500,1700)[`\vdots`]{400}1a \putvmorphism(500,1300)[``]{400}1a
1009
%\putvmorphism(1500,1700)[`\vdots`]{400}1a \putvmorphism(1500,1300)[``]{400}1a
1010
%\putvmorphism(2200,1700)[`\vdots`]{400}1a \putvmorphism(2200,1300)[``]{400}1a
1011
%\putsquare<1`0`1`1;500`500>(0,400)[\cdots`{#4}`\cdots`{#7};```]
1012
%\puthmorphism(500,900)[\ph{#1}`\cdots`]{500}1a
1013
%\puthmorphism(1000,900)[\ph{\cdots}`\ph{#2}`]{500}1a
1014
%\puthmorphism(500,400)[\ph{#1}`\cdots`]{500}1a
1015
%\puthmorphism(1000,400)[\ph{\cdots}`\ph{#2}`]{500}1a
1016
%\putsquare<1`1`1`1;700`500>(1500,400)[{#5}`{#6}`{#8}`{#9};```]
1017
%\puthmorphism(2200,900)[\ph{#6}`0`]{500}1a
1018
%\puthmorphism(2200,400)[\ph{#9}`0`]{500}1a
1019
%\putvmorphism(500,400)[`0`]{400}1a
1020
%\putvmorphism(1500,400)[`0`]{400}1a
1021
%\putvmorphism(2200,400)[`0`]{400}1a
1025
%\def\doublecocomplex[#1`#2`#3`#4`#5`#6`#7`#8`#9]{%
1027
%\putsquare<0`0`-1`-1;500`500>(0,1700)[`\vdots`\cdots`{#1};```]
1028
%\puthmorphism(500,1700)[\ph{#1}`\cdots`]{500}{-1}a
1029
%\puthmorphism(1000,1700)[\ph{\cdots}`\ph{#2}`]{500}{-1}a
1030
%\putsquare<0`-1`-1`-1;500`500>(1500,1700)[\vdots`\vdots`{#2}`{#3};```]
1031
%\puthmorphism(2000,1700)[\ph{#3}`0`]{500}{-1}a
1032
%\putvmorphism(500,1700)[`\vdots`]{400}{-1}a \putvmorphism(500,1300)[``]{400}{-1}a
1033
%\putvmorphism(1500,1700)[`\vdots`]{400}{-1}a \putvmorphism(1500,1300)[``]{400}{-1}a
1034
%\putvmorphism(2000,1700)[`\vdots`]{400}{-1}a \putvmorphism(2000,1300)[``]{400}{-1}a
1035
%\putsquare<-1`0`-1`-1;500`500>(0,400)[\cdots`{#4}`\cdots`{#7};```]
1036
%\puthmorphism(500,900)[\ph{#1}`\cdots`]{500}{-1}a
1037
%\puthmorphism(1000,900)[\ph{\cdots}`\ph{#2}`]{500}{-1}a
1038
%\puthmorphism(500,400)[\ph{#1}`\cdots`]{500}{-1}a
1039
%\puthmorphism(1000,400)[\ph{\cdots}`\ph{#2}`]{500}{-1}a
1040
%\putsquare<-1`-1`-1`-1;500`500>(1500,400)[{#5}`{#6}`{#8}`{#9};```]
1041
%\puthmorphism(2000,900)[\ph{#6}`0`]{500}{-1}a
1042
%\puthmorphism(2000,400)[\ph{#9}`0`]{500}{-1}a
1043
%\putvmorphism(500,400)[`0`]{400}{-1}a
1044
%\putvmorphism(1500,400)[`0`]{400}{-1}a
1045
%\putvmorphism(2000,400)[`0`]{400}{-1}a