1 #LyX 1.6.1 created this file. For more info see http://www.lyx.org/
13 \xydef@\xymatrixrowsep@{#1}
19 \xydef@\xymatrixcolsep@{#1}
23 \newdir{|>}{!/4.5pt/@{|}*:(1,-.2)@^{>}*:(1,+.2)@_{>}}
25 \use_default_options false
30 \font_typewriter default
31 \font_default_family default
38 \paperfontsize default
47 \paperorientation portrait
50 \paragraph_separation indent
52 \quotes_language english
55 \paperpagestyle default
56 \tracking_changes false
69 \begin_layout Plain Layout
86 \begin_layout Abstract
87 With the recent versions of LyX and with the
91 -style installed in the LaTeX-System, the graph drawing package
97 \begin_layout Plain Layout
108 -Pic can be conveniently used inside LyX.
109 Diagrams can be edited and displayed inside the main LyX editing window.
110 Here, we shall describe how to use the
120 inside LyX in order to draw, to edit and to preview diagrams as typically
121 used in category theory, algebra, and related fields.
125 \begin_layout Abstract
126 \begin_inset CommandInset toc
127 LatexCommand tableofcontents
134 \begin_layout Section
138 \begin_layout Standard
143 -package has long served as a convenient tool for easily constructing graphs
144 and diagrams in LaTeX.
145 Unfortunately, its use in LyX had long been restricted to the infamous
146 ERT-boxes, meaning that the LyX editor could only display the LaTeX-source
147 and not the finished diagram.
152 -style of LaTeX which is part of the AUCTeX project
153 \begin_inset CommandInset citation
159 , finally enables the editing and displaying of
163 -diagrams, constructed, displayed and interactively edited inside LyX.
166 \begin_layout Standard
167 \begin_inset VSpace defskip
173 \begin_layout Standard
175 \begin_inset Graphics
176 filename xyfigure.png
178 BoundingBox 0bp 0bp 580bp 440bp
186 \begin_layout Standard
187 \begin_inset VSpace defskip
193 \begin_layout Standard
194 In this note, we describe how
198 \begin_layout Plain Layout
207 -pic can be used from inside LyX, how diagrams can be created and edited.
208 We have tested the following using LyX versions 1.3.7 up to 1.6, running under
209 WindowsXP and under Windows Vista.
213 \begin_layout Standard
214 There are two modes of operations: For a start, and for some first tests,
215 it may be easiest to first enter the
219 \begin_layout Plain Layout
228 -Pic code inside the LyX-window, select it all and convert it to a graphical
229 representation by pressing
242 \begin_layout Plain Layout
251 -Pic more frequently, or if you want to modify your initial figure, you
252 will want to assemble and modify your figures using LyX's math editor.
256 \begin_layout Standard
257 Once the cursor is moved over a diagram, this is displayed as an array of
258 nodes and arrow-commands.
259 These can be changed interactively.
260 When the cursor leaves the editing area, the diagram reappears.
264 \begin_layout Standard
265 In the first two sections of this documentation, we explain how to use LyX
266 in the first mentioned mode and we introduce all
270 \begin_layout Plain Layout
279 -Pic features that might be of use for drawing commutative diagrams, graphs
282 \begin_inset CommandInset ref
284 reference "sec:math-editor"
288 explains how to use the
292 \begin_layout Plain Layout
301 -Pic commands inside a math-editing area.
305 \begin_layout Standard
306 It is not our intention to write another introduction to
310 \begin_layout Plain Layout
319 -Pic, rather our motivation is to give an introduction how the most important
320 commands work inside LyX, since the keystrokes as explained in the
324 \begin_layout Plain Layout
334 \begin_inset CommandInset citation
340 will not always function correctly inside LyX.
344 \begin_layout Section
348 \begin_layout Standard
349 The following requires that the LaTeX-packages
357 are installed in the LaTeX system.
358 They are available from CTAN, see at
359 \begin_inset CommandInset citation
361 key "instant-preview"
367 \begin_inset CommandInset citation
374 After freshly installing them, it may be necessary, to run
376 Edit\SpecialChar \menuseparator
379 from the main LyX menu.
380 The steps to a first diagram output in LyX are then:
383 \begin_layout Enumerate
390 \begin_layout Enumerate
393 Edit\SpecialChar \menuseparator
394 Preferences\SpecialChar \menuseparator
395 Look and Feel\SpecialChar \menuseparator
398 and place a check-mark at
406 \begin_layout Enumerate
411 works by opening a LyX-document and entering any math-formula, e.
412 \begin_inset space \thinspace{}
417 \begin_inset Formula $a+b=c$
424 \begin_layout Enumerate
425 Move the cursor out of the formula, and watch it change its appearance to
426 look just like in the finished dvi- or postscript document.
431 \begin_layout Enumerate
438 \begin_layout Enumerate
439 Inside your LyX-Document, enter the text
442 \begin_inset Newline newline
454 \begin_layout Enumerate
455 Select the whole text and choose
457 Insert\SpecialChar \menuseparator
458 Math\SpecialChar \menuseparator
461 , or use the corresponding keyboard shortcut
469 \begin_layout Enumerate
470 Move the mouse cursor out of the editing box and wait for a split second
471 to see an arrow appear:
472 \begin_inset Formula $\xymatrix{A\ar[r] & B}
480 \begin_layout Enumerate
481 In some cases you need to change your document preamble (e.g.
489 Layout\SpecialChar \menuseparator
490 Document\SpecialChar \menuseparator
496 \begin_inset Newline newline
502 \begin_inset Newline newline
509 \begin_layout Section
513 \begin_layout Standard
514 The following diagram, which is taken from the documentation of
518 \begin_layout Plain Layout
528 \begin_inset CommandInset citation
534 by its creator Kristoffer H.
535 Rose, will provide an example for many of the features available with that
540 \begin_layout LyX-Code
544 \begin_inset Newline newline
556 \begin_inset Newline newline
566 \begin_inset Newline newline
582 \begin_inset Newline newline
590 \begin_layout LyX-Code
594 \begin_layout Standard
595 Again, to turn this code into a graphical output, select it all at once
602 \SpecialChar \ldots{}
603 up to the closing brace \SpecialChar \ldots{}
608 and turn it into display-math as explained above.
609 A moment after the cursor leaves the math-area, you should see the diagram
610 in its full graphical glory as shown below.
614 \begin_layout Standard
615 \begin_inset Formula $\xymatrix{U\ar@/_{1pc}/[ddr]_{\psi}\ar@/{}^{1pc}/[drr]^{\varphi}\ar@{.>}[dr]|-{(x,y)}\\
616 & X\times_{Z}Y\ar[d]^{q}\ar[r]_{p} & X\ar[d]_{f}\\
624 \begin_layout Subsection
625 The matrix layout of diagrams
628 \begin_layout Standard
633 uses a matrix to define the layout of the vertices of a diagram.
634 For the above example, we need a
635 \begin_inset Formula $3\times3$
638 -matrix of which 5 entries are used for the vertices
639 \begin_inset Formula $U$
643 \begin_inset Formula $X\times_{Z}Y$
647 \begin_inset Formula $X$
651 \begin_inset Formula $Y$
655 \begin_inset Formula $Z$
658 , the other positions remaining empty.
659 In this case, the following matrix determines the layout:
662 \begin_layout LyX-Code
666 \begin_inset Newline newline
674 \begin_inset Newline newline
684 \begin_inset Newline newline
690 \begin_layout Standard
691 The pattern should be familiar from LaTeX: We see three rows, the first
692 two being terminated by the end-of-line-marker
701 Each line consists of entries, separated by the ampersand
709 \begin_layout Subsection
713 \begin_layout Standard
714 Having entered the vertices, we add arrows between them.
719 -command to produce an arrow is
725 , it is entered into the cell of the matrix where the arrow is to start.
726 The target of the arrow is defined by direction commands
743 These can be combined to a path and enclosed in square brackets.
744 As an example, the arrows from the vertex
745 \begin_inset Formula $U$
748 in the upper left corner down and right to the vertices
749 \begin_inset Formula $X\times_{Z}Y$
753 \begin_inset Formula $Y$
757 \begin_inset Formula $X$
760 are, respectively, defined as
779 Thus the above diagram with all arrows added becomes:
782 \begin_layout LyX-Code
786 \begin_inset Newline newline
800 \begin_inset Newline newline
816 \begin_inset Newline newline
824 \begin_layout Standard
825 \begin_inset Formula \xymatrix{ U \ar[ddr] \ar[drr] \ar[dr]\\
826 & X \times_{Z} Y \ar[d] \ar[r] & X \ar[d]\\
835 \begin_layout LyX-Code
839 \begin_layout LyX-Code
843 \begin_layout Subsection
847 \begin_layout Standard
848 Labels are attached to arrows by affixing them as upper or lower indices
864 defines an arrow going one cell down, two to the right and having the label
866 \begin_inset Formula $\varphi$
870 To attach a label below the arrow, make it a lower index as in
879 This explanation is correct only for arrows pointing to the right.
880 More precisely, imagine looking along the arrow in the direction it is
882 Then an upper index places a label to the left and a lower index places
884 Consequently, an arrow pointing from right to left, such as
895 \begin_inset Formula $\alpha$
899 \begin_inset Formula $\beta$
903 \begin_inset space \thinspace{}
907 \begin_inset space \space{}
911 \begin_inset Formula $\xymatrix{\ & \ \ar[l]_{\beta}^{\alpha}.}
915 Using the character | instead of ^ or _ , it is even possible to place the
916 label right onto the arrow, obscuring part of its shaft.
920 \begin_layout Standard
921 Normally, a label is placed halfway between an arrow's start and target
923 In the first diagram, the central arrow starting in
924 \begin_inset Formula $U$
928 \begin_inset Formula $(x,y)$
931 in the middle of the arrow's shaft, rather than in the middle between the
932 two objects it connects.
933 This is achieved by prefixing the label with a minus sign, here:
942 \begin_layout LyX-Code
946 \begin_inset Newline newline
964 \begin_inset Newline newline
980 \begin_inset Newline newline
988 \begin_layout LyX-Code
989 \begin_inset Formula \xymatrix{ U \ar[ddr]_{\psi}\ar[drr]^{\varphi}\ar[dr]|-{(x,y)}\\
990 & X \times_{Z} Y \ar[d]^{q} \ar[r]_{p} & X \ar[d]_{f}\\
999 \begin_layout Standard
1003 \begin_layout Plain Layout
1012 -pic normally permits labels to be shifted towards the tip or towards the
1013 start of an arrow by prefixing the label with a ratio, such as e.
1014 \begin_inset space \thinspace{}
1023 In LyX this works only for labels which are placed on top of the arrow,
1036 \begin_layout Standard
1037 For labels placed to the left or to the right of the arrow this does not
1043 \begin_layout Plain Layout
1052 -pic code such as e.
1053 \begin_inset space \thinspace{}
1073 is not correctly interpreted by LyX's math editor.
1074 Two workarounds are suggested in the last section of this note.
1077 \begin_layout Subsection
1081 \begin_layout Standard
1082 Modification of the design, the form or the positioning of arrows are introduced
1088 This is followed by a pair of matching brackets, where the form of the
1101 indicates, whether we want to modify the design, the or the curvature of
1103 Various modifactions can be applied to an arrow at the same time.
1106 \begin_layout Subsubsection
1110 \begin_layout Standard
1111 Various designs such as
1127 are possible for the shaft of an arrow.
1128 These can be combined with various ends and various tips.
1129 In general, the design of an arrow is described by following the command
1140 -sign and a pair of braces {\SpecialChar \ldots{}
1141 } containing characters describing the end,
1142 the shaft and the tip of the arrow.
1143 These characters are chosen to give some form of ASCII-rendering of the
1151 produces an arrow with split end, a dotted shaft and double head.
1152 A number of other arrow designs is given in the table below.
1153 Note that the ends of embedding arrows
1154 \begin_inset Formula $\xymatrix{A\ar@{^{(}->}[r] & B}
1158 are described by raising or lowering opening parentheses, such as in
1163 \begin_inset Newline newline
1169 \begin_layout Standard
1170 \begin_inset Tabular
1171 <lyxtabular version="3" rows="11" columns="2">
1172 <features islongtable="true">
1173 <column alignment="center" valignment="top" width="0">
1174 <column alignment="center" valignment="top" width="0">
1176 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1179 \begin_layout Plain Layout
1185 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1188 \begin_layout Plain Layout
1196 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1199 \begin_layout Plain Layout
1200 \begin_inset Formula \xymatrix{\ \ar[r] & \ }
1210 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1213 \begin_layout Plain Layout
1225 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1228 \begin_layout Plain Layout
1229 \begin_inset Formula \xymatrix{\ \ar@{-->}[r] & \ }
1239 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1242 \begin_layout Plain Layout
1254 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1257 \begin_layout Plain Layout
1258 \begin_inset Formula \xymatrix{\ \ar@{..>}[r] & \ }
1268 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1271 \begin_layout Plain Layout
1283 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1286 \begin_layout Plain Layout
1287 \begin_inset Formula \xymatrix{\ \ar@{~>}[r] & \ }
1297 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1300 \begin_layout Plain Layout
1312 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1315 \begin_layout Plain Layout
1316 \begin_inset Formula \xymatrix{\ \ar@{->>}[r] & \ }
1326 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1329 \begin_layout Plain Layout
1341 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1344 \begin_layout Plain Layout
1345 \begin_inset Formula \xymatrix{\ \ar@{-->>}[r] & \ }
1355 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1358 \begin_layout Plain Layout
1370 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1373 \begin_layout Plain Layout
1374 \begin_inset Formula \xymatrix{\ \ar@{>->>}[r] & \ }
1384 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1387 \begin_layout Plain Layout
1399 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1402 \begin_layout Plain Layout
1403 \begin_inset Formula \xymatrix{\ \ar@{_{(}->}[r] & \ }
1413 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1416 \begin_layout Plain Layout
1428 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1431 \begin_layout Plain Layout
1432 \begin_inset Formula \xymatrix{\ \ar@{^{(}->}[r] & \ }
1442 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1445 \begin_layout Plain Layout
1457 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1460 \begin_layout Plain Layout
1461 \begin_inset Formula \xymatrix{\ \ar@{|-|}[r] & \ }
1471 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1474 \begin_layout Plain Layout
1492 \begin_layout Standard
1494 Following the @-character by either a 2, 3, _,or a ^, we can produce arrows
1495 with double, triple shaft or arrows showing only the lower or upper half
1496 of their tips and ends.
1497 Arrows need not have tips nor ends, as the last example shows :
1498 \begin_inset Newline newline
1504 \begin_layout Standard
1505 \begin_inset Tabular
1506 <lyxtabular version="3" rows="8" columns="2">
1507 <features islongtable="true">
1508 <column alignment="center" valignment="top" width="0">
1509 <column alignment="center" valignment="top" width="0">
1511 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1514 \begin_layout Plain Layout
1520 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1523 \begin_layout Plain Layout
1531 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1534 \begin_layout Plain Layout
1535 \begin_inset Formula \xymatrix{\ \ar@2[r] & \ }
1545 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1548 \begin_layout Plain Layout
1560 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1563 \begin_layout Plain Layout
1564 \begin_inset Formula \xymatrix{\ \ar@3[r] & \ }
1574 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1577 \begin_layout Plain Layout
1589 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1592 \begin_layout Plain Layout
1593 \begin_inset Formula \xymatrix{\ \ar@_{->}[r] & \ }
1603 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1606 \begin_layout Plain Layout
1618 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1621 \begin_layout Plain Layout
1622 \begin_inset Formula \xymatrix{\ \ar@^{->}[r] & \ }
1632 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1635 \begin_layout Plain Layout
1647 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1650 \begin_layout Plain Layout
1651 \begin_inset Formula \xymatrix{\ \ar@^{>>->>}[r] & \ }
1661 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1664 \begin_layout Plain Layout
1676 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1679 \begin_layout Plain Layout
1680 \begin_inset Formula \xymatrix{\ \ar@{^{<}-_{>}}[r] & \ }
1690 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1693 \begin_layout Plain Layout
1705 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1708 \begin_layout Plain Layout
1709 \begin_inset Formula \xymatrix{\ \ar@2{--}[r] & \ }
1719 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1722 \begin_layout Plain Layout
1740 \begin_layout Subsubsection
1741 Designing your own arrows
1744 \begin_layout Standard
1745 Within certain limits there is even a way to design your own arrows.
1746 Using some the characters
1750 one can even design one's own arrow tips using the
1756 command in the preample.
1757 For explanations, we refer to the
1763 \begin_layout Plain Layout
1774 -manual, from which we take the example:
1777 \begin_layout Standard
1782 newdir{|>}{!/4.5pt/@{|}*:(1,-.2)@^{>}*:(1,+.2)@_{>}}
1787 \begin_layout Standard
1789 This defines a new arrow tip, referred to as
1799 and which displays correctly in LyX as:
1800 \begin_inset Formula \[
1801 \xymatrix{A\ar@{-|>}[r] & \ \ B}
1809 \begin_layout Subsection
1813 \begin_layout Standard
1814 Arrows are shifted sideways with the modifier
1819 \begin_inset Formula $\ldots$
1826 where the ellipsis is replaced by a positive or negative measure.
1827 For instance, to design a pair of mutually opposing arrows between two
1828 nodes, we shift them to see them apart.
1829 Note that the direction of the shift (positive) is to the left if one looks
1834 \begin_layout Standard
1850 \begin_layout Standard
1853 \begin_inset space ~
1857 \begin_inset space ~
1861 \begin_inset Formula \[
1862 \xymatrix{\circ\ar@<1ex>[r] & \circ\ar@<1ex>[l]}
1871 \begin_layout Subsubsection
1872 Inline or centered diagrams
1875 \begin_layout Standard
1876 Arrows and diagrams can be used inline, such as this one:
1877 \begin_inset Formula $\xymatrix{\circ\ar@<1ex>[r] & \circ\ar@<1ex>[l]}
1882 When their code is written inside LyX as above, select it and choose either
1887 for inline appearence or
1892 Diagrams constructed inline can later be centered, or, conversely, centered
1893 diagrams can be changed to inline formulas with
1895 Edit\SpecialChar \menuseparator
1900 \SpecialChar \menuseparator
1904 \begin_layout Subsection
1908 \begin_layout Standard
1909 There are two simple methods to make arrows bend.
1910 The first is giving an explicit value by which the midpoint of the arrow's
1911 shaft is raised or depressed, the other is by forcing the arrow to leave
1912 its origin in a prescribed compass direction and to make him enter the
1913 target at another direction.
1914 The necessary bending of the arrow is determined automatically.
1915 We describe both methods.
1918 \begin_layout Subsubsection
1922 \begin_layout Standard
1923 For bending arrows we use the modifier @/
1924 \begin_inset Formula $\ldots$
1928 The ellipsis stands for a TeX-measure which needs to be entered as a lower
1934 , we could simply write, e.
1935 \begin_inset space \thinspace{}
1945 for an arrow bending
1949 downwards, this cannot directly be done in LyX.
1950 It is necessary, to enclose the measure in a pair of braces, such as e.
1951 \begin_inset space \thinspace{}
1962 As an example, here are two opposing arrows between
1963 \begin_inset Formula $A$
1967 \begin_inset Formula $B$
1970 , each bending by .5 pica, given by the following source code:
1973 \begin_layout Standard
1985 \begin_layout Standard
1986 \begin_inset Formula \[
1987 \xymatrix{A\ar@/{}_{.5pc}/[r] & B\ar@/{}_{.5pc}/[l]}
1995 \begin_layout Subsubsection
1996 Specifying exit- and entrance directions.
2000 \begin_layout Standard
2001 An alternative for making arrows bend is by specifying their compass direction
2002 as they are leaving their source and their direction from which they enter
2004 Instead of north, north-east, east, etc., the directions are named
2036 , standing for up, up-right, right, down-right, etc..
2037 A direction is specified as @(
2049 stands for the direction the first object is left and
2053 stands for the direction from which the target is entered.
2054 As an example, we show some bending arrows and a loop, which arises when
2055 we do not specify a target for an arrow, just its incoming and outgoing
2059 \begin_layout Standard
2060 \begin_inset Formula \[
2061 \xymatrix{A\ar@(dr,dl)[r]\ar@(dr,dl)[rr] & B\ar@(d,r)[dl] & C\\
2070 \begin_layout LyX-Code
2078 \begin_inset Newline newline
2088 \begin_inset Newline newline
2096 \begin_layout Subsection
2100 \begin_layout Standard
2101 The above example is reminiscent of an automata diagram, except that in
2102 such a diagram states would be enclosed in small circles, with double circles
2103 denoting final states.
2107 \begin_layout Subsubsection
2111 \begin_layout Standard
2116 \begin_layout Plain Layout
2125 -Pic, entries can obtain a single or a double frame, such as
2126 \begin_inset Formula $\xymatrix{*+[F]{A}}
2131 \begin_inset Formula $\xymatrix{*+[F=]{B}}
2135 by prefixing an entry with
2143 and enclosing the portion of the entry to be framed in braces.
2144 Normally, the frame will be very tight so that it must be widened by prefixing
2154 Round frames, such as
2155 \begin_inset Formula $\xymatrix{*++[o][F]{A}}
2160 \begin_inset Formula $\xymatrix{*++[o][F=]{B}}
2164 are obtained by specifying the shape as
2169 So the latter figure was constructed as *++[o][F=]{B}.
2170 This way, the following automaton
2173 \begin_layout Standard
2174 \begin_inset Formula \[
2175 \xymatrix{\txt{start}\ar[r] & *++[o][F]{1}\ar[r] & *++[o][F=]{2}\ar@(ur,dr)\ar@(ur,ul)[l]}
2183 \begin_layout Standard
2187 \begin_layout Plain Layout
2199 \begin_layout LyX-Code
2209 \begin_layout LyX-Code
2215 \begin_layout LyX-Code
2223 \begin_layout LyX-Code
2227 \begin_layout Standard
2234 \SpecialChar \ldots{}
2239 will make a certain entry style the default, that can, of course be overridden
2240 for individual entries.
2245 entrymodifiers={++[o][F-]}
2247 , all following entries inside
2251 \begin_layout Plain Layout
2260 -matrices would be encircled.
2263 \begin_layout Subsubsection
2267 \begin_layout Standard
2268 Framing a whole rectangle inside an xymatrix is done with the macro pair
2288 The dimension of the rectangle is given as a dotted pair
2289 \begin_inset Formula $P_{0}.P_{1}$
2292 of points denoting the top left and lower right corners of the rectangle.
2293 Each point, in turn,is given as a doubly quoted comma separated pair
2294 \begin_inset Quotes eld
2298 \begin_inset Formula $x,y$
2302 \begin_inset Quotes erd
2306 \begin_inset Formula $x$
2310 \begin_inset Formula $y$
2314 These are followed by the framing commands, to produce figures such as
2316 \begin_inset Formula \[
2317 \xymatrix{A & B\ar@(d,r)[dl]\sp(0.2)\phi\sp(0.7)\psi\save"1,1"."2,1"*+[F=]\frm{}\restore\,\\
2318 C & \save"1,1"."1,2"*++[F]\frm{}\restore}
2334 save"1,1"."2,1"*+[F=]
2347 produces the doubly framed rectangle, and the code for the extra wide horizonta
2359 save"1,1"."1,2"*++[F]
2373 This code can be placed in arbitrary cells of the xymatrix.
2377 \begin_layout Section
2378 Using LyX's math editor
2379 \begin_inset CommandInset label
2381 name "sec:math-editor"
2388 \begin_layout Standard
2389 As an alternative to writing the
2393 code, then transforming it into a math-editing environment by marking it
2402 , one may construct and modify the whole xypic-diagram inside LyX's math
2404 We describe the editing steps for a figure just like the one above.
2408 \begin_layout Subsection
2409 Caveat - how to enter braces
2412 \begin_layout Standard
2413 Recall that in LyX's math-editor any pair of braces
2421 that are to enclose a macro-parameter must be entered by typing just
2428 The closing brace is automatically supplied and in between a box into which
2429 to the parameter is entered.
2434 \begin_layout Plain Layout
2443 -diagrams, this applies in particular to arrow modifications that are normally
2448 \SpecialChar \ldots{}
2453 with the ellipsis standing for the description of end, shaft and tip of
2455 Inside the math-editor, enter just
2461 and let LyX provide the closing brace and the box into which to enter the
2462 description of the arrow.
2465 \begin_layout Standard
2466 Braces that are entered without the backslash
2472 will just appear as typed, but cannot be used to receive a macro parameter.
2473 They are useful, for instance to denote sets, e.
2474 \begin_inset space \thinspace{}
2489 \begin_inset Formula $\{x\in X\mid x\notin x\}$
2495 \begin_layout Subsection
2496 Setting up the matrix
2499 \begin_layout Standard
2508 open a formula environment and enter:
2516 \begin_inset Formula $\times$
2523 \begin_layout Plain Layout
2533 Add extra rows by typing
2537 and add columns by typing
2543 \begin_layout Standard
2544 At any time, further rows or columns can be entered or deleted using commands
2547 Edit\SpecialChar \menuseparator
2551 their shortcuts, beginning with
2555 for the column commands or
2559 for the row commands.
2563 \begin_layout Subsection
2564 Entering nodes, arrows and labels
2567 \begin_layout Standard
2568 Type the nodes into the correct positions of the matrix.
2569 If you move the cursor out of the matrix, you should see a first rendering
2571 Next, add the arrows at the nodes from where they should emanate by typing
2588 can be any path made up from the characters
2605 Make sure that the path indeed leads to an existing node within the matrix.
2606 Otherwise, the figure will not display when the cursor leaves the editing
2610 \begin_layout Standard
2611 Next, label the arrows by attaching a label text as upper or lower indices
2612 to the end of the arrow's path.
2613 As always in LyX's math editor, an underscore
2617 opens a box for a lower index and a
2621 followed by a space opens a box for an upper index.
2622 You can enter any LaTeX-code as a label.
2626 \begin_layout Subsection
2630 \begin_layout Standard
2631 Finally, modify the appearance of the arrows by entering @-modifiers @{\SpecialChar \ldots{}
2633 @<\SpecialChar \ldots{}
2634 >, @(\SpecialChar \ldots{}
2635 ,\SpecialChar \ldots{}
2636 ) or @/\SpecialChar \ldots{}
2638 The above caveat applies to the first form only.
2639 It must be entered as
2645 with the arrow description entered inside the LyX-supplied box.
2646 If this box remains empty, you have specified an empty arrow.
2647 This is a useful construction, too, as you will see in the next section.
2651 \begin_layout Standard
2652 The other modifiers, @<\SpecialChar \ldots{}
2653 >, @(\SpecialChar \ldots{}
2654 ,\SpecialChar \ldots{}
2655 ) and @/\SpecialChar \ldots{}
2656 / are typed as shown with the arrow
2657 description replacing the ellipsis.
2658 The code for bending arrows, which in
2674 is any valid TeX-measure, should be entered as upper or lower index to
2676 Make sure that the ending slash does not end up being part of the upper
2680 \begin_layout Subsection
2681 What if something goes wrong
2684 \begin_layout Standard
2685 When constructing a diagram, you should at times check it by just moving
2686 the cursor out of the editing area to see whether instant preview can successfu
2687 lly convert it into graphical output.
2688 If this does not happen, it may either be that instant preview for some
2689 reason is not aware that it should retranslate the graphics.
2690 Moving the cursor into the editing area and out again sometimes wakes up
2694 \begin_layout Standard
2695 A more serious reason could be a syntactical error in your input.
2696 If necessary, redo the last editing steps, using Ctrl-z, or try to translate
2697 the LyX-file into dvi using Ctrl-d or
2699 View\SpecialChar \menuseparator
2703 There should be some error generated, which hopefully gives you a hint
2704 as to the source of the mistake.
2707 \begin_layout Section
2711 \begin_layout Standard
2712 Certain things do not work correctly inside LyX.
2713 The ones that we (used to) miss most are the horizontal and vertical scaling
2714 of diagrams, and the correct positioning of arrows.
2715 There are some workarounds that we are explaining here.
2719 \begin_layout Subsection
2720 Horizontal and vertical scaling
2723 \begin_layout Standard
2724 It is often convenient to stretch the horizontal or the vertical dimensions
2725 of an entire diagram by using spacing commands for rows and/or columns.
2730 \begin_layout Plain Layout
2739 -manual, for instance,
2745 \SpecialChar \ldots{}
2754 \begin_layout Plain Layout
2763 -matrix with row spacing of 1 pica.
2770 \SpecialChar \ldots{}
2775 \SpecialChar \ldots{}
2780 allows to modify the space between columns.
2781 Unfortunately, these commands do currently not work inside LyX, as the
2782 @-character is interpreted by LyX as ending the
2786 \begin_layout Plain Layout
2799 \begin_layout Standard
2804 \begin_layout Plain Layout
2814 \begin_inset space ~
2817 stores the values for row-spacing and column-spacing in the variables
2829 , add the following macro to the preamble (
2831 Layout\SpecialChar \menuseparator
2832 Document\SpecialChar \menuseparator
2836 \begin_layout LyX-Code
2842 \begin_layout LyX-Code
2850 \begin_layout LyX-Code
2856 \begin_layout LyX-Code
2864 \begin_layout LyX-Code
2870 \begin_layout LyX-Code
2876 \begin_layout LyX-Code
2880 \begin_layout Standard
2887 can be defined correspondingly by replacing
2900 Now, a figure can be scaled by entering
2906 \begin_layout Plain Layout
2916 Place the cursor inside the matrix, just before the first entry.
2934 Dont't forget the backslashes and remember, that the closing brace is automatic
2935 ally supplied by LyX.
2936 Inside the braces enter the dimensions.
2942 Here you see a diagram which is squashed vertically and stretched horizontally
2954 \begin_layout Standard
2955 \begin_inset Formula \[
2956 \xyC{.5pc}\xyC{9pc}\xymatrix{A\ar[r]\ar[d] & B\\
2957 C\ar@{}[ur]|{\text{{horizontal stretch}}}}
2965 \begin_layout Subsection
2969 \begin_layout Standard
2974 \begin_layout Plain Layout
2983 -vcommand allows the correct positioning of labels along the shaft of arrows.
2984 This feature is sometimes necessary, when the default position of a label
2985 would otherwise clutter the picture, or would even coincide with other
2986 items, such as the intersection of the arrows in the figure below.
2987 In order to shift a label position alongside the shaft of an arrow,
2991 \begin_layout Plain Layout
3001 \begin_inset space ~
3004 allows to prefix the label by a decimal number in parentheses, specifying
3005 the fraction of distance alongside the arrow where the label is to be placed.
3006 For instance, the code
3014 , will place the label on the shaft, but only about one third of the way.
3018 \begin_layout Standard
3019 Doing the same with labels above or below arrows as
3035 , does not work from inside LyX.
3036 Instead, one has to replace the hat-symbol ^, resp.
3037 the underscore _ , by the macros
3071 It is, in fact, possible to enter several labels this way and those labels
3072 are placed correctly, even if the arrow bends.
3073 In the following figure, the bending arrow with its four labels has been
3097 \begin_layout Standard
3098 \begin_inset Formula \[
3099 \xyC{4pc}\xymatrix{\bullet\ar[dr]\sp(0.3)\varphi & \circ\ar@{}[d]|\vdots\ar@(r,r)[d]\sp(0.2){\phi_{1}}\sp(0.4){\phi_{2}}\sb(0.6){\phi_{3}}\sp(0.8){\phi_{4}}\\
3100 \circ\ar[ur]\sb(0.3)\phi & \bullet}
3108 \begin_layout Subsection
3109 Invisible stretched arrows
3112 \begin_layout Standard
3113 A more general trick uses invisible arrows to place any object almost anywhere
3115 Produce an invisible arrow, shorten (or prolong) it past its goal by adding
3116 a decimal stretching ratio, e.
3117 \begin_inset space \thinspace{}
3130 Attach a label to this invisible arrow.
3134 \begin_layout Standard
3135 Thus, the down pointing arrow with its label
3136 \begin_inset Formula $\varphi$
3139 at (0.3) of its way along the shaft might as well have been produced by
3140 adding to the regular arrow
3147 \begin_inset Formula $\varphi$
3158 , reaching only 0.6 of the way.
3159 Its label will now appear at 0.3 of the way of the original visible arrow.
3163 \begin_layout Standard
3164 This workaround has two minor drawbacks: First, it does not work with bending
3166 Secondly, prolonging an invisible arrow beyond the normal dimension of
3167 the figure will invisibly extend the figure box, and thereby cause too
3168 much vertical space between the figure and the preceding or the following
3173 \begin_layout Standard
3174 Nevertheless, invisible arrows are an important tool, since they can, in
3175 principle, be used to place information at any chosen place in a diagram.
3176 In the above figure, for instance, we have used an invisible arrow to carry
3183 as label and at the earlier figure we had used an invisible arrow to carry
3185 \begin_inset Quotes eld
3193 \begin_inset Quotes erd
3196 into the center of the figure.
3199 \begin_layout Subsection
3203 \begin_layout Standard
3204 Advanced painting can be done when using the
3207 Nice collection of examples from Aaron Lauda can be found at
3208 \begin_inset Flex URL
3211 \begin_layout Plain Layout
3213 http://www.dpmms.cam.ac.uk/~al366/xytutorial.html
3221 \begin_layout Bibliography
3222 \begin_inset CommandInset bibitem
3223 LatexCommand bibitem
3234 \begin_layout Plain Layout
3250 Available as part of the
3258 \begin_layout Bibliography
3259 \begin_inset CommandInset bibitem
3260 LatexCommand bibitem
3262 key "instant-preview"
3267 \begin_inset Flex URL
3270 \begin_layout Plain Layout
3272 http://www.tug.org/tex-archive/help/Catalogue/entries/preview-latex.html
3280 \begin_layout Bibliography
3281 \begin_inset CommandInset bibitem
3282 LatexCommand bibitem
3289 \begin_inset Flex URL
3292 \begin_layout Plain Layout
3294 http://www.tug.org/tex-archive/help/Catalogue/entries/xypic.html
3302 \begin_layout Bibliography
3303 \begin_inset CommandInset bibitem
3304 LatexCommand bibitem
3311 \begin_inset Flex URL
3314 \begin_layout Plain Layout
3316 http://www.gnu.org/software/auctex/