1 #LyX 1.6.0svn 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
174 \begin_inset Graphics
175 filename xyfigure.png
177 BoundingBox 0bp 0bp 580bp 440bp
185 \begin_layout Standard
186 \begin_inset VSpace defskip
192 \begin_layout Standard
193 In this note, we describe how
197 \begin_layout Plain Layout
206 -pic can be used from inside LyX, how diagrams can be created and edited.
207 We have tested the following using LyX versions 1.3.7 up to 1.6, running under
208 WindowsXP and under Windows Vista.
212 \begin_layout Standard
213 There are two modes of operations: For a start, and for some first tests,
214 it may be easiest to first enter the
218 \begin_layout Plain Layout
227 -Pic code inside the LyX-window, select it all and convert it to a graphical
228 representation by pressing
241 \begin_layout Plain Layout
250 -Pic more frequently, or if you want to modify your initial figure, you
251 will want to assemble and modify your figures using LyX's math editor.
255 \begin_layout Standard
256 Once the cursor is moved over a diagram, this is displayed as an array of
257 nodes and arrow-commands.
258 These can be changed interactively.
259 When the cursor leaves the editing area, the diagram reappears.
263 \begin_layout Standard
264 In the first two sections of this documentation, we explain how to use LyX
265 in the first mentioned mode and we introduce all
269 \begin_layout Plain Layout
278 -Pic features that might be of use for drawing commutative diagrams, graphs
280 Section 3 explains how to use the
284 \begin_layout Plain Layout
293 -Pic commands inside a math-editing area.
297 \begin_layout Standard
298 It is not our intention to write another introduction to
302 \begin_layout Plain Layout
311 -Pic, rather our motivation is to give an introduction how the most important
312 commands work inside LyX, since the keystrokes as explained in the
316 \begin_layout Plain Layout
326 \begin_inset CommandInset citation
332 will not always function correctly inside LyX.
336 \begin_layout Section
340 \begin_layout Standard
341 The following requires that the LaTeX-packages
349 are installed in the LaTeX system.
350 They are available from CTAN, see at
351 \begin_inset CommandInset citation
353 key "instant-preview"
359 \begin_inset CommandInset citation
366 After freshly installing them, it may be necessary, to run
368 Edit\SpecialChar \menuseparator
371 from the main LyX menu.
372 The steps to a first diagram output in LyX are then:
375 \begin_layout Enumerate
382 \begin_layout Enumerate
385 Edit\SpecialChar \menuseparator
386 Preferences\SpecialChar \menuseparator
387 Look and Feel\SpecialChar \menuseparator
390 and place a check-mark at
398 \begin_layout Enumerate
403 works by opening a LyX-document and entering any math-formula, e.
404 \begin_inset space \thinspace{}
409 \begin_inset Formula $a+b=c$
416 \begin_layout Enumerate
417 Move the cursor out of the formula, and watch it change its appearance to
418 look just like in the finished dvi- or postscript document.
423 \begin_layout Enumerate
430 \begin_layout Enumerate
433 Layout\SpecialChar \menuseparator
434 Document\SpecialChar \menuseparator
440 \begin_inset Newline newline
448 \begin_layout Enumerate
449 Inside your LyX-Document, enter the text
452 \begin_inset Newline newline
464 \begin_layout Enumerate
465 Select the whole text and choose
467 Insert\SpecialChar \menuseparator
468 Math\SpecialChar \menuseparator
471 , or use the corresponding keyboard shortcut
479 \begin_layout Enumerate
480 Move the mouse cursor out of the editing box and wait for a split second
481 to see an arrow appear:
482 \begin_inset Formula $\xymatrix{A\ar[r] & B}
491 \begin_layout Section
495 \begin_layout Standard
496 The following diagram, which is taken from the documentation of
500 \begin_layout Plain Layout
510 \begin_inset CommandInset citation
516 by its creator Kristoffer H.
517 Rose, will provide an example for many of the features available with that
522 \begin_layout LyX-Code
526 \begin_inset Newline newline
538 \begin_inset Newline newline
548 \begin_inset Newline newline
564 \begin_inset Newline newline
572 \begin_layout LyX-Code
576 \begin_layout Standard
577 Again, to turn this code into a graphical output, select it all at once
584 \SpecialChar \ldots{}
585 up to the closing brace \SpecialChar \ldots{}
590 and turn it into display-math as explained above.
591 A moment after the cursor leaves the math-area, you should see the diagram
592 in its full graphical glory as shown below.
596 \begin_layout Standard
597 \begin_inset Formula $\xymatrix{U\ar@/_{1pc}/[ddr]_{\psi}\ar@/{}^{1pc}/[drr]^{\varphi}\ar@{.>}[dr]|-{(x,y)}\\
598 & X\times_{Z}Y\ar[d]^{q}\ar[r]_{p} & X\ar[d]_{f}\\
606 \begin_layout Subsection
607 The matrix layout of diagrams
610 \begin_layout Standard
615 uses a matrix to define the layout of the vertices of a diagram.
616 For the above example, we need a
617 \begin_inset Formula $3\times3$
620 -matrix of which 5 entries are used for the vertices
621 \begin_inset Formula $U$
625 \begin_inset Formula $X\times_{Z}Y$
629 \begin_inset Formula $X$
633 \begin_inset Formula $Y$
637 \begin_inset Formula $Z$
640 , the other positions remaining empty.
641 In this case, the following matrix determines the layout:
644 \begin_layout LyX-Code
648 \begin_inset Newline newline
656 \begin_inset Newline newline
666 \begin_inset Newline newline
672 \begin_layout Standard
673 The pattern should be familiar from LaTeX: We see three rows, the first
674 two being terminated by the end-of-line-marker
683 Each line consists of entries, separated by the ampersand
691 \begin_layout Subsection
695 \begin_layout Standard
696 Having entered the vertices, we add arrows between them.
701 -command to produce an arrow is
707 , it is entered into the cell of the matrix where the arrow is to start.
708 The target of the arrow is defined by direction commands
725 These can be combined to a path and enclosed in square brackets.
726 As an example, the arrows from the vertex
727 \begin_inset Formula $U$
730 in the upper left corner down and right to the vertices
731 \begin_inset Formula $X\times_{Z}Y$
735 \begin_inset Formula $Y$
739 \begin_inset Formula $X$
742 are, respectively, defined as
761 Thus the above diagram with all arrows added becomes:
764 \begin_layout LyX-Code
768 \begin_inset Newline newline
782 \begin_inset Newline newline
798 \begin_inset Newline newline
806 \begin_layout Standard
807 \begin_inset Formula \xymatrix{ U \ar[ddr] \ar[drr] \ar[dr]\\
808 & X \times_{Z} Y \ar[d] \ar[r] & X \ar[d]\\
817 \begin_layout LyX-Code
821 \begin_layout LyX-Code
825 \begin_layout Subsection
829 \begin_layout Standard
830 Labels are attached to arrows by affixing them as upper or lower indices
846 defines an arrow going one cell down, two to the right and having the label
848 \begin_inset Formula $\varphi$
852 To attach a label below the arrow, make it a lower index as in
861 This explanation is correct only for arrows pointing to the right.
862 More precisely, imagine looking along the arrow in the direction it is
864 Then an upper index places a label to the left and a lower index places
866 Consequently, an arrow pointing from right to left, such as
877 \begin_inset Formula $\alpha$
881 \begin_inset Formula $\beta$
885 \begin_inset space \thinspace{}
889 \begin_inset space \space{}
893 \begin_inset Formula $\xymatrix{\ & \ \ar[l]_{\beta}^{\alpha}.}
897 Using the character | instead of ^ or _ , it is even possible to place the
898 label right onto the arrow, obscuring part of its shaft.
902 \begin_layout Standard
903 Normally, a label is placed halfway between an arrow's start and target
905 In the first diagram, the central arrow starting in
906 \begin_inset Formula $U$
910 \begin_inset Formula $(x,y)$
913 in the middle of the arrow's shaft, rather than in the middle between the
914 two objects it connects.
915 This is achieved by prefixing the label with a minus sign, here:
924 \begin_layout LyX-Code
928 \begin_inset Newline newline
946 \begin_inset Newline newline
962 \begin_inset Newline newline
970 \begin_layout LyX-Code
971 \begin_inset Formula \xymatrix{ U \ar[ddr]_{\psi}\ar[drr]^{\varphi}\ar[dr]|-{(x,y)}\\
972 & X \times_{Z} Y \ar[d]^{q} \ar[r]_{p} & X \ar[d]_{f}\\
981 \begin_layout Standard
985 \begin_layout Plain Layout
994 -pic normally permits labels to be shifted towards the tip or towards the
995 start of an arrow by prefixing the label with a ratio, such as e.
996 \begin_inset space \thinspace{}
1005 In LyX this works only for labels which are placed on top of the arrow,
1018 \begin_layout Standard
1019 For labels placed to the left or to the right of the arrow this does not
1025 \begin_layout Plain Layout
1034 -pic code such as e.
1035 \begin_inset space \thinspace{}
1055 is not correctly interpreted by LyX's math editor.
1056 Two workarounds are suggested in the last section of this note.
1059 \begin_layout Subsection
1063 \begin_layout Standard
1064 Modification of the design, the form or the positioning of arrows are introduced
1070 This is followed by a pair of matching brackets, where the form of the
1083 indicates, whether we want to modify the design, the or the curvature of
1085 Various modifactions can be applied to an arrow at the same time.
1088 \begin_layout Subsubsection
1092 \begin_layout Standard
1093 Various designs such as
1109 are possible for the shaft of an arrow.
1110 These can be combined with various ends and various tips.
1111 In general, the design of an arrow is described by following the command
1122 -sign and a pair of braces {\SpecialChar \ldots{}
1123 } containing characters describing the end,
1124 the shaft and the tip of the arrow.
1125 These characters are chosen to give some form of ASCII-rendering of the
1133 produces an arrow with split end, a dotted shaft and double head.
1134 A number of other arrow designs is given in the table below.
1135 Note that the ends of embedding arrows
1136 \begin_inset Formula $\xymatrix{A\ar@{^{(}->}[r] & B}
1140 are described by raising or lowering opening parentheses, such as in
1145 \begin_inset Newline newline
1151 \begin_layout Standard
1152 \begin_inset Tabular
1153 <lyxtabular version="3" rows="11" columns="2">
1154 <features islongtable="true">
1155 <column alignment="center" valignment="top" width="0">
1156 <column alignment="center" valignment="top" width="0">
1158 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1161 \begin_layout Plain Layout
1167 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1170 \begin_layout Plain Layout
1178 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1181 \begin_layout Plain Layout
1182 \begin_inset Formula \xymatrix{\ \ar[r] & \ }
1192 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1195 \begin_layout Plain Layout
1207 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1210 \begin_layout Plain Layout
1211 \begin_inset Formula \xymatrix{\ \ar@{-->}[r] & \ }
1221 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1224 \begin_layout Plain Layout
1236 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1239 \begin_layout Plain Layout
1240 \begin_inset Formula \xymatrix{\ \ar@{..>}[r] & \ }
1250 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1253 \begin_layout Plain Layout
1265 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1268 \begin_layout Plain Layout
1269 \begin_inset Formula \xymatrix{\ \ar@{~>}[r] & \ }
1279 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1282 \begin_layout Plain Layout
1294 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1297 \begin_layout Plain Layout
1298 \begin_inset Formula \xymatrix{\ \ar@{->>}[r] & \ }
1308 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1311 \begin_layout Plain Layout
1323 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1326 \begin_layout Plain Layout
1327 \begin_inset Formula \xymatrix{\ \ar@{-->>}[r] & \ }
1337 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1340 \begin_layout Plain Layout
1352 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1355 \begin_layout Plain Layout
1356 \begin_inset Formula \xymatrix{\ \ar@{>->>}[r] & \ }
1366 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1369 \begin_layout Plain Layout
1381 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1384 \begin_layout Plain Layout
1385 \begin_inset Formula \xymatrix{\ \ar@{_{(}->}[r] & \ }
1395 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1398 \begin_layout Plain Layout
1410 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1413 \begin_layout Plain Layout
1414 \begin_inset Formula \xymatrix{\ \ar@{^{(}->}[r] & \ }
1424 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1427 \begin_layout Plain Layout
1439 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1442 \begin_layout Plain Layout
1443 \begin_inset Formula \xymatrix{\ \ar@{|-|}[r] & \ }
1453 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1456 \begin_layout Plain Layout
1474 \begin_layout Standard
1476 Following the @-character by either a 2, 3, _,or a ^, we can produce arrows
1477 with double, triple shaft or arrows showing only the lower or upper half
1478 of their tips and ends.
1479 Arrows need not have tips nor ends, as the last example shows :
1480 \begin_inset Newline newline
1486 \begin_layout Standard
1487 \begin_inset Tabular
1488 <lyxtabular version="3" rows="8" columns="2">
1489 <features islongtable="true">
1490 <column alignment="center" valignment="top" width="0">
1491 <column alignment="center" valignment="top" width="0">
1493 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1496 \begin_layout Plain Layout
1502 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1505 \begin_layout Plain Layout
1513 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1516 \begin_layout Plain Layout
1517 \begin_inset Formula \xymatrix{\ \ar@2[r] & \ }
1527 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1530 \begin_layout Plain Layout
1542 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1545 \begin_layout Plain Layout
1546 \begin_inset Formula \xymatrix{\ \ar@3[r] & \ }
1556 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1559 \begin_layout Plain Layout
1571 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1574 \begin_layout Plain Layout
1575 \begin_inset Formula \xymatrix{\ \ar@_{->}[r] & \ }
1585 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1588 \begin_layout Plain Layout
1600 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1603 \begin_layout Plain Layout
1604 \begin_inset Formula \xymatrix{\ \ar@^{->}[r] & \ }
1614 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1617 \begin_layout Plain Layout
1629 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1632 \begin_layout Plain Layout
1633 \begin_inset Formula \xymatrix{\ \ar@^{>>->>}[r] & \ }
1643 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1646 \begin_layout Plain Layout
1658 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1661 \begin_layout Plain Layout
1662 \begin_inset Formula \xymatrix{\ \ar@{^{<}-_{>}}[r] & \ }
1672 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1675 \begin_layout Plain Layout
1687 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1690 \begin_layout Plain Layout
1691 \begin_inset Formula \xymatrix{\ \ar@2{--}[r] & \ }
1701 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1704 \begin_layout Plain Layout
1722 \begin_layout Subsubsection
1723 Designing your own arrows
1726 \begin_layout Standard
1727 Within certain limits there is even a way to design your own arrows.
1728 Using some the characters
1732 one can even design one's own arrow tips using the
1738 command in the preample.
1739 For explanations, we refer to the
1745 \begin_layout Plain Layout
1756 -manual, from which we take the example:
1759 \begin_layout Standard
1764 newdir{|>}{!/4.5pt/@{|}*:(1,-.2)@^{>}*:(1,+.2)@_{>}}
1769 \begin_layout Standard
1771 This defines a new arrow tip, referred to as
1781 and which displays correctly in LyX as:
1782 \begin_inset Formula \[
1783 \xymatrix{A\ar@{-|>}[r] & \ \ B}
1791 \begin_layout Subsection
1795 \begin_layout Standard
1796 Arrows are shifted sideways with the modifier
1801 \begin_inset Formula $\ldots$
1808 where the ellipsis is replaced by a positive or negative measure.
1809 For instance, to design a pair of mutually opposing arrows between two
1810 nodes, we shift them to see them apart.
1811 Note that the direction of the shift (positive) is to the left if one looks
1816 \begin_layout Standard
1832 \begin_layout Standard
1835 \begin_inset space ~
1839 \begin_inset space ~
1843 \begin_inset Formula \[
1844 \xymatrix{\circ\ar@<1ex>[r] & \circ\ar@<1ex>[l]}
1853 \begin_layout Subsubsection
1854 Inline or centered diagrams
1857 \begin_layout Standard
1858 Arrows and diagrams can be used inline, such as this one:
1859 \begin_inset Formula $\xymatrix{\circ\ar@<1ex>[r] & \circ\ar@<1ex>[l]}
1864 When their code is written inside LyX as above, select it and choose either
1869 for inline appearence or
1874 Diagrams constructed inline can later be centered, or, conversely, centered
1875 diagrams can be changed to inline formulas with
1877 Edit\SpecialChar \menuseparator
1882 \SpecialChar \menuseparator
1886 \begin_layout Subsection
1890 \begin_layout Standard
1891 There are two simple methods to make arrows bend.
1892 The first is giving an explicit value by which the midpoint of the arrow's
1893 shaft is raised or depressed, the other is by forcing the arrow to leave
1894 its origin in a prescribed compass direction and to make him enter the
1895 target at another direction.
1896 The necessary bending of the arrow is determined automatically.
1897 We describe both methods.
1900 \begin_layout Subsubsection
1904 \begin_layout Standard
1905 For bending arrows we use the modifier @/
1906 \begin_inset Formula $\ldots$
1910 The ellipsis stands for a TeX-measure which needs to be entered as a lower
1916 , we could simply write, e.
1917 \begin_inset space \thinspace{}
1927 for an arrow bending
1931 downwards, this cannot directly be done in LyX.
1932 It is necessary, to enclose the measure in a pair of braces, such as e.
1933 \begin_inset space \thinspace{}
1944 As an example, here are two opposing arrows between
1945 \begin_inset Formula $A$
1949 \begin_inset Formula $B$
1952 , each bending by .5 pica, given by the following source code:
1955 \begin_layout Standard
1967 \begin_layout Standard
1968 \begin_inset Formula \[
1969 \xymatrix{A\ar@/{}_{.5pc}/[r] & B\ar@/{}_{.5pc}/[l]}
1977 \begin_layout Subsubsection
1978 Specifying exit- and entrance directions.
1982 \begin_layout Standard
1983 An alternative for making arrows bend is by specifying their compass direction
1984 as they are leaving their source and their direction from which they enter
1986 Instead of north, north-east, east, etc., the directions are named
2018 , standing for up, up-right, right, down-right, etc..
2019 A direction is specified as @(
2031 stands for the direction the first object is left and
2035 stands for the direction from which the target is entered.
2036 As an example, we show some bending arrows and a loop, which arises when
2037 we do not specify a target for an arrow, just its incoming and outgoing
2041 \begin_layout Standard
2042 \begin_inset Formula \[
2043 \xymatrix{A\ar@(dr,dl)[r]\ar@(dr,dl)[rr] & B\ar@(d,r)[dl] & C\\
2052 \begin_layout LyX-Code
2060 \begin_inset Newline newline
2070 \begin_inset Newline newline
2078 \begin_layout Subsection
2082 \begin_layout Standard
2083 The above example is reminiscent of an automata diagram, except that in
2084 such a diagram states would be enclosed in small circles, with double circles
2085 denoting final states.
2089 \begin_layout Subsubsection
2093 \begin_layout Standard
2098 \begin_layout Plain Layout
2107 -Pic, entries can obtain a single or a double frame, such as
2108 \begin_inset Formula $\xymatrix{*+[F]{A}}
2113 \begin_inset Formula $\xymatrix{*+[F=]{B}}
2117 by prefixing an entry with
2125 and enclosing the portion of the entry to be framed in braces.
2126 Normally, the frame will be very tight so that it must be widened by prefixing
2136 Round frames, such as
2137 \begin_inset Formula $\xymatrix{*++[o][F]{A}}
2142 \begin_inset Formula $\xymatrix{*++[o][F=]{B}}
2146 are obtained by specifying the shape as
2151 So the latter figure was constructed as *++[o][F=]{B}.
2152 This way, the following automaton
2155 \begin_layout Standard
2156 \begin_inset Formula \[
2157 \xymatrix{\txt{start}\ar[r] & *++[o][F]{1}\ar[r] & *++[o][F=]{2}\ar@(ur,dr)\ar@(ur,ul)[l]}
2165 \begin_layout Standard
2169 \begin_layout Plain Layout
2181 \begin_layout LyX-Code
2191 \begin_layout LyX-Code
2197 \begin_layout LyX-Code
2205 \begin_layout LyX-Code
2209 \begin_layout Standard
2216 \SpecialChar \ldots{}
2221 will make a certain entry style the default, that can, of course be overridden
2222 for individual entries.
2227 entrymodifiers={++[o][F-]}
2229 , all following entries inside
2233 \begin_layout Plain Layout
2242 -matrices would be encircled.
2245 \begin_layout Subsubsection
2249 \begin_layout Standard
2250 Framing a whole rectangle inside an xymatrix is done with the macro pair
2270 The dimension of the rectangle is given as a dotted pair
2271 \begin_inset Formula $P_{0}.P_{1}$
2274 of points denoting the top left and lower right corners of the rectangle.
2275 Each point, in turn,is given as a doubly quoted comma separated pair
2276 \begin_inset Quotes eld
2280 \begin_inset Formula $x,y$
2284 \begin_inset Quotes erd
2288 \begin_inset Formula $x$
2292 \begin_inset Formula $y$
2296 These are followed by the framing commands, to produce figures such as
2298 \begin_inset Formula \[
2299 \xymatrix{A & B\ar@(d,r)[dl]\sp(0.2)\phi\sp(0.7)\psi\save"1,1"."2,1"*+[F=]\frm{}\restore\,\\
2300 C & \save"1,1"."1,2"*++[F]\frm{}\restore}
2316 save"1,1"."2,1"*+[F=]
2329 produces the doubly framed rectangle, and the code for the extra wide horizonta
2341 save"1,1"."1,2"*++[F]
2355 This code can be placed in arbitrary cells of the xymatrix.
2359 \begin_layout Section
2360 Using LyX's math editor
2363 \begin_layout Standard
2364 As an alternative to writing the
2368 code, then transforming it into a math-editing environment by marking it
2377 , one may construct and modify the whole xypic-diagram inside LyX's math
2379 We describe the editing steps for a figure just like the one above.
2383 \begin_layout Subsection
2384 Caveat - how to enter braces
2387 \begin_layout Standard
2388 Recall that in LyX's math-editor any pair of braces
2396 that are to enclose a macro-parameter must be entered by typing just
2403 The closing brace is automatically supplied and in between a box into which
2404 to the parameter is entered.
2409 \begin_layout Plain Layout
2418 -diagrams, this applies in particular to arrow modifications that are normally
2423 \SpecialChar \ldots{}
2428 with the ellipsis standing for the description of end, shaft and tip of
2430 Inside the math-editor, enter just
2436 and let LyX provide the closing brace and the box into which to enter the
2437 description of the arrow.
2440 \begin_layout Standard
2441 Braces that are entered without the backslash
2447 will just appear as typed, but cannot be used to receive a macro parameter.
2448 They are useful, for instance to denote sets, e.
2449 \begin_inset space \thinspace{}
2464 \begin_inset Formula $\{x\in X\mid x\notin x\}$
2470 \begin_layout Subsection
2471 Setting up the matrix
2474 \begin_layout Standard
2483 open a formula environment and enter:
2491 \begin_inset Formula $\times$
2498 \begin_layout Plain Layout
2508 Add extra rows by typing
2512 and add columns by typing
2518 \begin_layout Standard
2519 At any time, further rows or columns can be entered or deleted using commands
2522 Edit\SpecialChar \menuseparator
2526 their shortcuts, beginning with
2530 for the column commands or
2534 for the row commands.
2538 \begin_layout Subsection
2539 Entering nodes, arrows and labels
2542 \begin_layout Standard
2543 Type the nodes into the correct positions of the matrix.
2544 If you move the cursor out of the matrix, you should see a first rendering
2546 Next, add the arrows at the nodes from where they should emanate by typing
2563 can be any path made up from the characters
2580 Make sure that the path indeed leads to an existing node within the matrix.
2581 Otherwise, the figure will not display when the cursor leaves the editing
2585 \begin_layout Standard
2586 Next, label the arrows by attaching a label text as upper or lower indices
2587 to the end of the arrow's path.
2588 As always in LyX's math editor, an underscore
2592 opens a box for a lower index and a
2596 followed by a space opens a box for an upper index.
2597 You can enter any LaTeX-code as a label.
2601 \begin_layout Subsection
2605 \begin_layout Standard
2606 Finally, modify the appearance of the arrows by entering @-modifiers @{\SpecialChar \ldots{}
2608 @<\SpecialChar \ldots{}
2609 >, @(\SpecialChar \ldots{}
2610 ,\SpecialChar \ldots{}
2611 ) or @/\SpecialChar \ldots{}
2613 The above caveat applies to the first form only.
2614 It must be entered as
2620 with the arrow description entered inside the LyX-supplied box.
2621 If this box remains empty, you have specified an empty arrow.
2622 This is a useful construction, too, as you will see in the next section.
2626 \begin_layout Standard
2627 The other modifiers, @<\SpecialChar \ldots{}
2628 >, @(\SpecialChar \ldots{}
2629 ,\SpecialChar \ldots{}
2630 ) and @/\SpecialChar \ldots{}
2631 / are typed as shown with the arrow
2632 description replacing the ellipsis.
2633 The code for bending arrows, which in
2649 is any valid TeX-measure, should be entered as upper or lower index to
2651 Make sure that the ending slash does not end up being part of the upper
2655 \begin_layout Subsection
2656 What if something goes wrong
2659 \begin_layout Standard
2660 When constructing a diagram, you should at times check it by just moving
2661 the cursor out of the editing area to see whether instant preview can successfu
2662 lly convert it into graphical output.
2663 If this does not happen, it may either be that instant preview for some
2664 reason is not aware that it should retranslate the graphics.
2665 Moving the cursor into the editing area and out again sometimes wakes up
2669 \begin_layout Standard
2670 A more serious reason could be a syntactical error in your input.
2671 If necessary, redo the last editing steps, using Ctrl-z, or try to translate
2672 the LyX-file into dvi using Ctrl-d or
2674 View\SpecialChar \menuseparator
2678 There should be some error generated, which hopefully gives you a hint
2679 as to the source of the mistake.
2682 \begin_layout Section
2686 \begin_layout Standard
2687 Certain things do not work correctly inside LyX.
2688 The ones that we (used to) miss most are the horizontal and vertical scaling
2689 of diagrams, and the correct positioning of arrows.
2690 There are some workarounds that we are explaining here.
2694 \begin_layout Subsection
2695 Horizontal and vertical scaling
2698 \begin_layout Standard
2699 It is often convenient to stretch the horizontal or the vertical dimensions
2700 of an entire diagram by using spacing commands for rows and/or columns.
2705 \begin_layout Plain Layout
2714 -manual, for instance,
2720 \SpecialChar \ldots{}
2729 \begin_layout Plain Layout
2738 -matrix with row spacing of 1 pica.
2745 \SpecialChar \ldots{}
2750 \SpecialChar \ldots{}
2755 allows to modify the space between columns.
2756 Unfortunately, these commands do currently not work inside LyX, as the
2757 @-character is interpreted by LyX as ending the
2761 \begin_layout Plain Layout
2774 \begin_layout Standard
2779 \begin_layout Plain Layout
2789 \begin_inset space ~
2792 stores the values for row-spacing and column-spacing in the variables
2804 , add the following macro to the preamble (
2806 Layout\SpecialChar \menuseparator
2807 Document\SpecialChar \menuseparator
2811 \begin_layout LyX-Code
2817 \begin_layout LyX-Code
2825 \begin_layout LyX-Code
2831 \begin_layout LyX-Code
2839 \begin_layout LyX-Code
2845 \begin_layout LyX-Code
2851 \begin_layout LyX-Code
2855 \begin_layout Standard
2862 can be defined correspondingly by replacing
2875 Now, a figure can be scaled by entering
2881 \begin_layout Plain Layout
2891 Place the cursor inside the matrix, just before the first entry.
2909 Dont't forget the backslashes and remember, that the closing brace is automatic
2910 ally supplied by LyX.
2911 Inside the braces enter the dimensions.
2917 Here you see a diagram which is squashed vertically and stretched horizontally
2929 \begin_layout Standard
2930 \begin_inset Formula \[
2931 \xyC{.5pc}\xyC{9pc}\xymatrix{A\ar[r]\ar[d] & B\\
2932 C\ar@{}[ur]|{\text{{horizontal stretch}}}}
2940 \begin_layout Subsection
2944 \begin_layout Standard
2949 \begin_layout Plain Layout
2958 -vcommand allows the correct positioning of labels along the shaft of arrows.
2959 This feature is sometimes necessary, when the default position of a label
2960 would otherwise clutter the picture, or would even coincide with other
2961 items, such as the intersection of the arrows in the figure below.
2962 In order to shift a label position alongside the shaft of an arrow,
2966 \begin_layout Plain Layout
2976 \begin_inset space ~
2979 allows to prefix the label by a decimal number in parentheses, specifying
2980 the fraction of distance alongside the arrow where the label is to be placed.
2981 For instance, the code
2989 , will place the label on the shaft, but only about one third of the way.
2993 \begin_layout Standard
2994 Doing the same with labels above or below arrows as
3010 , does not work from inside LyX.
3011 Instead, one has to replace the hat-symbol ^, resp.
3012 the underscore _ , by the macros
3046 It is, in fact, possible to enter several labels this way and those labels
3047 are placed correctly, even if the arrow bends.
3048 In the following figure, the bending arrow with its four labels has been
3072 \begin_layout Standard
3073 \begin_inset Formula \[
3074 \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}}\\
3075 \circ\ar[ur]\sb(0.3)\phi & \bullet}
3083 \begin_layout Subsection
3084 Invisible stretched arrows
3087 \begin_layout Standard
3088 A more general trick uses invisible arrows to place any object almost anywhere
3090 Produce an invisible arrow, shorten (or prolong) it past its goal by adding
3091 a decimal stretching ratio, e.
3092 \begin_inset space \thinspace{}
3105 Attach a label to this invisible arrow.
3109 \begin_layout Standard
3110 Thus, the down pointing arrow with its label
3111 \begin_inset Formula $\varphi$
3114 at (0.3) of its way along the shaft might as well have been produced by
3115 adding to the regular arrow
3122 \begin_inset Formula $\varphi$
3133 , reaching only 0.6 of the way.
3134 Its label will now appear at 0.3 of the way of the original visible arrow.
3138 \begin_layout Standard
3139 This workaround has two minor drawbacks: First, it does not work with bending
3141 Secondly, prolonging an invisible arrow beyond the normal dimension of
3142 the figure will invisibly extend the figure box, and thereby cause too
3143 much vertical space between the figure and the preceding or the following
3148 \begin_layout Standard
3149 Nevertheless, invisible arrows are an important tool, since they can, in
3150 principle, be used to place information at any chosen place in a diagram.
3151 In the above figure, for instance, we have used an invisible arrow to carry
3158 as label and at the earlier figure we had used an invisible arrow to carry
3160 \begin_inset Quotes eld
3168 \begin_inset Quotes erd
3171 into the center of the figure.
3174 \begin_layout Bibliography
3175 \begin_inset CommandInset bibitem
3176 LatexCommand bibitem
3187 \begin_layout Plain Layout
3203 Available as part of the
3211 \begin_layout Bibliography
3212 \begin_inset CommandInset bibitem
3213 LatexCommand bibitem
3215 key "instant-preview"
3220 \begin_inset Flex URL
3223 \begin_layout Plain Layout
3225 http://www.tug.org/tex-archive/help/Catalogue/entries/preview-latex.html
3233 \begin_layout Bibliography
3234 \begin_inset CommandInset bibitem
3235 LatexCommand bibitem
3242 \begin_inset Flex URL
3245 \begin_layout Plain Layout
3247 http://www.tug.org/tex-archive/help/Catalogue/entries/xypic.html
3255 \begin_layout Bibliography
3256 \begin_inset CommandInset bibitem
3257 LatexCommand bibitem
3264 \begin_inset Flex URL
3267 \begin_layout Plain Layout
3269 http://www.gnu.org/software/auctex/