Example: bachelor of science

Commutative Diagrams in TEX (version 4) - Paul Taylor

Commutative Diagrams in TEX (version 4)Paul pt15 June 1997 AbstractTEX and LATEX have become standard as a way of writing papers inComputer Science and Category Theory. Even in source form they areeasier to compose and read than attempts to write mathematics inASCII. In Category Theory Commutative Diagrams are essential for aclear visual understanding of the paper, but the graphics capabilities ofTEX are so limited that it is very difficult to draw them nicely, if atall. This manual describes a new but reverse-compatible version of apackage to draw such Diagrams , expressed in a language in which manyusers have already found it very easy to express IntroductionIn papers in mathematics and computer science which employ Category Theory,there is much benefit in clarity if Commutative Diagrams are used as muchas possible to illustrate definitions, equations and universal properties.

4 3. Typing the diagram The horizontal and vertical arrows extend through the empty cells either side until they meet a non-empty cell, just like the rook (castle) in chess.

Tags:

  Diagrams, Sche

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Commutative Diagrams in TEX (version 4) - Paul Taylor

1 Commutative Diagrams in TEX (version 4)Paul pt15 June 1997 AbstractTEX and LATEX have become standard as a way of writing papers inComputer Science and Category Theory. Even in source form they areeasier to compose and read than attempts to write mathematics inASCII. In Category Theory Commutative Diagrams are essential for aclear visual understanding of the paper, but the graphics capabilities ofTEX are so limited that it is very difficult to draw them nicely, if atall. This manual describes a new but reverse-compatible version of apackage to draw such Diagrams , expressed in a language in which manyusers have already found it very easy to express IntroductionIn papers in mathematics and computer science which employ Category Theory,there is much benefit in clarity if Commutative Diagrams are used as muchas possible to illustrate definitions, equations and universal properties.

2 Here isa typical such diagram: it is one of the Mac Lane-Kelly (B (C D))assl-(A B) (C D)assl-((A B) C) D=A ((B C) D)id assl?assl-(A (B C)) Dassl id6 This manual describes version 4 of the author s package for drawing diagramsline this in (plain) TEX or LATEX. Version 3 is already very widely used inthe Category Theory and Theoretical Computer Science communities. Mostof the underlying code has been rewritten, with a great improvement to theappearance of the Diagrams , but it remains compatible with the previouslydeveloped and very popular straightforward Design CriteriaDrawing such a diagram using the LATEX pictureenvironment takes aboutsixty lines of code, though some saving is possible (with the positioning of labelson arrows) by means of some simple macro programming.

3 To get the arrowsto match up neatly with the objects takes quite a lot of experimentation, andthe whole job has to be repeated with each new diagram or each , the use of macros for commonly occurring Diagrams such as squaresand triangles can save effort, but this does not postpone the difficulty veryfar, because as soon as we want to draw a slightly more complicated diagramwe re back to square Design CriteriaThe now widespread use of workstations with big screens and personal computers has lead to a kind of religious fervour that a mouse with at mostthree buttons is always easier to use than a keyboard with maybe over ahundred. This might be so if the tracking software were accurate and coulduse telepathy to ascertain what the user wanted, but in reality the attemptsI have seen to draw it on the screen and include the result in a TEXdocument have looked as professional as what children bring home from theirfirst day at school.

4 My view is, if you wantwysiwyg,use pen and paper!Besides the awful results, mouse-driven methods take longer and are lessportable. If you want to write a joint paper with a colleague on the other sideof the world, it is a great deal simpler to send a single ascii file by electronicmail than to package twenty of them (including one file per diagram as wellas the main text) encoded in some weird commercial binary the basis of these remarks, the design criteria of this package are asfollows:1. The entire diagram must form part of the source of the document other words, there must be no preprocessing ( ) orinclusion of files (such asPostScriptpictures).2. Simple Diagrams must be able to be drawn on the fly and not need tobe drawn on paper first.

5 Obviously, complex Diagrams will already havebeen worked out on paper The layout of the source code must resemble the intended diagram as faras syntactically There must be no measuring of labels to calculate co-ordinates or lengthsof There must be a variety of arrow styles, with facilities for defining newones. Diagonal arrows (which, through lack of appropriate primitives,TEX makes very difficult to draw) should be provided at various slopes,albeit with limited choice and The package must be compatible both withplainTEX and with LATEX,and not rely on non-standard fonts1or language Future versions which improve the appearance of the Diagrams must, asfar as possible, be compatible with past papers written using the package but you hack at your own risk!

