1 #LyX 1.6.0 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
37 \paperfontsize default
46 \paperorientation portrait
49 \paragraph_separation indent
51 \quotes_language english
54 \paperpagestyle default
55 \tracking_changes false
68 \begin_layout Plain Layout
85 \begin_layout Abstract
86 With the recent versions of LyX and with the
90 -style installed in the LaTeX-System, the graph drawing package
96 \begin_layout Plain Layout
107 -Pic can be conveniently used inside LyX.
108 Diagrams can be edited and displayed inside the main LyX editing window.
109 Here, we shall describe how to use the
119 inside LyX in order to draw, to edit and to preview diagrams as typically
120 used in category theory, algebra, and related fields.
124 \begin_layout Abstract
125 \begin_inset CommandInset toc
126 LatexCommand tableofcontents
133 \begin_layout Section
137 \begin_layout Standard
142 -package has long served as a convenient tool for easily constructing graphs
143 and diagrams in LaTeX.
144 Unfortunately, its use in LyX had long been restricted to the infamous
145 ERT-boxes, meaning that the LyX editor could only display the LaTeX-source
146 and not the finished diagram.
151 -style of LaTeX which is part of the AUCTeX project
152 \begin_inset CommandInset citation
158 , finally enables the editing and displaying of
162 -diagrams, constructed, displayed and interactively edited inside LyX.
165 \begin_layout Standard
166 \begin_inset VSpace defskip
172 \begin_layout Standard
173 \begin_inset Graphics
174 filename xyfigure.png
176 BoundingBox 0bp 0bp 580bp 440bp
184 \begin_layout Standard
185 \begin_inset VSpace defskip
191 \begin_layout Standard
192 In this note, we describe how
196 \begin_layout Plain Layout
205 -pic can be used from inside LyX, how diagrams can be created and edited.
206 We have tested the following using LyX versions 1.3.7 up to 1.6, running under
207 WindowsXP and under Windows Vista.
211 \begin_layout Standard
212 There are two modes of operations: For a start, and for some first tests,
213 it may be easiest to first enter the
217 \begin_layout Plain Layout
226 -Pic code inside the LyX-window, select it all and convert it to a graphical
227 representation by pressing
240 \begin_layout Plain Layout
249 -Pic more frequently, or if you want to modify your initial figure, you
250 will want to assemble and modify your figures using LyX's math editor.
254 \begin_layout Standard
255 Once the cursor is moved over a diagram, this is displayed as an array of
256 nodes and arrow-commands.
257 These can be changed interactively.
258 When the cursor leaves the editing area, the diagram reappears.
262 \begin_layout Standard
263 In the first two sections of this documentation, we explain how to use LyX
264 in the first mentioned mode and we introduce all
268 \begin_layout Plain Layout
277 -Pic features that might be of use for drawing commutative diagrams, graphs
279 Section 3 explains how to use the
283 \begin_layout Plain Layout
292 -Pic commands inside a math-editing area.
296 \begin_layout Standard
297 It is not our intention to write another introduction to
301 \begin_layout Plain Layout
310 -Pic, rather our motivation is to give an introduction how the most important
311 commands work inside LyX, since the keystrokes as explained in the
315 \begin_layout Plain Layout
325 \begin_inset CommandInset citation
331 will not always function correctly inside LyX.
335 \begin_layout Section
339 \begin_layout Standard
340 The following requires that the LaTeX-packages
348 are installed in the LaTeX system.
349 They are available from CTAN, see at
350 \begin_inset CommandInset citation
352 key "instant-preview"
358 \begin_inset CommandInset citation
365 After freshly installing them, it may be necessary, to run
367 Edit\SpecialChar \menuseparator
370 from the main LyX menu.
371 The steps to a first diagram output in LyX are then:
374 \begin_layout Enumerate
381 \begin_layout Enumerate
384 Edit\SpecialChar \menuseparator
385 Preferences\SpecialChar \menuseparator
386 Look and Feel\SpecialChar \menuseparator
389 and place a check-mark at
397 \begin_layout Enumerate
402 works by opening a LyX-document and entering any math-formula, e.
403 \begin_inset space \thinspace{}
408 \begin_inset Formula $a+b=c$
415 \begin_layout Enumerate
416 Move the cursor out of the formula, and watch it change its appearance to
417 look just like in the finished dvi- or postscript document.
422 \begin_layout Enumerate
429 \begin_layout Enumerate
432 Layout\SpecialChar \menuseparator
433 Document\SpecialChar \menuseparator
439 \begin_inset Newline newline
447 \begin_layout Enumerate
448 Inside your LyX-Document, enter the text
451 \begin_inset Newline newline
463 \begin_layout Enumerate
464 Select the whole text and choose
466 Insert\SpecialChar \menuseparator
467 Math\SpecialChar \menuseparator
470 , or use the corresponding keyboard shortcut
478 \begin_layout Enumerate
479 Move the mouse cursor out of the editing box and wait for a split second
480 to see an arrow appear:
481 \begin_inset Formula $\xymatrix{A\ar[r] & B}
490 \begin_layout Section
494 \begin_layout Standard
495 The following diagram, which is taken from the documentation of
499 \begin_layout Plain Layout
509 \begin_inset CommandInset citation
515 by its creator Kristoffer H.
516 Rose, will provide an example for many of the features available with that
521 \begin_layout LyX-Code
525 \begin_inset Newline newline
537 \begin_inset Newline newline
547 \begin_inset Newline newline
563 \begin_inset Newline newline
571 \begin_layout LyX-Code
575 \begin_layout Standard
576 Again, to turn this code into a graphical output, select it all at once
583 \SpecialChar \ldots{}
584 up to the closing brace \SpecialChar \ldots{}
589 and turn it into display-math as explained above.
590 A moment after the cursor leaves the math-area, you should see the diagram
591 in its full graphical glory as shown below.
595 \begin_layout Standard
596 \begin_inset Formula $\xymatrix{U\ar@/_{1pc}/[ddr]_{\psi}\ar@/{}^{1pc}/[drr]^{\varphi}\ar@{.>}[dr]|-{(x,y)}\\
597 & X\times_{Z}Y\ar[d]^{q}\ar[r]_{p} & X\ar[d]_{f}\\
605 \begin_layout Subsection
606 The matrix layout of diagrams
609 \begin_layout Standard
614 uses a matrix to define the layout of the vertices of a diagram.
615 For the above example, we need a
616 \begin_inset Formula $3\times3$
619 -matrix of which 5 entries are used for the vertices
620 \begin_inset Formula $U$
624 \begin_inset Formula $X\times_{Z}Y$
628 \begin_inset Formula $X$
632 \begin_inset Formula $Y$
636 \begin_inset Formula $Z$
639 , the other positions remaining empty.
640 In this case, the following matrix determines the layout:
643 \begin_layout LyX-Code
647 \begin_inset Newline newline
655 \begin_inset Newline newline
665 \begin_inset Newline newline
671 \begin_layout Standard
672 The pattern should be familiar from LaTeX: We see three rows, the first
673 two being terminated by the end-of-line-marker
682 Each line consists of entries, separated by the ampersand
690 \begin_layout Subsection
694 \begin_layout Standard
695 Having entered the vertices, we add arrows between them.
700 -command to produce an arrow is
706 , it is entered into the cell of the matrix where the arrow is to start.
707 The target of the arrow is defined by direction commands
724 These can be combined to a path and enclosed in square brackets.
725 As an example, the arrows from the vertex
726 \begin_inset Formula $U$
729 in the upper left corner down and right to the vertices
730 \begin_inset Formula $X\times_{Z}Y$
734 \begin_inset Formula $Y$
738 \begin_inset Formula $X$
741 are, respectively, defined as
760 Thus the above diagram with all arrows added becomes:
763 \begin_layout LyX-Code
767 \begin_inset Newline newline
781 \begin_inset Newline newline
797 \begin_inset Newline newline
805 \begin_layout Standard
806 \begin_inset Formula \xymatrix{ U \ar[ddr] \ar[drr] \ar[dr]\\
807 & X \times_{Z} Y \ar[d] \ar[r] & X \ar[d]\\
816 \begin_layout LyX-Code
820 \begin_layout LyX-Code
824 \begin_layout Subsection
828 \begin_layout Standard
829 Labels are attached to arrows by affixing them as upper or lower indices
845 defines an arrow going one cell down, two to the right and having the label
847 \begin_inset Formula $\varphi$
851 To attach a label below the arrow, make it a lower index as in
860 This explanation is correct only for arrows pointing to the right.
861 More precisely, imagine looking along the arrow in the direction it is
863 Then an upper index places a label to the left and a lower index places
865 Consequently, an arrow pointing from right to left, such as
876 \begin_inset Formula $\alpha$
880 \begin_inset Formula $\beta$
884 \begin_inset space \thinspace{}
888 \begin_inset space \space{}
892 \begin_inset Formula $\xymatrix{\ & \ \ar[l]_{\beta}^{\alpha}.}
896 Using the character | instead of ^ or _ , it is even possible to place the
897 label right onto the arrow, obscuring part of its shaft.
901 \begin_layout Standard
902 Normally, a label is placed halfway between an arrow's start and target
904 In the first diagram, the central arrow starting in
905 \begin_inset Formula $U$
909 \begin_inset Formula $(x,y)$
912 in the middle of the arrow's shaft, rather than in the middle between the
913 two objects it connects.
914 This is achieved by prefixing the label with a minus sign, here:
923 \begin_layout LyX-Code
927 \begin_inset Newline newline
945 \begin_inset Newline newline
961 \begin_inset Newline newline
969 \begin_layout LyX-Code
970 \begin_inset Formula \xymatrix{ U \ar[ddr]_{\psi}\ar[drr]^{\varphi}\ar[dr]|-{(x,y)}\\
971 & X \times_{Z} Y \ar[d]^{q} \ar[r]_{p} & X \ar[d]_{f}\\
980 \begin_layout Standard
984 \begin_layout Plain Layout
993 -pic normally permits labels to be shifted towards the tip or towards the
994 start of an arrow by prefixing the label with a ratio, such as e.
995 \begin_inset space \thinspace{}
1004 In LyX this works only for labels which are placed on top of the arrow,
1017 \begin_layout Standard
1018 For labels placed to the left or to the right of the arrow this does not
1024 \begin_layout Plain Layout
1033 -pic code such as e.
1034 \begin_inset space \thinspace{}
1054 is not correctly interpreted by LyX's math editor.
1055 Two workarounds are suggested in the last section of this note.
1058 \begin_layout Subsection
1062 \begin_layout Standard
1063 Modification of the design, the form or the positioning of arrows are introduced
1069 This is followed by a pair of matching brackets, where the form of the
1082 indicates, whether we want to modify the design, the or the curvature of
1084 Various modifactions can be applied to an arrow at the same time.
1087 \begin_layout Subsubsection
1091 \begin_layout Standard
1092 Various designs such as
1108 are possible for the shaft of an arrow.
1109 These can be combined with various ends and various tips.
1110 In general, the design of an arrow is described by following the command
1121 -sign and a pair of braces {\SpecialChar \ldots{}
1122 } containing characters describing the end,
1123 the shaft and the tip of the arrow.
1124 These characters are chosen to give some form of ASCII-rendering of the
1132 produces an arrow with split end, a dotted shaft and double head.
1133 A number of other arrow designs is given in the table below.
1134 Note that the ends of embedding arrows
1135 \begin_inset Formula $\xymatrix{A\ar@{^{(}->}[r] & B}
1139 are described by raising or lowering opening parentheses, such as in
1144 \begin_inset Newline newline
1150 \begin_layout Standard
1151 \begin_inset Tabular
1152 <lyxtabular version="3" rows="11" columns="2">
1153 <features islongtable="true">
1154 <column alignment="center" valignment="top" width="0">
1155 <column alignment="center" valignment="top" width="0">
1157 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1160 \begin_layout Plain Layout
1166 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1169 \begin_layout Plain Layout
1177 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1180 \begin_layout Plain Layout
1181 \begin_inset Formula \xymatrix{\ \ar[r] & \ }
1191 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1194 \begin_layout Plain Layout
1206 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1209 \begin_layout Plain Layout
1210 \begin_inset Formula \xymatrix{\ \ar@{-->}[r] & \ }
1220 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1223 \begin_layout Plain Layout
1235 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1238 \begin_layout Plain Layout
1239 \begin_inset Formula \xymatrix{\ \ar@{..>}[r] & \ }
1249 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1252 \begin_layout Plain Layout
1264 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1267 \begin_layout Plain Layout
1268 \begin_inset Formula \xymatrix{\ \ar@{~>}[r] & \ }
1278 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1281 \begin_layout Plain Layout
1293 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1296 \begin_layout Plain Layout
1297 \begin_inset Formula \xymatrix{\ \ar@{->>}[r] & \ }
1307 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1310 \begin_layout Plain Layout
1322 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1325 \begin_layout Plain Layout
1326 \begin_inset Formula \xymatrix{\ \ar@{-->>}[r] & \ }
1336 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1339 \begin_layout Plain Layout
1351 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1354 \begin_layout Plain Layout
1355 \begin_inset Formula \xymatrix{\ \ar@{>->>}[r] & \ }
1365 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1368 \begin_layout Plain Layout
1380 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1383 \begin_layout Plain Layout
1384 \begin_inset Formula \xymatrix{\ \ar@{_{(}->}[r] & \ }
1394 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1397 \begin_layout Plain Layout
1409 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1412 \begin_layout Plain Layout
1413 \begin_inset Formula \xymatrix{\ \ar@{^{(}->}[r] & \ }
1423 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1426 \begin_layout Plain Layout
1438 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1441 \begin_layout Plain Layout
1442 \begin_inset Formula \xymatrix{\ \ar@{|-|}[r] & \ }
1452 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1455 \begin_layout Plain Layout
1473 \begin_layout Standard
1475 Following the @-character by either a 2, 3, _,or a ^, we can produce arrows
1476 with double, triple shaft or arrows showing only the lower or upper half
1477 of their tips and ends.
1478 Arrows need not have tips nor ends, as the last example shows :
1479 \begin_inset Newline newline
1485 \begin_layout Standard
1486 \begin_inset Tabular
1487 <lyxtabular version="3" rows="8" columns="2">
1488 <features islongtable="true">
1489 <column alignment="center" valignment="top" width="0">
1490 <column alignment="center" valignment="top" width="0">
1492 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1495 \begin_layout Plain Layout
1501 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1504 \begin_layout Plain Layout
1512 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1515 \begin_layout Plain Layout
1516 \begin_inset Formula \xymatrix{\ \ar@2[r] & \ }
1526 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1529 \begin_layout Plain Layout
1541 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1544 \begin_layout Plain Layout
1545 \begin_inset Formula \xymatrix{\ \ar@3[r] & \ }
1555 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1558 \begin_layout Plain Layout
1570 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1573 \begin_layout Plain Layout
1574 \begin_inset Formula \xymatrix{\ \ar@_{->}[r] & \ }
1584 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1587 \begin_layout Plain Layout
1599 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1602 \begin_layout Plain Layout
1603 \begin_inset Formula \xymatrix{\ \ar@^{->}[r] & \ }
1613 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1616 \begin_layout Plain Layout
1628 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1631 \begin_layout Plain Layout
1632 \begin_inset Formula \xymatrix{\ \ar@^{>>->>}[r] & \ }
1642 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1645 \begin_layout Plain Layout
1657 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1660 \begin_layout Plain Layout
1661 \begin_inset Formula \xymatrix{\ \ar@{^{<}-_{>}}[r] & \ }
1671 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1674 \begin_layout Plain Layout
1686 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1689 \begin_layout Plain Layout
1690 \begin_inset Formula \xymatrix{\ \ar@2{--}[r] & \ }
1700 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1703 \begin_layout Plain Layout
1721 \begin_layout Subsubsection
1722 Designing your own arrows
1725 \begin_layout Standard
1726 Within certain limits there is even a way to design your own arrows.
1727 Using some the characters
1731 one can even design one's own arrow tips using the
1737 command in the preample.
1738 For explanations, we refer to the
1744 \begin_layout Plain Layout
1755 -manual, from which we take the example:
1758 \begin_layout Standard
1763 newdir{|>}{!/4.5pt/@{|}*:(1,-.2)@^{>}*:(1,+.2)@_{>}}
1768 \begin_layout Standard
1770 This defines a new arrow tip, referred to as
1780 and which displays correctly in LyX as:
1781 \begin_inset Formula \[
1782 \xymatrix{A\ar@{-|>}[r] & \ \ B}
1790 \begin_layout Subsection
1794 \begin_layout Standard
1795 Arrows are shifted sideways with the modifier
1800 \begin_inset Formula $\ldots$
1807 where the ellipsis is replaced by a positive or negative measure.
1808 For instance, to design a pair of mutually opposing arrows between two
1809 nodes, we shift them to see them apart.
1810 Note that the direction of the shift (positive) is to the left if one looks
1815 \begin_layout Standard
1831 \begin_layout Standard
1834 \begin_inset space ~
1838 \begin_inset space ~
1842 \begin_inset Formula \[
1843 \xymatrix{\circ\ar@<1ex>[r] & \circ\ar@<1ex>[l]}
1852 \begin_layout Subsubsection
1853 Inline or centered diagrams
1856 \begin_layout Standard
1857 Arrows and diagrams can be used inline, such as this one:
1858 \begin_inset Formula $\xymatrix{\circ\ar@<1ex>[r] & \circ\ar@<1ex>[l]}
1863 When their code is written inside LyX as above, select it and choose either
1868 for inline appearence or
1873 Diagrams constructed inline can later be centered, or, conversely, centered
1874 diagrams can be changed to inline formulas with
1876 Edit\SpecialChar \menuseparator
1881 \SpecialChar \menuseparator
1885 \begin_layout Subsection
1889 \begin_layout Standard
1890 There are two simple methods to make arrows bend.
1891 The first is giving an explicit value by which the midpoint of the arrow's
1892 shaft is raised or depressed, the other is by forcing the arrow to leave
1893 its origin in a prescribed compass direction and to make him enter the
1894 target at another direction.
1895 The necessary bending of the arrow is determined automatically.
1896 We describe both methods.
1899 \begin_layout Subsubsection
1903 \begin_layout Standard
1904 For bending arrows we use the modifier @/
1905 \begin_inset Formula $\ldots$
1909 The ellipsis stands for a TeX-measure which needs to be entered as a lower
1915 , we could simply write, e.
1916 \begin_inset space \thinspace{}
1926 for an arrow bending
1930 downwards, this cannot directly be done in LyX.
1931 It is necessary, to enclose the measure in a pair of braces, such as e.
1932 \begin_inset space \thinspace{}
1943 As an example, here are two opposing arrows between
1944 \begin_inset Formula $A$
1948 \begin_inset Formula $B$
1951 , each bending by .5 pica, given by the following source code:
1954 \begin_layout Standard
1966 \begin_layout Standard
1967 \begin_inset Formula \[
1968 \xymatrix{A\ar@/{}_{.5pc}/[r] & B\ar@/{}_{.5pc}/[l]}
1976 \begin_layout Subsubsection
1977 Specifying exit- and entrance directions.
1981 \begin_layout Standard
1982 An alternative for making arrows bend is by specifying their compass direction
1983 as they are leaving their source and their direction from which they enter
1985 Instead of north, north-east, east, etc., the directions are named
2017 , standing for up, up-right, right, down-right, etc..
2018 A direction is specified as @(
2030 stands for the direction the first object is left and
2034 stands for the direction from which the target is entered.
2035 As an example, we show some bending arrows and a loop, which arises when
2036 we do not specify a target for an arrow, just its incoming and outgoing
2040 \begin_layout Standard
2041 \begin_inset Formula \[
2042 \xymatrix{A\ar@(dr,dl)[r]\ar@(dr,dl)[rr] & B\ar@(d,r)[dl] & C\\
2051 \begin_layout LyX-Code
2059 \begin_inset Newline newline
2069 \begin_inset Newline newline
2077 \begin_layout Subsection
2081 \begin_layout Standard
2082 The above example is reminiscent of an automata diagram, except that in
2083 such a diagram states would be enclosed in small circles, with double circles
2084 denoting final states.
2088 \begin_layout Subsubsection
2092 \begin_layout Standard
2097 \begin_layout Plain Layout
2106 -Pic, entries can obtain a single or a double frame, such as
2107 \begin_inset Formula $\xymatrix{*+[F]{A}}
2112 \begin_inset Formula $\xymatrix{*+[F=]{B}}
2116 by prefixing an entry with
2124 and enclosing the portion of the entry to be framed in braces.
2125 Normally, the frame will be very tight so that it must be widened by prefixing
2135 Round frames, such as
2136 \begin_inset Formula $\xymatrix{*++[o][F]{A}}
2141 \begin_inset Formula $\xymatrix{*++[o][F=]{B}}
2145 are obtained by specifying the shape as
2150 So the latter figure was constructed as *++[o][F=]{B}.
2151 This way, the following automaton
2154 \begin_layout Standard
2155 \begin_inset Formula \[
2156 \xymatrix{\txt{start}\ar[r] & *++[o][F]{1}\ar[r] & *++[o][F=]{2}\ar@(ur,dr)\ar@(ur,ul)[l]}
2164 \begin_layout Standard
2168 \begin_layout Plain Layout
2180 \begin_layout LyX-Code
2190 \begin_layout LyX-Code
2196 \begin_layout LyX-Code
2204 \begin_layout LyX-Code
2208 \begin_layout Standard
2215 \SpecialChar \ldots{}
2220 will make a certain entry style the default, that can, of course be overridden
2221 for individual entries.
2226 entrymodifiers={++[o][F-]}
2228 , all following entries inside
2232 \begin_layout Plain Layout
2241 -matrices would be encircled.
2244 \begin_layout Subsubsection
2248 \begin_layout Standard
2249 Framing a whole rectangle inside an xymatrix is done with the macro pair
2269 The dimension of the rectangle is given as a dotted pair
2270 \begin_inset Formula $P_{0}.P_{1}$
2273 of points denoting the top left and lower right corners of the rectangle.
2274 Each point, in turn,is given as a doubly quoted comma separated pair
2275 \begin_inset Quotes eld
2279 \begin_inset Formula $x,y$
2283 \begin_inset Quotes erd
2287 \begin_inset Formula $x$
2291 \begin_inset Formula $y$
2295 These are followed by the framing commands, to produce figures such as
2297 \begin_inset Formula \[
2298 \xymatrix{A & B\ar@(d,r)[dl]\sp(0.2)\phi\sp(0.7)\psi\save"1,1"."2,1"*+[F=]\frm{}\restore\,\\
2299 C & \save"1,1"."1,2"*++[F]\frm{}\restore}
2315 save"1,1"."2,1"*+[F=]
2328 produces the doubly framed rectangle, and the code for the extra wide horizonta
2340 save"1,1"."1,2"*++[F]
2354 This code can be placed in arbitrary cells of the xymatrix.
2358 \begin_layout Section
2359 Using LyX's math editor
2362 \begin_layout Standard
2363 As an alternative to writing the
2367 code, then transforming it into a math-editing environment by marking it
2376 , one may construct and modify the whole xypic-diagram inside LyX's math
2378 We describe the editing steps for a figure just like the one above.
2382 \begin_layout Subsection
2383 Caveat - how to enter braces
2386 \begin_layout Standard
2387 Recall that in LyX's math-editor any pair of braces
2395 that are to enclose a macro-parameter must be entered by typing just
2402 The closing brace is automatically supplied and in between a box into which
2403 to the parameter is entered.
2408 \begin_layout Plain Layout
2417 -diagrams, this applies in particular to arrow modifications that are normally
2422 \SpecialChar \ldots{}
2427 with the ellipsis standing for the description of end, shaft and tip of
2429 Inside the math-editor, enter just
2435 and let LyX provide the closing brace and the box into which to enter the
2436 description of the arrow.
2439 \begin_layout Standard
2440 Braces that are entered without the backslash
2446 will just appear as typed, but cannot be used to receive a macro parameter.
2447 They are useful, for instance to denote sets, e.
2448 \begin_inset space \thinspace{}
2463 \begin_inset Formula $\{x\in X\mid x\notin x\}$
2469 \begin_layout Subsection
2470 Setting up the matrix
2473 \begin_layout Standard
2482 open a formula environment and enter:
2490 \begin_inset Formula $\times$
2497 \begin_layout Plain Layout
2507 Add extra rows by typing
2511 and add columns by typing
2517 \begin_layout Standard
2518 At any time, further rows or columns can be entered or deleted using commands
2521 Edit\SpecialChar \menuseparator
2525 their shortcuts, beginning with
2529 for the column commands or
2533 for the row commands.
2537 \begin_layout Subsection
2538 Entering nodes, arrows and labels
2541 \begin_layout Standard
2542 Type the nodes into the correct positions of the matrix.
2543 If you move the cursor out of the matrix, you should see a first rendering
2545 Next, add the arrows at the nodes from where they should emanate by typing
2562 can be any path made up from the characters
2579 Make sure that the path indeed leads to an existing node within the matrix.
2580 Otherwise, the figure will not display when the cursor leaves the editing
2584 \begin_layout Standard
2585 Next, label the arrows by attaching a label text as upper or lower indices
2586 to the end of the arrow's path.
2587 As always in LyX's math editor, an underscore
2591 opens a box for a lower index and a
2595 followed by a space opens a box for an upper index.
2596 You can enter any LaTeX-code as a label.
2600 \begin_layout Subsection
2604 \begin_layout Standard
2605 Finally, modify the appearance of the arrows by entering @-modifiers @{\SpecialChar \ldots{}
2607 @<\SpecialChar \ldots{}
2608 >, @(\SpecialChar \ldots{}
2609 ,\SpecialChar \ldots{}
2610 ) or @/\SpecialChar \ldots{}
2612 The above caveat applies to the first form only.
2613 It must be entered as
2619 with the arrow description entered inside the LyX-supplied box.
2620 If this box remains empty, you have specified an empty arrow.
2621 This is a useful construction, too, as you will see in the next section.
2625 \begin_layout Standard
2626 The other modifiers, @<\SpecialChar \ldots{}
2627 >, @(\SpecialChar \ldots{}
2628 ,\SpecialChar \ldots{}
2629 ) and @/\SpecialChar \ldots{}
2630 / are typed as shown with the arrow
2631 description replacing the ellipsis.
2632 The code for bending arrows, which in
2648 is any valid TeX-measure, should be entered as upper or lower index to
2650 Make sure that the ending slash does not end up being part of the upper
2654 \begin_layout Subsection
2655 What if something goes wrong
2658 \begin_layout Standard
2659 When constructing a diagram, you should at times check it by just moving
2660 the cursor out of the editing area to see whether instant preview can successfu
2661 lly convert it into graphical output.
2662 If this does not happen, it may either be that instant preview for some
2663 reason is not aware that it should retranslate the graphics.
2664 Moving the cursor into the editing area and out again sometimes wakes up
2668 \begin_layout Standard
2669 A more serious reason could be a syntactical error in your input.
2670 If necessary, redo the last editing steps, using Ctrl-z, or try to translate
2671 the LyX-file into dvi using Ctrl-d or
2673 View\SpecialChar \menuseparator
2677 There should be some error generated, which hopefully gives you a hint
2678 as to the source of the mistake.
2681 \begin_layout Section
2685 \begin_layout Standard
2686 Certain things do not work correctly inside LyX.
2687 The ones that we (used to) miss most are the horizontal and vertical scaling
2688 of diagrams, and the correct positioning of arrows.
2689 There are some workarounds that we are explaining here.
2693 \begin_layout Subsection
2694 Horizontal and vertical scaling
2697 \begin_layout Standard
2698 It is often convenient to stretch the horizontal or the vertical dimensions
2699 of an entire diagram by using spacing commands for rows and/or columns.
2704 \begin_layout Plain Layout
2713 -manual, for instance,
2719 \SpecialChar \ldots{}
2728 \begin_layout Plain Layout
2737 -matrix with row spacing of 1 pica.
2744 \SpecialChar \ldots{}
2749 \SpecialChar \ldots{}
2754 allows to modify the space between columns.
2755 Unfortunately, these commands do currently not work inside LyX, as the
2756 @-character is interpreted by LyX as ending the
2760 \begin_layout Plain Layout
2773 \begin_layout Standard
2778 \begin_layout Plain Layout
2788 \begin_inset space ~
2791 stores the values for row-spacing and column-spacing in the variables
2803 , add the following macro to the preamble (
2805 Layout\SpecialChar \menuseparator
2806 Document\SpecialChar \menuseparator
2810 \begin_layout LyX-Code
2816 \begin_layout LyX-Code
2824 \begin_layout LyX-Code
2830 \begin_layout LyX-Code
2838 \begin_layout LyX-Code
2844 \begin_layout LyX-Code
2850 \begin_layout LyX-Code
2854 \begin_layout Standard
2861 can be defined correspondingly by replacing
2874 Now, a figure can be scaled by entering
2880 \begin_layout Plain Layout
2890 Place the cursor inside the matrix, just before the first entry.
2908 Dont't forget the backslashes and remember, that the closing brace is automatic
2909 ally supplied by LyX.
2910 Inside the braces enter the dimensions.
2916 Here you see a diagram which is squashed vertically and stretched horizontally
2928 \begin_layout Standard
2929 \begin_inset Formula \[
2930 \xyC{.5pc}\xyC{9pc}\xymatrix{A\ar[r]\ar[d] & B\\
2931 C\ar@{}[ur]|{\text{{horizontal stretch}}}}
2939 \begin_layout Subsection
2943 \begin_layout Standard
2948 \begin_layout Plain Layout
2957 -vcommand allows the correct positioning of labels along the shaft of arrows.
2958 This feature is sometimes necessary, when the default position of a label
2959 would otherwise clutter the picture, or would even coincide with other
2960 items, such as the intersection of the arrows in the figure below.
2961 In order to shift a label position alongside the shaft of an arrow,
2965 \begin_layout Plain Layout
2975 \begin_inset space ~
2978 allows to prefix the label by a decimal number in parentheses, specifying
2979 the fraction of distance alongside the arrow where the label is to be placed.
2980 For instance, the code
2988 , will place the label on the shaft, but only about one third of the way.
2992 \begin_layout Standard
2993 Doing the same with labels above or below arrows as
3009 , does not work from inside LyX.
3010 Instead, one has to replace the hat-symbol ^, resp.
3011 the underscore _ , by the macros
3045 It is, in fact, possible to enter several labels this way and those labels
3046 are placed correctly, even if the arrow bends.
3047 In the following figure, the bending arrow with its four labels has been
3071 \begin_layout Standard
3072 \begin_inset Formula \[
3073 \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}}\\
3074 \circ\ar[ur]\sb(0.3)\phi & \bullet}
3082 \begin_layout Subsection
3083 Invisible stretched arrows
3086 \begin_layout Standard
3087 A more general trick uses invisible arrows to place any object almost anywhere
3089 Produce an invisible arrow, shorten (or prolong) it past its goal by adding
3090 a decimal stretching ratio, e.
3091 \begin_inset space \thinspace{}
3104 Attach a label to this invisible arrow.
3108 \begin_layout Standard
3109 Thus, the down pointing arrow with its label
3110 \begin_inset Formula $\varphi$
3113 at (0.3) of its way along the shaft might as well have been produced by
3114 adding to the regular arrow
3121 \begin_inset Formula $\varphi$
3132 , reaching only 0.6 of the way.
3133 Its label will now appear at 0.3 of the way of the original visible arrow.
3137 \begin_layout Standard
3138 This workaround has two minor drawbacks: First, it does not work with bending
3140 Secondly, prolonging an invisible arrow beyond the normal dimension of
3141 the figure will invisibly extend the figure box, and thereby cause too
3142 much vertical space between the figure and the preceding or the following
3147 \begin_layout Standard
3148 Nevertheless, invisible arrows are an important tool, since they can, in
3149 principle, be used to place information at any chosen place in a diagram.
3150 In the above figure, for instance, we have used an invisible arrow to carry
3157 as label and at the earlier figure we had used an invisible arrow to carry
3159 \begin_inset Quotes eld
3167 \begin_inset Quotes erd
3170 into the center of the figure.
3173 \begin_layout Bibliography
3174 \begin_inset CommandInset bibitem
3175 LatexCommand bibitem
3186 \begin_layout Plain Layout
3202 Available as part of the
3210 \begin_layout Bibliography
3211 \begin_inset CommandInset bibitem
3212 LatexCommand bibitem
3214 key "instant-preview"
3219 \begin_inset Flex URL
3222 \begin_layout Plain Layout
3224 http://www.tug.org/tex-archive/help/Catalogue/entries/preview-latex.html
3232 \begin_layout Bibliography
3233 \begin_inset CommandInset bibitem
3234 LatexCommand bibitem
3241 \begin_inset Flex URL
3244 \begin_layout Plain Layout
3246 http://www.tug.org/tex-archive/help/Catalogue/entries/xypic.html
3254 \begin_layout Bibliography
3255 \begin_inset CommandInset bibitem
3256 LatexCommand bibitem
3263 \begin_inset Flex URL
3266 \begin_layout Plain Layout
3268 http://www.gnu.org/software/auctex/