-
Notifications
You must be signed in to change notification settings - Fork 2
/
diagrams.sty
8515 lines (8361 loc) · 316 KB
/
diagrams.sty
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\message{==================================================================}%
\message{<Paul Taylor's commutative diagrams - version 3.96, December 2019>}%
%%
%%
%% This code runs the LaTeX \ProvidesPackage command iff it is defined.
%% included at the request of Michael Downes <[email protected]> March 2002.
%% Put \listfiles in your LaTeX preamble to see what this is for.
\expandafter\ifx\csname ProvidesPackage\endcsname\relax\toks0=\expandafter{\fi
\ProvidesPackage
{diagrams}[2019/12/31 v3.96 Paul Taylor's commutative diagrams]%%
\toks0=\bgroup}%%
%%======================================================================%
%% TeX macros for drawing category-theoretic diagrams %
%% %
%% Paul Taylor %
%% %
%% www.PaulTaylor.EU/diagrams %
%% www.ctan.org/tex-archive/macros/generic/diagrams/taylor/ %
%% [email protected] %
%% %
%% PLEASE READ THE MANUAL! %
%% %
%% Please ensure that you are registered with me as a user so that %
%% you can be informed of future releases. Any electronic mail %
%% message with "commutative" or "diagram" in the subject line %
%% (such as your request for the package, a question about it, or %
%% even an otherwise blank message) automatically registers you. %
%% %
%% %
%% CONTENTS: %
%% (O) corruption-sensitive hacks (to approx line 318) %
% (1) dimensions and counts %
% (2) make arrow parts %
% (3) new arrow %
% (4) horizontal state checking and arrow setup %
% (5) syntax of arrow commands %
% (6) positioning and optional arguments %
% (7) the diagram - options and output %
% (8) the matrix %
% (9) horizontals %
% (10) piles %
% (11) verticals %
% (12) transfer to box arrays %
% (13) paragraph bombing %
% (14) reformatting objects and crosses %
% (15) LaTeX line characters %
% (16) diagonals %
% (17) stretchable diagonals %
% (18) PostScript arrows %
% (19) trigonometry %
% (20) PDF-TeX support %
% (21) error recovery %
%% Arrow components & commands - starts approx line 1234 %
%% (22) auxillary macros for adjustment of components %
%% (23) bits of arrows (\rhvee etc) %
%% (24) arrow commands (\rTo etc) %
%% (25) miscellaneous %
%% Apart from these five sections, the rest is intended to be totally %
%% meaningless in the undocumented version, which is approximately %
%% 1922 lines long. Please do not waste trees by printing it out. %
% This is because I regard my code as private. The comments contain a %
% lot of fossils, ideas and other notes to myself which I do not wish %
% to make available to others. If you're reading this, please stop now.%
%% %
%% COPYRIGHT NOTICE: %
%% This package may be copied and used freely for any academic %
%% (not commercial or military) purpose, on condition that it %
%% is not altered in any way, and that an acknowledgement is %
%% included in any published work making substantial use of it. %
%% %
%% IT IS SUPPLIED "AS IS", WITHOUT WARRANTY, EXPRESS OR IMPLIED. %
%% %
%% If you are doing something where mistakes cost money (or where %
%% success brings financial profit) then you must use commercial %
%% software, not this package. In any case, please remember to %
%% keep several backup copies of all files, and check everything %
%% visually before sending final copy to the publishers. %
%% %
%% You may use this package as a (substantial) aid to writing an %
%% academic research or text book on condition that %
%% (i) you contact me at a suitable time to ensure that you have %
%% an up-to-date version (and any infelicities can be fixed), %
%% (ii) you send me a copy of the book when it's published. %
%% %
%% HISTORY %
%% 3.95 Released 31 December 2014 %
%% Fixed spurious extra vertical space when running under LuaTeX %
% by adding \baselineskip\z@ to \bomb@parameters 14 May 2014 %
%% with help from Linas Stonys. %
%% 3.94 Released 11 May 2011 %
%% defined <= tail %
%% 3.93 Released 9 June 2009 %
% added \pdfsyncstop to avoid clash with pdfsync %
% \ifx\diagram\isundefined %
% removed obsolete \laf \lad \xlad \lahh \lat \xlat \xlahh %
% changed \lq and \rq back to ` and ' for catcodes and octals. %
%% Added support for XeTeX, with help from Apostolos Syropoulos. %
%% 3.92 Released 31 December 2007 %
% Made noPS and noPostScript just generate error messages. %
% Unknown PS translator is just ignored. %
% Swapped \Yup and \Ydown %
% Two-year (instead of one-year) time-bombs. %
%% 3.91 Released 31 August 2006 %
%% Renamed "noPostScript" option as "UglyObsolete". %
% Fixed? "PostScript translator `' unknown" %
% \everymath{}\everyhbox{} since pdfsync sets them %
%% 3.90 Released 11 April 2004 %
%% use PostScript=Rokicki not pure DVI by default %
% pass PS prog name to \bad@ps@prog as #1 not as \@value %
% always warn that "labels as positional arguments are obsolete" %
% as ``superscript'' labels were introduced 14 years ago %
% test \ifx\pdfoutput\relax as well as \undefined %
%% 3.89 Released 7 July 2002 %
%% Added support for pdftex, which is recognised automatically. %
%% 3.88 Released 1 September 2000 %
%% Square hook tail: \newarrow{SquareInto}{sqhook}---> %
%% 3.87 Released 1 September 1999 %
%% This version was used for the final 1200dpi PS copy of my book %
%% ``Practical Foundations of Mathematics'' (Cambridge Univ Press) %
%% see http://www.PaulTaylor.EU/Practical_Foundations %
%% 3.86 Released 1 September 1998 %
%% New options hug and nohug in PostScript mode: [PS,nohug] uses %
%% PS for the arrows without rotating the labels, but the way of %
%% calculating the actual position of these horizontal labels on %
%% will remain subject to alteration for some period of time --- %
%% please send me examples if you feel that adjustment is needed. %
%% %
% flushleft/leftflush with no value retains old one, not 0pt %
% Suppress indentation of following text (due to LaTeX change) %
% inserted \global before \@ignoretrue %
% Mangle \left@label and \right@label (conflict with Elsevier). %
%% midvshaft and snake for vertical arrows %
% labels on verticals are now inside the lower \vbox %
%% New option [gap=width] (default=shortfall) to use instead of %
%% ~{\;} on horizontals and PS diagonals, as this caused ^ and _ %
%% labels to be moved too far away from the shaft. %
% Corrected position of hook in \dInto (see \shifthook). %
% Added 2pt space separating labels from vertical arrows. %
% Corrections to \lhtriangle \dhtriangle \newarrowtail{boldhook} %
%% Added >-> and <-< heads and tails, same as >> and << but the %
%% shaft goes *through* the extra arrowhead. %
% Identify the cell in which a second-pass error occurs. %
% Corrected dot spacing with [dotted] option. %
% (It was using \hfdot or \vfdot not \rf:. or \df:.) %
%% 3.85 Released 20 August 1997 %
%% New option [crab=distance] shifts horizontals and PS diagonals %
%% transversally by the specified distance (positive=upward). %
%% New option [snake=distance] shifts midshaft horizontals and %
%% PS diagonals longitudinally by the specified distance. %
% Set \catcode of :;!? as babel package makes them \active. %
% \dblvert for ``Practical Foundations'' %
% Moved pullback symbols slightly further away. %
% Fixed uneven \pile spacing. %
% Treat empty row as \noalign{\advance\prevdepth-\baselineskip} %
% Unknown PostScript translator names recognised. %
% Parse space in $A\rTo^a _b B$ correctly. %
% Big \LaTeX arrowheads with [thick] option. %
%% New option [leftflush], like [flushleft] but reckons alignment %
%% from multiple verticals, or from text if there's no vertical. %
% Crude implementation of nohug. %
%% Most of the history has been suppressed from the user version. %
% 3.84 Released 2 September 1996 %
% Fixed undefined control sequence in \luOnto[dotted,PS] %
% moved \let\fill@dot\hfdot from \Horizontal@Map to \@setup@horiz %
% Use \AtEndDocument to give once only warnings. %
% Report unknown grid correctly. %
% Provided \NWclck etc 2-cell arrows. %
%% 3.83 Released 18 May 1995 %
%% "dotted" option (set dot filler on maps) %
% repositionpullbacks moved 0.25em horizontally %
% fixed bug when \v@grid is longer than required %
% added \relax in \over@print to avoid premature expansion %
% (to fix bug with repositionpullbacks \NWpbk and \SWpbk) %
% Fixed bug with interaction with amslatex/equation. %
% reported by Bruce Pollack; caused by \everycr. %
%% Parallel maps (\pile) outside diagrams stretch correctly. %
% Added test \ifinpile to glue in horizontal maps. %
% Avoid stepped lines in PostScript by restricting the slopes. %
% Define \default@max@fraction=\default@size/5\pixel@size. %
% Rightmost width now calculated correctly. %
% \reoutput@cell had spurious \box\cd@cell in it. %
% Fewer "arrow too short" errors (the l> option for eliminating %
% birds' feet arrows is only applied in text, l>.5em in diagrams).%
% Setting \dimen2 in \@setup@horiz, \default@args, \calc@horiz. %
% Recovery from "\rTo_\hbox{a}" no longer loops. %
% Match TeX's inserted { with \eegroup instead of \egroup. %
% "midshaft" option now works; "midvshaft" ignored. %
%% Option "LaTeXeqno" uses LaTeX's equation number and style %
%% for "eqno"; LaTeX's \label command picks this up. %
%% Suppress warnings & 2nd pass errors with "silent" option. %
% Warning if extra material in \pile cell. %
% Recover from square brackets mis-interpreted as options. %
% 3.82 %
%% 3.81 Second alpha release 18 July 1994 %
% Fixed displaced parenthesis instead of hook tails in manual p8. %
% By changing \box0 to \box3 in \raisehook (LaTeX2e \boldmath). %
% Parentheses and braces (not quite right): see end of source. %
%% \overprint{text} sets text in maths and overprints it in the %
%% current cell, centered in the column irrespective of other stuff%
%% "repositionpullbacks" option uses this for \SEpbk etc %
%% \newdiagramgrid declaration, grid option and pentagon grid. %
%% 3.80 Alpha release for adjusted diagonals 15 July 1994. %
% Some options can now take (x,y) values. %
% Position during input as (\cd@row,\cd@cell); top left is (1,1). %
% Name of DVI->PS translator as argument to PostScript option. %
% Preliminary code for stretchable diagonals and overprints: %
% \missive#1(x,y) anywhere in the diagram overprints #1 at (x,y). %
% The extra boxes are added to the left of each cell, delimited %
% by \penalty-9990; this caused the paragraph builder to discard %
% the \hfil\kern(shortfall) on the left, so added \null. %
% Improved recovery from missing {} in labels. %
% Recovers from \rTo~\rTo, \rTo^\hat, \rTo^\macro, {\rTo^}, %
% \rTo^ {&, ... %
% Removed error message from \across since this works now. %
% Set \boxmaxdepth=\maxdimen for interaction with an old LaTeX. %
% Loading after \begin{document} in LaTeX2e possible. %
% (By testing whether \DeclareOption has been disabled (yuck). %
% Loading before \documentstyle or \documentclass possible. %
% (By defaulting \MapBreath and \default@mapbreadth to 0.4pt; %
% the latter is \edef'd in \size@dependencies. %
% Equilateral triangle or regular hexagon size options. %
% \mathon and \mathoff correctly matched now, it seems. %
% Corrected Morse code for "P" (Ralph Loader) %
% Changed all \new@if to \if@blah@. Added \if@in@matrix@. %
% Introduced landscape and portrait options. %
% Define PS commands once for each (outermost) diagram needing %
% them; previously they were defined for every map. %
% Don't hide width of vertical middle components. %
% (Changed \make@vert@part to \hbox in \newarrowmiddle.) %
% Negative stretchability in right half of horizontal arrows. %
% Added "." map qualifier to set dot filler. %
% Only set \@diagonals@used@ for those set on first pass. %
% Parse []-options during label processing. %
% Signal midhshaft with extra \penalty1 just before bomb. %
% Made midhshaft work; always set it for single-row diagrams. %
% Rewrote \widen@horiz, changing tests for space and handling of %
% through and centred horizontals. %
% Maintain distance of each row from the top as \ht\cd@row on %
% rows which have been reformatted; used to calculate height of %
% diagonals. %
% \diagramstyle may be used within diagrams. %
% (Continuation, \after@opt@arg, not set, so did \@@@diagram.) %
% \objectwidth reduced from 3em to 1em; was destroying fixed %
% diagonals. %
% Fixed "very" thick lines by changing \cds@thick. %
% All inter-row glue contributes to space. %
% Vertical maps targetted at labels of horizontals avoid them. %
% Wide object on right no longer causes "increase width" warning. %
% (Initialise \far@end@cell=1000 on right, don't complain about %
% insufficient space between objects if it still has this value.) %
% Make these warnings more accurate and informative. %
% Fixed decapitated arrows (I think!). %
% Now use \wd\cd@donat for \column@placing ie x-coord of centre. %
% Diagonals adjusted to meet their endpoints, at last!!!! %
% \min@map@length=0pt inside diagrams (?). %
% Option showfirstpass[=depth]. %
% Fixed intermittent "lower part of vertical too short" errors: %
% wasn't collecting the vertical glue below missives. %
% Missive aimed at horizontal map caused huge \right@donated: was %
% overwriting \dimen2; moved most of the code within an \hbox. %
% 3.29 Released 11 March 1994 %
% Corrected error message when "&" or object is inserted before %
% horizontal maps etc outside diagram. %
% \last@map@type initialised to \empty, when we just say "before".%
% Also when label missing after <>^_~. %
% Switch to centredisplay if flushleft doesn't fit on the page. %
% The code was ok when the diagram didn't fit at all, but not in %
% the case where it would fit in centredisplay mode. %
% Added Y head & tail from St. Mary Rd. font (not yet adjusted). %
% First attempt to support LaTeX2e \usepackage options. %
% Fixed bug (missing \endgroup and no arrow) with \rTo[opt][opt]. %
% (The continuation, \after@opt@arg, had got overwritten.) %
% Set \mathsurround=0pt for everything within our code. %
% Already set in \inner@environment and in \make@horiz@part but %
% not when \math@on & math@off are (re)made in \size@dependencies.%
% Also set it in \default@args for horiz maps outside diagrams. %
% 3.28 Released 30 November 1993 %
% Fixed bug causing diagram to disappear in vert mode in LaTeX %
% caused by \everypar overwriting \box0 - use \box2 instead. %
% Peter Freyd's \puncture symbol provided. %
% 3.27 Released 26 March 1993 %
% Fixed bug which forced LaTeX slopes on PostScript diagonals. %
% Got \max@fraction wrong: moved to condition in \exec@diagonal. %
% Renamed \put@PS@horiz as \exec@PS@diagonal. Made \exec@horiz %
% exclusively horizontal, moving "extra text" test there. %
% Call \calc@horiz and \label@horiz from \exec@diagonal instead. %
% Restored \max@fraction{255} to PostScript arrows. %
% 3.26 Released 11 February 1993 %
% Added [defaultsize=] to set \default@size, used if size unset. %
% Added 1pt space between label (strut) and horizontal shaft. %
% 3.25 Released 30 January 1993 %
% Resolution-dependent fudge (dpi) applied to horizontal arrows. %
% Removal of glue from before to after applied to display as well %
% as textflow, but didn't deal with spurious space after diagram. %
% Fixed extra height in \rhla. %
% Fixed \HmeetV vertical profile - bug caused by pixel fudge. %
% Defined \if@ignore outside LaTeX, use to control \ignorespaces %
% at end of diagram: to cure spurious space in text after %
% notextflow diagram. %
% Added \kern-\displayindent inside $$/$$ to over-ride prevailing %
% paragraph indentation: to cure shift and over-full \hbox in %
% itemized diagram. %
% Added \make@end@at@line after \egroup in \output@diagram so that%
% "too wide for page" and "flushleft in $$" can give line numbers.%
% LaTeX heads made default (unless \tenln undefined, when vee) %
% and set (by new \set@default@arrowhead) in horiz outside cd too.%
% Also cures zero-length shafts of arrows in text in footnotes. %
% Made \labelstyle and \objectstyle available as options. %
% Diagram options and output as new section; some reorganisation. %
% New display options give warning if used within maths. %
% Catch missing bracket at end of label and misplaced (but not %
% missing) bracket at end of \pile. %
% Small adjustments on some heads and tails. hbox option. %
% Braces and parentheses as arrows (bits from cmex) commented out.%
% Bits of double vert arrows use cmex not \Vert\Uparrow\Downarrow %
% Circle, cross, little vee, little black triangle heads. %
% Fixed spaces before & after diagram in display and textflow. %
% Catch em-braced arrow commands. %
% Adjusted hook tails yet again (some theory behind horizontals!).%
% Smashed height of \rhla \lhla \rtla and \ltla. %
% Default \MapBreadth as TeXbook p447; pixel round on input. %
% Apply pixel rounding to \make@vert@part and \shifthook. %
% First-use warning when defaulted diagonal components are used. %
% Warning if diagonals used & columns stretched significantly. %
% Warning if diagonals with repeating components are too short. %
% Added \@use@TPIC@false to diagonal dot repeater. %
% Changed setup of diagonal maps; now \+To gets immediate control,%
% sets defaults, calls \rTo (having changed \Horizontal@Map) and %
% the test to use PS is after the arguments have been read. %
% Local PostScript option (PS, noPS), disabled by noPostScript. %
% Collected all size-dependent initialisations in one macro, which%
% is executed before \diagram, \diagramstyle or text arrows. %
% Allowed curly instead of square brackets in \diagramstyle. %
% Also \diagramsstyle. %
% AMSTEX emulation - works at least when amstex not present. %
% Check for \diagram options changed to \futurelet (the earlier %
% problem with this lay in using \next@token twice), so it now %
% catches a blank line after \diagram or \begin{diagram}. %
% Fixed \HmeetV yet again. %
% Added Morse Code signature to every 20th suitable horizontal. %
% Position horizontal labels using strut rather than \baselineskip%
% Change definitions of default components from \def to \let. %
% This brought lower \scriptstyle labels closer to horizontals. %
% Use \boldmath for littlevee and hooks, if available. (DUBIOUS) %
% Vertical position of labels on diagonals had been unset! %
% Increased interim assumed \objectheight from .5ex to 1.8ex and %
% isolated \interim@shortfall. %
% Removed \outer from \diagramstyle. %
% Lots of adjustments to bits of arrows (drives me mad!). %
%% 3.24 Release 7 Sept 1992 advertised to users. %
% Continued fractions, sine, cosine & pythagorean sum. %
% \newarrow etc also define \+To \-To \nwTo %
% Rewrote LaTeX diagonal code: %
% uses continued fractions to find nearest slope and selects %
% character; diagonals touch a square around the (maths axis) %
% centre of the endpoints; middles; through diagonals. %
% \lq and \rq (instead of ` and ') for catcodes and octals. %
% Made it consistent with texinfo - for loading, at least. %
% PostScript option introduced: %
% \Rising@Map and \Falling@Map choose the horizontal command and %
% run \put@PS@horiz; %
% labels are rotated together with the arrow, %
% which is set in the first pass %
% meets a circle and is not yet adjusted for its endpoints. %
% LaTeX, vee, curlyvee, triangle & blacktriangle heads & tails %
% provided and correctly adjusted; double heads & tails all made %
% with \make@double@head. %
% TPIC option introduced as an alternative to \LaTeX@make@line. %
% 3.23 (14.5.92) experimental release on 10 July 1992 %
% Fixed pilespacing, and horizontal positioning of verticals %
% (bugs which arose from Seely's challenge). Also made need extra %
% message work. Discovered that \get@arg finds \end@cell, not &, %
% so removed {} from \tokcase and \catcase, so the \mathord{}s %
% disappeared. %
% Fixed vmiddle positioning of one-row diagrams. %
% Fixed catastrophic error of empty first cell in nested diagram %
% by using \bbgroup\eegroup around the diagram. %
% Moved making of \math@on@box to inside \bombparameters because %
% it caused "math formula deleted - insufficient fonts" if loaded %
% before \documentstyle. deleted \defaultarrowhead{vee} for same. %
% 3.22 (14.5.92) experimental release %
% 3.21 (1.5.92) %
% Extra line of paragraph, to contain profile information. %
% Implemented \shift (\cd@hshift). %
% Use \wd\cd@donat for column widths. %
% New reformatting program. %
% Re-arranged the code. %
% Optional arguments on \diagram, maps and \diagramstyle. %
% Horizontal \shift; tight cell width and height (option). %
% top, vmiddle, bottom positioning - aligns chosen maths axes %
% origin, balance, nobalance horizontal positioning %
% Made \PileSpacing between verticals local. %
% Fixed \HonV and \HmeetV profile. Included verticals in width. %
% Piles vertically centered ignoring outer labels. %
% Labels on horizontal maps positioned using \baselineskip 1.3ex. %
% Extra .2ex spacing around labels removed, .2em reduced to .1em %
% midshaft option to centre labels in horizontal arrow shaft. %
% Through horizontals and verticals. %
% \@and\sp\sb\space in \switch@arg; local catcode &,$ %
% Re-wrote mangletex to substitute our internal command names. %
% \CellSize=default on entry, in case the font size is different. %
% \across adds its with to \cd@hshift %
% Fixed unterminated verticals and cross profiles. %
% Move labels away from wide vertical arrow middles. %
% Added strut in \get@label to stop verts hitting middle labels. %
% Re-wrote \newif to make it manglable. %
% 3.20 (29.4.92) early release of version 4 %
% 3.19 (9.4.92) %
% Ensure \enddiagram occurs only at correct {}-level %
% by using \aftergroup. %
% Blank line and \par within diagram =\enddiagram. %
% Clashing (horizontal) arrows detected at first pass %
% using an automaton; %
% "&" (etc) inserted, with error & help messages. %
% \Pythagorean@sum. %
% Postscript arrows (basic code). %
% Implemented \newarrow \newarrowhead etc. %
% Corruption-sensitive characters avoided wherever possible. %
% Reloading prevented. %
% Horizontal arrows outside diagram can stretch by wordspacing. %
% 3.18 (18.12.90) bugfix %
% Diagonals (other than basic ones) moved to extra-diagonals.tex. %
% Changed \lt and \gt to \lessthan and \greaterthan for Roy Crole.%
% Added < and > for labels on left and right of arrow; %
% also [] for optional arguments on arrows (not used yet); %
% also displaced \catcase\bgroup (positional label) to speed up a %
% bit as this is obsolete. %
% 3.17 (10.9.90) bugfix %
% \offinterlineskip in \make@vert@part %
% \endgraf instead of \par (because LaTeX changes it) %
% \leavevmode before diagram to fix LaTeX-interaction bug %
% \cong as a middle (problem was \mathpalatte within \edef) %
% 3.16 (20.7.90) as mass mailed; only have mangled version %
% \DiagonalLineSegments=\ObsCount %
% \dmcornervert et seq commented out %
% 3.15 (1.7.90) numbered boxes for columns %
% left part of horiz arrow in \box2 (\across not yet fixed) %
% bugfixes: %
% spacing of \pile's %
% horizontal alignment of top of verticals - remove spurious space%
% horizontal alignment of verticals - \make@vert@part %
% zero height & depth of vertical parts to not force lines apart %
% 3.14 (1.7.90) bugfix: %
% parsing \across - remove spurious & %
% horizontal alignment of bottom of multiple verticals. %
% \lhla arrow the right way round. %
% add \MapShortFall and \MapCorner %
% 3.13 (2.6.90) A lot? %
% 3.11 (18.4.90) %
% Catch obsolete parameters, rename some dimensions, added to %
% \bombparameters. Changed template. %
% 3.03 (18.4.90) re-arranged code; a lot of changes? %
% 3.02 (3-7.2.90) %
% 3.01 (9.1.90) vertical reformatting; only have mangled version %
%% -- all following version numbers are post-facto -- %
%% 3 (Jan 90) stretching vertical arrows %
% 2.8 (2.1.90) new reformatting %
% 2.6 (30.12.89) added \pile %
%% 2 (Sept 89) horizontals stretch to objects; "superscript" labels %
%% 1 (1987) horizontal arrows stretch to edge of cell %
%% 0 (1986) implementation of Knuth's TeXercise 18.46 for my thesis %
% %
%%======================================================================%
% BUGS
% mangle \@name
% "Commutative Diagram: "&*&" inserted between horizontal map and pile."
% in inline diagram
% Silvio Levy <[email protected]> 13 Sept 2006 - see examples
% width of diagram takes account of labels on arrows but not
% the width of the last row of objects
% signature on squashed arrow
% re-sort the obfuscation list, as Robin Houston has found the macros.
% missing } after \pile doesn't recover
% \across doesn't work with grid
% this code wasn't updated when we changed the use of \column@placing
% \ldTo^~p
% \begin{diagram} ended by \end{displaymath} causes havoc!
% When a diagram is immedately followed by a footnote, there is no
% space between the bottom of the diagram and the footnote rule.
% \begin{diagram}[htriangleheight] with default \DiagramCellHeight
% - Volker Schubert <[email protected]> 5 Feb 1997
% midshaft on objects in a \pile
% $R:X\rEmbed[heads=littlevee,l>=1.5em] Y$ is not very pretty:
% \verb/$R:X\rEmbed[heads=littlevee,l>=1.5em] Y$/.
% make the rule in \verb/\upperBrace/ thicker and shorter;
% the vertical brace is also ugly.
% switch to balance within flushleft doesn't work
% make bottom right of negative gradient diagonals 2pt less shortfall
% doesn't insert } correctly in
% \uInto<{b_!={!_L^*} \adjoint \dOnto>{b^*}
% TO DO THIS TIME
% - locate option to define origin of coordinates for diagonals
% - text in the middle of right triangles
% - diagonal pullback symbols
% - handle \verb/\qed/
% - \verb/vtriangle/ is too narrow (or too tall).
% - we really ought to have curved arrows!
% - define \verb/\Nanti/ and \verb/\Sclck/ 3/8-circle little arrows
% - do ``\verb/=/'' middle using two ruled lines.
% - wavy diagonal lines.
% - check interaction of landscape with other positioning options
% - option to set left or right width of object, rather than the shift
% 2-cells near vertices, offset annotation of vertices.
% - annotation on arrowheads and XYpic adjustable positioning of labels
% - Font sizes (line10) & \CellSize for slitex and 11pt/12pt (scaling?)
% default rule breadth in slitex.
% - give co-ordinates of cells (their line numbers?) in error messages
% TO DO NEXT TIME
% DIAGONALS
% - steep \rdTo_u places the label very low down
% - dashed diagonal should perhaps be dotted outside PS
% - with shallow LaTeX diagonals, measure the width, not the height
% - option to link diagonals to corners of objects instead of
% aiming at the centres of the cells.
% OUTPUT OPTIONS
% - argument to origin option
% - re-calculate \prevgraf based on height of diagram and \baselineskip
% - allow for short line before displayed diagram
% - \output@cell doesn't take account of everything that sticks out.
% - textflow diagram disappears immediately after displaymath envt.
% - some rows remain unreformatted: one-line diagram enclosed in
% \begin{diagram} \end{displaymath} in ptbook.sty.
% - textflow generating horizontal space in paragraph (manual, page 3)
% BITS OF ARROWS
% - make test file for all arrow styles and measure shortfall
% - LaTeX diagonal double tails need to be brought in a bit
% - option for shaft to go through double arrowhead; use difference in
% width of head and tail to choose spacing of double heads
% - curved corners on \HmeetV and half arrows; jumps and solders.
% - loops on vertices: see Pino's bits
% - electronic components
% - \nwarrow etc as (1,1) LaTeX diagonals
% - horizontal shaft one pixel too low for LaTeX heads and one pixel
% too high for curlyvee, at 300dpi
% - pixel adjustment on LaTeX diagonals
% - move the dots closer together
% DIAGNOSTICS
% - count number of lines since last & (\end@cell is more accurate)
% we do this (\cell@at@line), but what for?
% - make manual a LaTeX2e document.
% - "maps must never be enclosed in braces" from shifted diagonal
% - decide and document how much unterminated arrows stretch
% - lower unterminated downward verticals
% - allow unterminated maps to stretch to their natural width
% - classified summary of options in manual; list of errors,
% shift labels in options description to right
% - option not to load error messages (ask how many users care about this)
% - new display options should detect $$ not $ (probably useless in latex)
% - missing \endcsname in various places:
% in LaTeX2e \usepackage[flushleft=\mainindent]{diagrams}
% in zed.sty from <> in diagrams.tex and \newarrow{blah}---->
% IDEAS
% - make midvshaft work
% all of the labels on a system of parallel verticals must align
% - parametrise size of pullback symbols and crosses
% - rewrite amscd.sty
% - half arrows
% - adjunction environment
% - time bomb
% - Lamstex & xypic fonts
% - private version of \def with option to check re-definition; also
% re- & \global loading - with the aim of doing it on first use
% - \protect to arrows in section headings
% - more space around labels on in-text arrows if in \displaystyle
% UNREPEATABLE BUGS
% - \pile{text\rTo\\text\rTo} doesn't stretch correctly
% seems to work.
% - missives addressed to empty cells are lost - give error message
% they appear to be handled ok.
% COMPLAINTS AND WISHES
% - \hidewidth in objects causes arrows to overprint
% - \rTo{}{} puts struts in both labels - forces \pile apart (obsolete)
% - can't catch runaway argument to \pile
% - multi-line labels with embedded arrays
% this would have same problem as \pile in catching missing closing brace
% long objects doing this automatically (paragraph?)
% set up complete environment for labels
% allow Sb and Sp environments for label? can't see any way!
% - LaTeX center environment is unrestricted horizontal
% may want restricted horizontal mode behaviour there.
% - could \catcode`\&=\active etc and re\catcode (for texinfo)
% - write size information to .aux? what?
% - draft mode - what should(n't) it do?
% - strings, Feynman diagrams, ...
% - curved lines: see /home/leonardo/tex/contrib/Gnu/gs23/escher.ps
% sorry, this doesn't work with dvips because it does ``bind def''
% - \diagram[notextflow]..\enddiagram\begin{something}..\end{something}
% makes \end{something} do \ignorespaces.
% - prevent pagebreak before textflow diagram? penalties seem ok
% - Dusko wants automatic hidden line elimination
% - option to set the width of each column individually using missives
% (grid option does this ok, I think)
% - (probably) cannot work with TeX-XeT because of extra whatits
% - macros as diagram options (Volker Schubert)
%
%%======================================================================%
%% %
%% (1) CORRUPTION-SENSITIVE HACKS %
% AND PROGRAMMING FEATURES %
%% %
%%======================================================================%
%% CORRUPTION & \catcode WARNING
%% BITNET (IBM) machines may corrupt certain important characters
%% in transmission by electronic mail:
%% 0123456789=digits, abcdefghijklmnopqrstuvwxyz=lowers,
%% ABCDEFGHIJKLMNOPQRSTUVWXYZ=uppers, @=at (internal names),
%% {}=curly braces (grouping), \=backslash (keywords),
%% %=percent (comment), #=hash/sharp (argument), +=plus, -=minus,
%% <>=angle brackets (relations \ifnum,\ifdim), ==equals,
%% ,=comma, .=dot, :=colon, ;=semicolon, =space
%% $=dollar (maths) is only used in the "bits of maps" section
%% The following characters are marked by a comment including the word "ASCII",
%% except in comments and messages:
%% &=and (alignment), ~=tilde, |=vertical, []=square brackets,
%% ^=caret (superscript), _=underline (subscript),
%% "=double quote (hex), ()=round brackets,
%% /=slash, ?=query, !=pling/bang,
%% The following are no longer flagged:
%% `=grave/backquote (catcodes), '=acute/single quote (octal),
% check by the command:
% sed -e 's/.*%ascii.*//' -e 's/%.*$//' < diagrams.tex |\
% grep -n '[][&()*?|~^_/\!\"']
% Andrew Molitor <[email protected]> 27.3.91 says:
% caret became a space or was eaten entirely, not sure which,
% and tilde became a caret.
% changed \lq and \rq back to ` and ' 15.10.2008 (v3.93)
% as part of the adaptation to XeTeX proposed by
% Apostolos Sypopoulos <[email protected]>
%% The \catcode's marked * are assumed for reading this file:
%% \=0* {=1* }=2* $=3 &=4 return=5* #=6 ^=7 _=8 ignored=9*
%% space=10* letter=11* other=12 active=13 %=14* invalid=15
%% If you want to load this package inside Stallman's "texinfo", you must do
%% @catcode`@\=0 \catcode`\%=14 \input diagrams \catcode`\%=12 \catcode`\\=13
%% and then use @diagram @rTo @\ @enddiagram etc. (braces {} stay the same).
%% Also need @catcode`@&=4.
%%*** You *MUST NOT* use the internal commands (with names beginning \CD@)****
%! p \CD@
%! m \across@cells
% m \actually@braces@missing@around@macro@in@label
%! m \add@and
%! m \add@and@and
%! m \add@cr
%! m \add@dollar
%! m \add@empty@and
%! m \add@endpile@and
%! m \add@relax@before@square@bracket
%! m \@adjust@flush@left@false
%! m \@adjust@flush@left@true
%! m \after@diagram
%! m \after@name
%! m \after@names
%! m \after@opt@arg
%! m \amstex@diagram@setup
%! m \amstex@prefix
%! m \@and
%! m \and@in@pile
%! m \and@name
%! m \assign@at
%! m \assign@five
% m \at@
%! m \at@least
%! m \at@line
%! m \at@most
%! m \avoid@object
% m \axisheight
%! m \axis@profile
%! m \@back
%! m \bad@arrow
%! m \bad@end@label
%! m \bad@group@after@map
%! m \bad@pair@opt
%! m \bad@ps@prog
%! m \bbgroup
%! m \begin@at@line
%! m \@begin@cell
%! m \begin@cell
%! m \begin@maths
%! m \begin@pile
%! m \begin@square@name
%! m \better@use@ps
%! m \bgroup@name
%! m \body@
%! m \body@@
%! m \body@@@
%! m \@bomb
%! m \bomb@parameters
%! m \boxc@unt
% m \@brace
%! m \braced@label
% m \break@args
%! m \buffer@to@row
% m \@c
%! m \calc@horiz
% m \@catcode
%! m \@cd@a@false
%! m \cd@and
%! m \@cd@a@true
%! m \cd@balance
%! m \@cd@b@false
%! m \cd@bottom
%! m \cd@box@g
%! m \@cd@b@true
%! m \cd@cell
%! m \@cd@centre@display@false
%! m \@cd@centre@display@true
%! m \@cd@centre@hlabel@false
%! m \@cd@centre@hlabel@true
%! m \@cd@centre@vlabel@false
%! m \@cd@centre@vlabel@true
%! m \cd@cross
%! m \cd@diag@zer
%! m \cd@dim@a
%! m \cd@dim@b
%! m \cd@dim@g
%! m \cd@dim@h
%! m \cd@dim@k
%! m \cd@display
%! m \cd@display@box
%! m \cd@donat
%! m \cd@environment
%! m \cd@eqno
%! m \cd@error
%! m \cd@first@use
%! m \cd@fullwidth
%! m \@cd@g@false
%! m \cdgh@
%! m \@cd@g@true
%! m \cdgv@
%! m \@cd@hbox@false
%! m \@cd@hbox@true
%! m \cd@horiz@positioning
%! m \cd@hshift
%! m \@cd@landscape@false
%! m \@cd@landscape@true
%! m \cd@left
%! m \cd@left@donat
%! m \cd@left@margin
%! m \@cd@leqno@false
%! m \@cd@leqno@true
%! m \@cd@missive@false
%! m \@cd@missive@true
%! m \cd@mode@outside
%! m \cd@name
%! m \cd@num@a
%! m \cd@num@b
%! m \cd@num@c
%! m \cd@num@d
%! m \cd@num@g
%! m \cd@num@h
%! m \cd@obs@count
%! m \cd@obs@dim
%! m \cd@obs@dimq
%! m \cd@obs@msg
%! m \@cd@one@liner@false
%! m \@cd@one@liner@true
%! m \cd@opt@prefix
%! m \cd@penalty
%! m \cdps@ don't mangle any of these!
% m \cdps@Bechtolsheim
% m \cdps@Clark
% m \cdps@dvips
% m \cdps@dvitops
% m \cdps@dvitps
%! m \@cd@PS@horiz@false
%! m \@cd@PS@horiz@true
% m \cdps@IntegratedComputerSystems
% m \cdps@oztex
% m \cdps@RadicalEye
% m \cdps@Rokicki
% m \cdps@Trevorrow
%! m \cd@refmt@error
%! m \cd@right
%! m \cd@right@donat
%! m \cd@row
% m \cds@ don't mangle any of these!
% m \cd@shouldnt
%! m \cd@state
%! m \cd@switch@arg
%! m \cd@text@flow
%! m \@cd@text@flow@false
%! m \@cd@text@flow@true
%! m \@cd@through@false
%! m \@cd@through@true
%! m \@cd@tight@false
%! m \@cd@tight@true
%! m \cd@top
%! m \cd@top@height
%! m \@cd@use@PS@false
%! m \@cd@use@PS@true
%! m \cd@vbottom
%! m \cd@vcentre
%! m \cd@vert@positioning
%! m \cd@vmiddle
%! m \cd@vtop
%! m \cd@warning
%! m \cd@with@opt
%! m \cd@zerowidth
%! m \cell@at@line
%! m \cell@height@to@width
%! m \cell@missive
%! m \check@fated@enddiagram
%! m \check@horiz
%! m \check@part
%! m \check@vert
%! m \Climbingfalse
%! m \Climbingtrue
% m \@cmex
%! m \cmex@vert@part
%! m \column@placing
%! m \completed@depth
%! m \complete@horizontal
%! m \complete@last@row
%! m \@complete@vertical
%! m \complete@vertical
%! m \@complete@vspace
%! m \cont@frac@done
%! m \cont@frac@swap
%! m \co@ordinates
%! m \correct@for@width
%! m \crab@
%! m \cr@name
%! m \cross@names
%! m \cross@profile
%! m \cross@strut
%! m \@d
% m \d@brace
%! m \declared@at@cell
%! m \deepen@donations
%! m \default@args
%! m \default@diagonal
%! m \default@mapbreadth
%! m \default@max@fraction
%! m \default@profile
%! m \default@size
%! m \def@name
%! m \def@ps@turn
%! m \denominator@
%! m \diag@is@horiz
%! m \diag@is@vert
%! m \diagonal@box
%! m \@diagonals@used@false
%! m \@diagonals@used@true
%! m \@@@diagram
%! m \@@diagram
%! m \@diagram
%! m \diagram@cr
% m \diagram@help@messages
%! m \diagram@name
%! m \@di@dah
%! m \dim@in@pts
%! m \div@cclvi
%! m \div@dii
%! m \divide@
%! m \do@after@opt@arg
%! m \do@case
%! m \do@cont@frac
%! m \do@fated@enddiagram
%! m \dollar@name
%! m \do@message@at@end@doc
%! m \do@opt@arg
%! m \do@opt@arg@then
%! m \do@pile@row
%! m \do@set@dot@filler
%! m \dot@filler
%! m \double@LaTeX
% m \d@parenth
% m \eat@space
%! m \edef@name
%! m \eegroup
%! m \egroup@missing@label
%! m \egroup@name
%! m \@em
%! m \empty@filler
%! m \empty@name
%! m \empty@parts
%! m \end@at@line
%! m \end@cell
%! m \@enddiagram
%! m \@enddiagram@endpile
%! m \enddiagram@endpile
%! m \end@diagram@name
%! m \@end@diagram@ok@false
%! m \@end@diagram@ok@true
%! m \end@get@csname
%! m \@end@label
%! m \end@label
%! m \end@maths
%! m \end@mess
%! m \@end@pile
%! m \end@pile
%! m \end@square@name
% m \endswitch
%! m \exec@cross
%! m \exec@diagonal
%! m \execDiagonalLine
%! m \@exec@diagram
%! m \exec@diagram
%! m \exec@horiz
%! m \exec@LaTeX@diagonal
%! m \exec@map
%! m \exec@missive
%! m \exec@PS@diagonal
%! m \exec@vert
%! m \exit@diagram
%! m \expanded@ps@special
%! m \expanded@tpic@special
%! m \far@end@cell
%! m \fated@enddiagram
%! m \@filla
%! m \@fillb
% m \fill@dot % don't mangle as we \let@names{fill@dot}{}
%! m \@filler
% m \@fillh
% m \@fillv
%! m \finish@pile
%! m \first@occur
%! m \firstpass@showboxdepth
%! m \@first@positional@false
%! m \@first@positional@true
%! m \five@args
%! m \found@end@diagram
%! m \gdef@name
%! m \get@arg
%! m \@getcoords
%! m \get@csname
%! m \get@interrow@glue
%! m \@get@label
%! m \get@label
%! m \get@mand@value
%! m \@@getoptarg
%! m \get@opt@arg@list
%! m \get@opt@value
%! m \get@profile@info
% m \get@round@pair
% m \get@square@arg
%! m \glet
%! m \glet@names
% m \greaterthan
%! m \group@after@map
%! m \g@tmp
%! m \@h
%! m \handle@at
%! m \handle@at@
%! m \handle@matrix@row
% m \hbox@maths
%! m \@head
%! m \help@and
%! m \help@and@in@pile
%! m \help@bad@group
%! m \help@endlabel
%! m \help@hext
%! m \help@hpile
%! m \help@newarrow
%! m \help@pilecr
%! m \help@pile@enddiagram
%! m \help@undef@map
%! m \help@vext
%! m \help@vpile
% m \h@grid
%! m \horiz@add
%! m \horiz@extra
% m \horizhtdp
% m \Horizontal@Map
% m \Horizontal@Map
%! m \horizontal@name
%! m \horiz@repeater