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.g.
405 \begin_inset Formula $a+b=c$
412 \begin_layout Enumerate
413 Move the cursor out of the formula, and watch it change its appearance to
414 look just like in the finished dvi- or postscript document.
419 \begin_layout Enumerate
426 \begin_layout Enumerate
429 Layout\SpecialChar \menuseparator
430 Document\SpecialChar \menuseparator
436 \begin_inset Newline newline
444 \begin_layout Enumerate
445 Inside your LyX-Document, enter the text
448 \begin_inset Newline newline
460 \begin_layout Enumerate
461 Select the whole text and choose
463 Insert\SpecialChar \menuseparator
464 Math\SpecialChar \menuseparator
467 , or use the corresponding keyboard shortcut
475 \begin_layout Enumerate
476 Move the mouse cursor out of the editing box and wait for a split second
477 to see an arrow appear:
478 \begin_inset Formula $\xymatrix{A\ar[r] & B}
487 \begin_layout Section
491 \begin_layout Standard
492 The following diagram, which is taken from the documentation of
496 \begin_layout Plain Layout
506 \begin_inset CommandInset citation
512 by its creator Kristoffer H.
513 Rose, will provide an example for many of the features available with that
518 \begin_layout LyX-Code
522 \begin_inset Newline newline
534 \begin_inset Newline newline
544 \begin_inset Newline newline
560 \begin_inset Newline newline
568 \begin_layout LyX-Code
572 \begin_layout Standard
573 Again, to turn this code into a graphical output, select it all at once
580 \SpecialChar \ldots{}
581 up to the closing brace \SpecialChar \ldots{}
586 and turn it into display-math as explained above.
587 A moment after the cursor leaves the math-area, you should see the diagram
588 in its full graphical glory as shown below.
592 \begin_layout Standard
593 \begin_inset Formula $\xymatrix{U\ar@/_{1pc}/[ddr]_{\psi}\ar@/{}^{1pc}/[drr]^{\varphi}\ar@{.>}[dr]|-{(x,y)}\\
594 & X\times_{Z}Y\ar[d]^{q}\ar[r]_{p} & X\ar[d]_{f}\\
602 \begin_layout Subsection
603 The matrix layout of diagrams
606 \begin_layout Standard
611 uses a matrix to define the layout of the vertices of a diagram.
612 For the above example, we need a
613 \begin_inset Formula $3\times3$
616 -matrix of which 5 entries are used for the vertices
617 \begin_inset Formula $U$
621 \begin_inset Formula $X\times_{Z}Y$
625 \begin_inset Formula $X$
629 \begin_inset Formula $Y$
633 \begin_inset Formula $Z$
636 , the other positions remaining empty.
637 In this case, the following matrix determines the layout:
640 \begin_layout LyX-Code
644 \begin_inset Newline newline
652 \begin_inset Newline newline
662 \begin_inset Newline newline
668 \begin_layout Standard
669 The pattern should be familiar from LaTeX: We see three rows, the first
670 two being terminated by the end-of-line-marker
679 Each line consists of entries, separated by the ampersand
687 \begin_layout Subsection
691 \begin_layout Standard
692 Having entered the vertices, we add arrows between them.
697 -command to produce an arrow is
703 , it is entered into the cell of the matrix where the arrow is to start.
704 The target of the arrow is defined by direction commands
721 These can be combined to a path and enclosed in square brackets.
722 As an example, the arrows from the vertex
723 \begin_inset Formula $U$
726 in the upper left corner down and right to the vertices
727 \begin_inset Formula $X\times_{Z}Y$
731 \begin_inset Formula $Y$
735 \begin_inset Formula $X$
738 are, respectively, defined as
757 Thus the above diagram with all arrows added becomes:
760 \begin_layout LyX-Code
764 \begin_inset Newline newline
778 \begin_inset Newline newline
794 \begin_inset Newline newline
802 \begin_layout Standard
803 \begin_inset Formula \xymatrix{ U \ar[ddr] \ar[drr] \ar[dr]\\
804 & X \times_{Z} Y \ar[d] \ar[r] & X \ar[d]\\
813 \begin_layout LyX-Code
817 \begin_layout LyX-Code
821 \begin_layout Subsection
825 \begin_layout Standard
826 Labels are attached to arrows by affixing them as upper or lower indices
842 defines an arrow going one cell down, two to the right and having the label
844 \begin_inset Formula $\varphi$
848 To attach a label below the arrow, make it a lower index as in
857 This explanation is correct only for arrows pointing to the right.
858 More precisely, imagine looking along the arrow in the direction it is
860 Then an upper index places a label to the left and a lower index places
862 Consequently, an arrow pointing from right to left, such as
873 \begin_inset Formula $\alpha$
877 \begin_inset Formula $\beta$
880 above the arrow, i.e.
881 \begin_inset space \space{}
885 \begin_inset Formula $\xymatrix{\ & \ \ar[l]_{\beta}^{\alpha}.}
889 Using the character | instead of ^ or _ , it is even possible to place the
890 label right onto the arrow, obscuring part of its shaft.
894 \begin_layout Standard
895 Normally, a label is placed halfway between an arrow's start and target
897 In the first diagram, the central arrow starting in
898 \begin_inset Formula $U$
902 \begin_inset Formula $(x,y)$
905 in the middle of the arrow's shaft, rather than in the middle between the
906 two objects it connects.
907 This is achieved by prefixing the label with a minus sign, here:
916 \begin_layout LyX-Code
920 \begin_inset Newline newline
938 \begin_inset Newline newline
954 \begin_inset Newline newline
962 \begin_layout LyX-Code
963 \begin_inset Formula \xymatrix{ U \ar[ddr]_{\psi}\ar[drr]^{\varphi}\ar[dr]|-{(x,y)}\\
964 & X \times_{Z} Y \ar[d]^{q} \ar[r]_{p} & X \ar[d]_{f}\\
973 \begin_layout Standard
977 \begin_layout Plain Layout
986 -pic normally permits labels to be shifted towards the tip or towards the
987 start of an arrow by prefixing the label with a ratio, such as e.g.
993 In LyX this works only for labels which are placed on top of the arrow,
1006 \begin_layout Standard
1007 For labels placed to the left or to the right of the arrow this does not
1013 \begin_layout Plain Layout
1022 -pic code such as e.g.
1039 is not correctly interpreted by LyX's math editor.
1040 Two workarounds are suggested in the last section of this note.
1043 \begin_layout Subsection
1047 \begin_layout Standard
1048 Modification of the design, the form or the positioning of arrows are introduced
1054 This is followed by a pair of matching brackets, where the form of the
1067 indicates, whether we want to modify the design, the or the curvature of
1069 Various modifactions can be applied to an arrow at the same time.
1072 \begin_layout Subsubsection
1076 \begin_layout Standard
1077 Various designs such as
1093 are possible for the shaft of an arrow.
1094 These can be combined with various ends and various tips.
1095 In general, the design of an arrow is described by following the command
1106 -sign and a pair of braces {\SpecialChar \ldots{}
1107 } containing characters describing the end,
1108 the shaft and the tip of the arrow.
1109 These characters are chosen to give some form of ASCII-rendering of the
1117 produces an arrow with split end, a dotted shaft and double head.
1118 A number of other arrow designs is given in the table below.
1119 Note that the ends of embedding arrows
1120 \begin_inset Formula $\xymatrix{A\ar@{^{(}->}[r] & B}
1124 are described by raising or lowering opening parentheses, such as in
1129 \begin_inset Newline newline
1135 \begin_layout Standard
1136 \begin_inset Tabular
1137 <lyxtabular version="3" rows="11" columns="2">
1138 <features islongtable="true">
1139 <column alignment="center" valignment="top" width="0">
1140 <column alignment="center" valignment="top" width="0">
1142 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1145 \begin_layout Plain Layout
1151 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1154 \begin_layout Plain Layout
1162 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1165 \begin_layout Plain Layout
1166 \begin_inset Formula \xymatrix{\ \ar[r] & \ }
1176 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1179 \begin_layout Plain Layout
1191 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1194 \begin_layout Plain Layout
1195 \begin_inset Formula \xymatrix{\ \ar@{-->}[r] & \ }
1205 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1208 \begin_layout Plain Layout
1220 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1223 \begin_layout Plain Layout
1224 \begin_inset Formula \xymatrix{\ \ar@{..>}[r] & \ }
1234 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1237 \begin_layout Plain Layout
1249 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1252 \begin_layout Plain Layout
1253 \begin_inset Formula \xymatrix{\ \ar@{~>}[r] & \ }
1263 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1266 \begin_layout Plain Layout
1278 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1281 \begin_layout Plain Layout
1282 \begin_inset Formula \xymatrix{\ \ar@{->>}[r] & \ }
1292 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1295 \begin_layout Plain Layout
1307 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1310 \begin_layout Plain Layout
1311 \begin_inset Formula \xymatrix{\ \ar@{-->>}[r] & \ }
1321 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1324 \begin_layout Plain Layout
1336 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1339 \begin_layout Plain Layout
1340 \begin_inset Formula \xymatrix{\ \ar@{>->>}[r] & \ }
1350 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1353 \begin_layout Plain Layout
1365 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1368 \begin_layout Plain Layout
1369 \begin_inset Formula \xymatrix{\ \ar@{_{(}->}[r] & \ }
1379 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1382 \begin_layout Plain Layout
1394 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1397 \begin_layout Plain Layout
1398 \begin_inset Formula \xymatrix{\ \ar@{^{(}->}[r] & \ }
1408 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1411 \begin_layout Plain Layout
1423 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1426 \begin_layout Plain Layout
1427 \begin_inset Formula \xymatrix{\ \ar@{|-|}[r] & \ }
1437 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1440 \begin_layout Plain Layout
1458 \begin_layout Standard
1460 Following the @-character by either a 2, 3, _,or a ^, we can produce arrows
1461 with double, triple shaft or arrows showing only the lower or upper half
1462 of their tips and ends.
1463 Arrows need not have tips nor ends, as the last example shows :
1464 \begin_inset Newline newline
1470 \begin_layout Standard
1471 \begin_inset Tabular
1472 <lyxtabular version="3" rows="8" columns="2">
1473 <features islongtable="true">
1474 <column alignment="center" valignment="top" width="0">
1475 <column alignment="center" valignment="top" width="0">
1477 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1480 \begin_layout Plain Layout
1486 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1489 \begin_layout Plain Layout
1497 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1500 \begin_layout Plain Layout
1501 \begin_inset Formula \xymatrix{\ \ar@2[r] & \ }
1511 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1514 \begin_layout Plain Layout
1526 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1529 \begin_layout Plain Layout
1530 \begin_inset Formula \xymatrix{\ \ar@3[r] & \ }
1540 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1543 \begin_layout Plain Layout
1555 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1558 \begin_layout Plain Layout
1559 \begin_inset Formula \xymatrix{\ \ar@_{->}[r] & \ }
1569 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1572 \begin_layout Plain Layout
1584 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1587 \begin_layout Plain Layout
1588 \begin_inset Formula \xymatrix{\ \ar@^{->}[r] & \ }
1598 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1601 \begin_layout Plain Layout
1613 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1616 \begin_layout Plain Layout
1617 \begin_inset Formula \xymatrix{\ \ar@^{>>->>}[r] & \ }
1627 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1630 \begin_layout Plain Layout
1642 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1645 \begin_layout Plain Layout
1646 \begin_inset Formula \xymatrix{\ \ar@{^{<}-_{>}}[r] & \ }
1656 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1659 \begin_layout Plain Layout
1671 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1674 \begin_layout Plain Layout
1675 \begin_inset Formula \xymatrix{\ \ar@2{--}[r] & \ }
1685 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1688 \begin_layout Plain Layout
1706 \begin_layout Subsubsection
1707 Designing your own arrows
1710 \begin_layout Standard
1711 Within certain limits there is even a way to design your own arrows.
1712 Using some the characters
1716 one can even design one's own arrow tips using the
1722 command in the preample.
1723 For explanations, we refer to the
1729 \begin_layout Plain Layout
1740 -manual, from which we take the example:
1743 \begin_layout Standard
1748 newdir{|>}{!/4.5pt/@{|}*:(1,-.2)@^{>}*:(1,+.2)@_{>}}
1753 \begin_layout Standard
1755 This defines a new arrow tip, referred to as
1765 and which displays correctly in LyX as:
1766 \begin_inset Formula \[
1767 \xymatrix{A\ar@{-|>}[r] & \ \ B}
1775 \begin_layout Subsection
1779 \begin_layout Standard
1780 Arrows are shifted sideways with the modifier
1785 \begin_inset Formula $\ldots$
1792 where the ellipsis is replaced by a positive or negative measure.
1793 For instance, to design a pair of mutually opposing arrows between two
1794 nodes, we shift them to see them apart.
1795 Note that the direction of the shift (positive) is to the left if one looks
1800 \begin_layout Standard
1816 \begin_layout Standard
1819 \begin_inset space ~
1823 \begin_inset space ~
1827 \begin_inset Formula \[
1828 \xymatrix{\circ\ar@<1ex>[r] & \circ\ar@<1ex>[l]}
1837 \begin_layout Subsubsection
1838 Inline or centered diagrams
1841 \begin_layout Standard
1842 Arrows and diagrams can be used inline, such as this one:
1843 \begin_inset Formula $\xymatrix{\circ\ar@<1ex>[r] & \circ\ar@<1ex>[l]}
1848 When their code is written inside LyX as above, select it and choose either
1853 for inline appearence or
1858 Diagrams constructed inline can later be centered, or, conversely, centered
1859 diagrams can be changed to inline formulas with
1861 Edit\SpecialChar \menuseparator
1866 \SpecialChar \menuseparator
1870 \begin_layout Subsection
1874 \begin_layout Standard
1875 There are two simple methods to make arrows bend.
1876 The first is giving an explicit value by which the midpoint of the arrow's
1877 shaft is raised or depressed, the other is by forcing the arrow to leave
1878 its origin in a prescribed compass direction and to make him enter the
1879 target at another direction.
1880 The necessary bending of the arrow is determined automatically.
1881 We describe both methods.
1884 \begin_layout Subsubsection
1888 \begin_layout Standard
1889 For bending arrows we use the modifier @/
1890 \begin_inset Formula $\ldots$
1894 The ellipsis stands for a TeX-measure which needs to be entered as a lower
1900 , we could simply write, e.g.
1907 for an arrow bending
1911 downwards, this cannot directly be done in LyX.
1912 It is necessary, to enclose the measure in a pair of braces, such as e.g.
1920 As an example, here are two opposing arrows between
1921 \begin_inset Formula $A$
1925 \begin_inset Formula $B$
1928 , each bending by .5 pica, given by the following source code:
1931 \begin_layout Standard
1943 \begin_layout Standard
1944 \begin_inset Formula \[
1945 \xymatrix{A\ar@/{}_{.5pc}/[r] & B\ar@/{}_{.5pc}/[l]}
1953 \begin_layout Subsubsection
1954 Specifying exit- and entrance directions.
1958 \begin_layout Standard
1959 An alternative for making arrows bend is by specifying their compass direction
1960 as they are leaving their source and their direction from which they enter
1962 Instead of north, north-east, east, etc., the directions are named
1994 , standing for up, up-right, right, down-right, etc..
1995 A direction is specified as @(
2007 stands for the direction the first object is left and
2011 stands for the direction from which the target is entered.
2012 As an example, we show some bending arrows and a loop, which arises when
2013 we do not specify a target for an arrow, just its incoming and outgoing
2017 \begin_layout Standard
2018 \begin_inset Formula \[
2019 \xymatrix{A\ar@(dr,dl)[r]\ar@(dr,dl)[rr] & B\ar@(d,r)[dl] & C\\
2028 \begin_layout LyX-Code
2036 \begin_inset Newline newline
2046 \begin_inset Newline newline
2054 \begin_layout Subsection
2058 \begin_layout Standard
2059 The above example is reminiscent of an automata diagram, except that in
2060 such a diagram states would be enclosed in small circles, with double circles
2061 denoting final states.
2065 \begin_layout Subsubsection
2069 \begin_layout Standard
2074 \begin_layout Plain Layout
2083 -Pic, entries can obtain a single or a double frame, such as
2084 \begin_inset Formula $\xymatrix{*+[F]{A}}
2089 \begin_inset Formula $\xymatrix{*+[F=]{B}}
2093 by prefixing an entry with
2101 and enclosing the portion of the entry to be framed in braces.
2102 Normally, the frame will be very tight so that it must be widened by prefixing
2112 Round frames, such as
2113 \begin_inset Formula $\xymatrix{*++[o][F]{A}}
2118 \begin_inset Formula $\xymatrix{*++[o][F=]{B}}
2122 are obtained by specifying the shape as
2127 So the latter figure was constructed as *++[o][F=]{B}.
2128 This way, the following automaton
2131 \begin_layout Standard
2132 \begin_inset Formula \[
2133 \xymatrix{\txt{start}\ar[r] & *++[o][F]{1}\ar[r] & *++[o][F=]{2}\ar@(ur,dr)\ar@(ur,ul)[l]}
2141 \begin_layout Standard
2145 \begin_layout Plain Layout
2157 \begin_layout LyX-Code
2167 \begin_layout LyX-Code
2173 \begin_layout LyX-Code
2181 \begin_layout LyX-Code
2185 \begin_layout Standard
2192 \SpecialChar \ldots{}
2197 will make a certain entry style the default, that can, of course be overridden
2198 for individual entries.
2203 entrymodifiers={++[o][F-]}
2205 , all following entries inside
2209 \begin_layout Plain Layout
2218 -matrices would be encircled.
2221 \begin_layout Subsubsection
2225 \begin_layout Standard
2226 Framing a whole rectangle inside an xymatrix is done with the macro pair
2246 The dimension of the rectangle is given as a dotted pair
2247 \begin_inset Formula $P_{0}.P_{1}$
2250 of points denoting the top left and lower right corners of the rectangle.
2251 Each point, in turn,is given as a doubly quoted comma separated pair
2252 \begin_inset Quotes eld
2256 \begin_inset Formula $x,y$
2260 \begin_inset Quotes erd
2264 \begin_inset Formula $x$
2268 \begin_inset Formula $y$
2272 These are followed by the framing commands, to produce figures such as
2274 \begin_inset Formula \[
2275 \xymatrix{A & B\ar@(d,r)[dl]\sp(0.2)\phi\sp(0.7)\psi\save"1,1"."2,1"*+[F=]\frm{}\restore\,\\
2276 C & \save"1,1"."1,2"*++[F]\frm{}\restore}
2292 save"1,1"."2,1"*+[F=]
2305 produces the doubly framed rectangle, and the code for the extra wide horizonta
2317 save"1,1"."1,2"*++[F]
2331 This code can be placed in arbitrary cells of the xymatrix.
2335 \begin_layout Section
2336 Using LyX's math editor
2339 \begin_layout Standard
2340 As an alternative to writing the
2344 code, then transforming it into a math-editing environment by marking it
2353 , one may construct and modify the whole xypic-diagram inside LyX's math
2355 We describe the editing steps for a figure just like the one above.
2359 \begin_layout Subsection
2360 Caveat - how to enter braces
2363 \begin_layout Standard
2364 Recall that in LyX's math-editor any pair of braces
2372 that are to enclose a macro-parameter must be entered by typing just
2379 The closing brace is automatically supplied and in between a box into which
2380 to the parameter is entered.
2385 \begin_layout Plain Layout
2394 -diagrams, this applies in particular to arrow modifications that are normally
2399 \SpecialChar \ldots{}
2404 with the ellipsis standing for the description of end, shaft and tip of
2406 Inside the math-editor, enter just
2412 and let LyX provide the closing brace and the box into which to enter the
2413 description of the arrow.
2416 \begin_layout Standard
2417 Braces that are entered without the backslash
2423 will just appear as typed, but cannot be used to receive a macro parameter.
2424 They are useful, for instance to denote sets, e.g.
2436 \begin_inset Formula $\{x\in X\mid x\notin x\}$
2442 \begin_layout Subsection
2443 Setting up the matrix
2446 \begin_layout Standard
2455 open a formula environment and enter:
2463 \begin_inset Formula $\times$
2470 \begin_layout Plain Layout
2480 Add extra rows by typing
2484 and add columns by typing
2490 \begin_layout Standard
2491 At any time, further rows or columns can be entered or deleted using commands
2494 Edit\SpecialChar \menuseparator
2498 their shortcuts, beginning with
2502 for the column commands or
2506 for the row commands.
2510 \begin_layout Subsection
2511 Entering nodes, arrows and labels
2514 \begin_layout Standard
2515 Type the nodes into the correct positions of the matrix.
2516 If you move the cursor out of the matrix, you should see a first rendering
2518 Next, add the arrows at the nodes from where they should emanate by typing
2535 can be any path made up from the characters
2552 Make sure that the path indeed leads to an existing node within the matrix.
2553 Otherwise, the figure will not display when the cursor leaves the editing
2557 \begin_layout Standard
2558 Next, label the arrows by attaching a label text as upper or lower indices
2559 to the end of the arrow's path.
2560 As always in LyX's math editor, an underscore
2564 opens a box for a lower index and a
2568 followed by a space opens a box for an upper index.
2569 You can enter any LaTeX-code as a label.
2573 \begin_layout Subsection
2577 \begin_layout Standard
2578 Finally, modify the appearance of the arrows by entering @-modifiers @{\SpecialChar \ldots{}
2580 @<\SpecialChar \ldots{}
2581 >, @(\SpecialChar \ldots{}
2582 ,\SpecialChar \ldots{}
2583 ) or @/\SpecialChar \ldots{}
2585 The above caveat applies to the first form only.
2586 It must be entered as
2592 with the arrow description entered inside the LyX-supplied box.
2593 If this box remains empty, you have specified an empty arrow.
2594 This is a useful construction, too, as you will see in the next section.
2598 \begin_layout Standard
2599 The other modifiers, @<\SpecialChar \ldots{}
2600 >, @(\SpecialChar \ldots{}
2601 ,\SpecialChar \ldots{}
2602 ) and @/\SpecialChar \ldots{}
2603 / are typed as shown with the arrow
2604 description replacing the ellipsis.
2605 The code for bending arrows, which in
2621 is any valid TeX-measure, should be entered as upper or lower index to
2623 Make sure that the ending slash does not end up being part of the upper
2627 \begin_layout Subsection
2628 What if something goes wrong
2631 \begin_layout Standard
2632 When constructing a diagram, you should at times check it by just moving
2633 the cursor out of the editing area to see whether instant preview can successfu
2634 lly convert it into graphical output.
2635 If this does not happen, it may either be that instant preview for some
2636 reason is not aware that it should retranslate the graphics.
2637 Moving the cursor into the editing area and out again sometimes wakes up
2641 \begin_layout Standard
2642 A more serious reason could be a syntactical error in your input.
2643 If necessary, redo the last editing steps, using Ctrl-z, or try to translate
2644 the LyX-file into dvi using Ctrl-d or
2646 View\SpecialChar \menuseparator
2650 There should be some error generated, which hopefully gives you a hint
2651 as to the source of the mistake.
2654 \begin_layout Section
2658 \begin_layout Standard
2659 Certain things do not work correctly inside LyX.
2660 The ones that we (used to) miss most are the horizontal and vertical scaling
2661 of diagrams, and the correct positioning of arrows.
2662 There are some workarounds that we are explaining here.
2666 \begin_layout Subsection
2667 Horizontal and vertical scaling
2670 \begin_layout Standard
2671 It is often convenient to stretch the horizontal or the vertical dimensions
2672 of an entire diagram by using spacing commands for rows and/or columns.
2677 \begin_layout Plain Layout
2686 -manual, for instance,
2692 \SpecialChar \ldots{}
2701 \begin_layout Plain Layout
2710 -matrix with row spacing of 1 pica.
2717 \SpecialChar \ldots{}
2722 \SpecialChar \ldots{}
2727 allows to modify the space between columns.
2728 Unfortunately, these commands do currently not work inside LyX, as the
2729 @-character is interpreted by LyX as ending the
2733 \begin_layout Plain Layout
2746 \begin_layout Standard
2751 \begin_layout Plain Layout
2761 \begin_inset space ~
2764 stores the values for row-spacing and column-spacing in the variables
2776 , add the following macro to the preamble (
2778 Layout\SpecialChar \menuseparator
2779 Document\SpecialChar \menuseparator
2783 \begin_layout LyX-Code
2789 \begin_layout LyX-Code
2797 \begin_layout LyX-Code
2803 \begin_layout LyX-Code
2811 \begin_layout LyX-Code
2817 \begin_layout LyX-Code
2823 \begin_layout LyX-Code
2827 \begin_layout Standard
2834 can be defined correspondingly by replacing
2847 Now, a figure can be scaled by entering
2853 \begin_layout Plain Layout
2863 Place the cursor inside the matrix, just before the first entry.
2881 Dont't forget the backslashes and remember, that the closing brace is automatic
2882 ally supplied by LyX.
2883 Inside the braces enter the dimensions.
2889 Here you see a diagram which is squashed vertically and stretched horizontally
2901 \begin_layout Standard
2902 \begin_inset Formula \[
2903 \xyC{.5pc}\xyC{9pc}\xymatrix{A\ar[r]\ar[d] & B\\
2904 C\ar@{}[ur]|{\text{{horizontal stretch}}}}
2912 \begin_layout Subsection
2916 \begin_layout Standard
2921 \begin_layout Plain Layout
2930 -vcommand allows the correct positioning of labels along the shaft of arrows.
2931 This feature is sometimes necessary, when the default position of a label
2932 would otherwise clutter the picture, or would even coincide with other
2933 items, such as the intersection of the arrows in the figure below.
2934 In order to shift a label position alongside the shaft of an arrow,
2938 \begin_layout Plain Layout
2948 \begin_inset space ~
2951 allows to prefix the label by a decimal number in parentheses, specifying
2952 the fraction of distance alongside the arrow where the label is to be placed.
2953 For instance, the code
2961 , will place the label on the shaft, but only about one third of the way.
2965 \begin_layout Standard
2966 Doing the same with labels above or below arrows as
2982 , does not work from inside LyX.
2983 Instead, one has to replace the hat-symbol ^, resp.
2984 the underscore _ , by the macros
3018 It is, in fact, possible to enter several labels this way and those labels
3019 are placed correctly, even if the arrow bends.
3020 In the following figure, the bending arrow with its four labels has been
3044 \begin_layout Standard
3045 \begin_inset Formula \[
3046 \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}}\\
3047 \circ\ar[ur]\sb(0.3)\phi & \bullet}
3055 \begin_layout Subsection
3056 Invisible stretched arrows
3059 \begin_layout Standard
3060 A more general trick uses invisible arrows to place any object almost anywhere
3062 Produce an invisible arrow, shorten (or prolong) it past its goal by adding
3063 a decimal stretching ratio, e.g.
3073 Attach a label to this invisible arrow.
3077 \begin_layout Standard
3078 Thus, the down pointing arrow with its label
3079 \begin_inset Formula $\varphi$
3082 at (0.3) of its way along the shaft might as well have been produced by
3083 adding to the regular arrow
3090 \begin_inset Formula $\varphi$
3101 , reaching only 0.6 of the way.
3102 Its label will now appear at 0.3 of the way of the original visible arrow.
3106 \begin_layout Standard
3107 This workaround has two minor drawbacks: First, it does not work with bending
3109 Secondly, prolonging an invisible arrow beyond the normal dimension of
3110 the figure will invisibly extend the figure box, and thereby cause too
3111 much vertical space between the figure and the preceding or the following
3116 \begin_layout Standard
3117 Nevertheless, invisible arrows are an important tool, since they can, in
3118 principle, be used to place information at any chosen place in a diagram.
3119 In the above figure, for instance, we have used an invisible arrow to carry
3126 as label and at the earlier figure we had used an invisible arrow to carry
3128 \begin_inset Quotes eld
3136 \begin_inset Quotes erd
3139 into the center of the figure.
3142 \begin_layout Bibliography
3143 \begin_inset CommandInset bibitem
3144 LatexCommand bibitem
3155 \begin_layout Plain Layout
3171 Available as part of the
3179 \begin_layout Bibliography
3180 \begin_inset CommandInset bibitem
3181 LatexCommand bibitem
3183 key "instant-preview"
3188 \begin_inset Flex URL
3191 \begin_layout Plain Layout
3193 http://www.tug.org/tex-archive/help/Catalogue/entries/preview-latex.html
3201 \begin_layout Bibliography
3202 \begin_inset CommandInset bibitem
3203 LatexCommand bibitem
3210 \begin_inset Flex URL
3213 \begin_layout Plain Layout
3215 http://www.tug.org/tex-archive/help/Catalogue/entries/xypic.html
3223 \begin_layout Bibliography
3224 \begin_inset CommandInset bibitem
3225 LatexCommand bibitem
3232 \begin_inset Flex URL
3235 \begin_layout Plain Layout
3237 http://www.gnu.org/software/auctex/