6 In addition there are sthetic criteria, some of which may be a matter ofopinion: Arrows should stretch to meet the objects which are intended to be theirendpoints. Arrows should be aligned (both horizontally and vertically) with thecentres of the objects. Labels on arrows should not affect the spacing of the diagram except toavoid overlapping. Stretching of arrows should not affect the centering of their lines canonlybe drawn using LATEX sline10andlinew10fonts, and forexotic arrow styles the AMS maths symbols fonts may be useful: we regard these asstandard. Alan Jeffery s St. Mary Road symbols font is also Taylor s Diagrams package33 Typing the diagramThe diagram above is produced in LATEX as follows:\input Diagrams \def\Assl{{\rm assl}}\def\Id{{\rm id}}\begin{diagram}A*(B*(C*D)) & \rTo^\Assl & (A*B)*(C*D) & \rTo^\Assl & ((A*B)*C)*D \\\dTo^{\Id*\Assl} & & = & & \uTo_{\Assl*\Id} \\A*((B*C)*D) & & \rTo^\Assl & & (A*(B*C))*D \\\end{diagram}InplainTEX you do the same thing, writing\diagramand\enddiagramwherever we have\begin{diagram}and\end{diagram}.

7 In LATEX 2 you can put\usepackage{ Diagrams }in place of the\inputcommand, but you have to rename or alias the file basic rule is to divide the diagram into cells, just like the cells of aA (B (C D))assl-(A B) (C D)assl-((A B) C) assl?assl id6A ((B C) D)assl-(A (B C)) , and then type the contents of the cells with columns delimited by & and rows by \\ . The bottom arrow extends through the empty cells eitherside of it. Notice that although the matrix imposes a kind of co-ordinatesystem, the widths of the columns and the heights of the rows are variableand chosen automatically by TEX, in the same way as it does for matrices,tables, first you will probably need to draw the diagram carefully on paperand divide it into cells in this way before typing it in.

8 The main difficulty isworking out how many&s to insert; for this it is useful to observe thatin thesimplest cases2 objects and verticals go in odd-numbered columns, and horizontals and diagonals go in even-numbered , of course, you need an even number of&s between columns of thesame parity and an odd number between different ones. After a little practiceyou ll learn other rules of thumb, but even if you make a mistake, the DVIpreviewer will make it clear how to correct it. Error messages aboutclashingorunterminatedarrows indicate that something is wrong without cell should containeitheran object (an ordinary mathematicalexpression, set in maths mode)ora morphism (an arrow such as\rTo^f).Horizontal and vertical arrows cannot be mixed in one cell; moreover only onehorizontal arrow per cell is allowed, but see the section 6 on parallel bottom arrow disobeys this rule, since it goes across three Typing the diagramThe horizontal and vertical arrows extend through the empty cells eitherside until they meet a non-empty cell, just like the rook (castle) in this purpose anything other than white space (space, tab and newline),comments (%) and\emptyin the source make a cell non-empty.

9 For example\null,\ or{}may be used to terminate arrows: it s not necessary thatanything be printed. If you don t terminate an arrow, it will extend to theedge of the diagram, but just exactly where the edge is, particularly theright one, will be determined somewhat chess rule does not apply to diagonals, whose endpoints are specifieddifferently: see section not enclose the arrow commands in boxes or braces, because thisprevents the automatic stretching from commands (including\pile) may also be used intext,Af-B. Since there is no enclosing matrix, this is written as$A \rTo^f B$without&. You still need the dollars because it s still amathematical expression. Arrows participate in the horizontal stretching andshrinking of spaces between words in a paragraph, but of course their labelsalso force the lines of the paragraph arrow commands arefragilein the LATEX sense: if you want to usethem in section headings you must\ LabelsEach arrow carries up to three labels, whose position is specified analogouslyto superscripts3by^above,_below,<left,>right and~ reverse compatibility, above=left and below=right for vertical arrows.

10 Veryold versions of the package used positional arguments; these are also stillsupported, butmust be enclosed in braces, \rTo{f}{g}but not\rTo f , the labels are placed as follows: forhorizontalarrows,\rTo^f_gand\rTo{f}{g }givef g; forverticalarrows,\dTo <f >g,\dTo^f_gand\dTo{f}{g}givef yg; forpositivegradientdiagonalarrows,\ldTo^ f_g,\ldTo <f >gand\ldTo{f}{g}all givef g(similarly\ruTo). but fornegativegradient arrows, above=right and below=left, so\rdTo^f_g,\rdTo <g >fand\rdTo{f}{g}giveg f(similarly\luTo); Using tilde, the label may insteadbreakthe arrow:\rTo~fgivesAf-B. If the arrow had a middle ( +in\rCrossedInto, page 8),the label would replace it. This is sometimes useful to preserve thesymmetry of a diagram with three they arenotrecognised syntactically in the same way, and so for instance\nolimitswill not work.


Related search queries