1 #LyX 1.6.2svn 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 % a pdf-bookmark for the TOC is added
26 \let\myTOC\tableofcontents
27 \renewcommand\tableofcontents{%
28 \pdfbookmark[1]{\contentsname}{}
31 % redefine the \LyX macro for PDF bookmarks
32 \def\LyX{\texorpdfstring{%
33 L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}
37 \use_default_options false
42 \font_typewriter default
43 \font_default_family default
53 \pdf_title "Using XY-pc in LyX"
54 \pdf_author "H. Peter Gumm"
55 \pdf_subject "LyX's XY-pic manual"
56 \pdf_keywords "LyX, documentation"
58 \pdf_bookmarksnumbered true
59 \pdf_bookmarksopen true
60 \pdf_bookmarksopenlevel 2
65 \pdf_pdfusetitle false
66 \pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue,pdfpagelayout=OneColumn, pdfnewwindow=true,pdfstartview=XYZ, plainpages=false, pdfpagelabels"
73 \paperorientation portrait
76 \paragraph_separation indent
78 \quotes_language english
81 \paperpagestyle default
82 \tracking_changes false
95 \begin_layout Plain Layout
112 \begin_layout Abstract
113 With the recent versions of LyX and with the
117 -style installed in the LaTeX-System, the graph drawing package
123 \begin_layout Plain Layout
134 -Pic can be conveniently used inside LyX.
135 Diagrams can be edited and displayed inside the main LyX editing window.
136 Here, we shall describe how to use the
146 inside LyX in order to draw, to edit and to preview diagrams as typically
147 used in category theory, algebra, and related fields.
151 \begin_layout Abstract
152 \begin_inset CommandInset toc
153 LatexCommand tableofcontents
160 \begin_layout Section
164 \begin_layout Standard
169 -package has long served as a convenient tool for easily constructing graphs
170 and diagrams in LaTeX.
171 Unfortunately, its use in LyX had long been restricted to the infamous
172 ERT-boxes, meaning that the LyX editor could only display the LaTeX-source
173 and not the finished diagram.
178 -style of LaTeX which is part of the AUCTeX project
179 \begin_inset CommandInset citation
185 , finally enables the editing and displaying of
189 -diagrams, constructed, displayed and interactively edited inside LyX.
192 \begin_layout Standard
193 \begin_inset VSpace defskip
199 \begin_layout Standard
201 \begin_inset Graphics
202 filename xyfigure.png
204 BoundingBox 0bp 0bp 580bp 440bp
212 \begin_layout Standard
213 \begin_inset VSpace defskip
219 \begin_layout Standard
220 In this note, we describe how
224 \begin_layout Plain Layout
233 -pic can be used from inside LyX, how diagrams can be created and edited.
234 We have tested the following using LyX versions 1.3.7 up to 1.6, running under
235 WindowsXP and under Windows Vista.
239 \begin_layout Standard
240 There are two modes of operations: For a start, and for some first tests,
241 it may be easiest to first enter the
245 \begin_layout Plain Layout
254 -Pic code inside the LyX-window, select it all and convert it to a graphical
255 representation by pressing
268 \begin_layout Plain Layout
277 -Pic more frequently, or if you want to modify your initial figure, you
278 will want to assemble and modify your figures using LyX's math editor.
282 \begin_layout Standard
283 Once the cursor is moved over a diagram, this is displayed as an array of
284 nodes and arrow-commands.
285 These can be changed interactively.
286 When the cursor leaves the editing area, the diagram reappears.
290 \begin_layout Standard
291 In the first two sections of this documentation, we explain how to use LyX
292 in the first mentioned mode and we introduce all
296 \begin_layout Plain Layout
305 -Pic features that might be of use for drawing commutative diagrams, graphs
308 \begin_inset CommandInset ref
310 reference "sec:math-editor"
314 explains how to use the
318 \begin_layout Plain Layout
327 -Pic commands inside a math-editing area.
331 \begin_layout Standard
332 It is not our intention to write another introduction to
336 \begin_layout Plain Layout
345 -Pic, rather our motivation is to give an introduction how the most important
346 commands work inside LyX, since the keystrokes as explained in the
350 \begin_layout Plain Layout
360 \begin_inset CommandInset citation
366 will not always function correctly inside LyX.
370 \begin_layout Section
374 \begin_layout Standard
375 The following requires that the LaTeX-packages
383 are installed in the LaTeX system.
384 They are available from CTAN, see at
385 \begin_inset CommandInset citation
387 key "instant-preview"
393 \begin_inset CommandInset citation
400 After freshly installing them, it may be necessary, to run
402 Edit\SpecialChar \menuseparator
405 from the main LyX menu.
406 The steps to a first diagram output in LyX are then:
409 \begin_layout Enumerate
416 \begin_layout Enumerate
419 Edit\SpecialChar \menuseparator
420 Preferences\SpecialChar \menuseparator
421 Look and Feel\SpecialChar \menuseparator
424 and place a check-mark at
432 \begin_layout Enumerate
437 works by opening a LyX-document and entering any math-formula, e.
438 \begin_inset space \thinspace{}
443 \begin_inset Formula $a+b=c$
450 \begin_layout Enumerate
451 Move the cursor out of the formula, and watch it change its appearance to
452 look just like in the finished dvi- or postscript document.
457 \begin_layout Enumerate
462 \begin_layout Plain Layout
477 \begin_layout Enumerate
478 Inside your LyX-Document, enter the text
481 \begin_inset Newline newline
493 \begin_layout Enumerate
494 Select the whole text and choose
496 Insert\SpecialChar \menuseparator
497 Math\SpecialChar \menuseparator
500 , or use the corresponding keyboard shortcut
508 \begin_layout Enumerate
509 Move the mouse cursor out of the editing box and wait for a split second
510 to see an arrow appear:
511 \begin_inset Formula $\xymatrix{A\ar[r] & B}
520 \begin_layout Standard
521 The following diagram, which is taken from the documentation of
525 \begin_layout Plain Layout
535 \begin_inset CommandInset citation
541 by its creator Kristoffer H.
542 Rose, will provide an example for many of the features available with that
547 \begin_layout LyX-Code
551 \begin_inset Newline newline
563 \begin_inset Newline newline
573 \begin_inset Newline newline
589 \begin_inset Newline newline
597 \begin_layout LyX-Code
601 \begin_layout Standard
602 Again, to turn this code into a graphical output, select it all at once
609 \SpecialChar \ldots{}
610 up to the closing brace \SpecialChar \ldots{}
615 and turn it into display-math as explained above.
616 A moment after the cursor leaves the math-area, you should see the diagram
617 in its full graphical glory as shown below.
621 \begin_layout Standard
622 \begin_inset Formula $\xymatrix{U\ar@/_{1pc}/[ddr]_{\psi}\ar@/{}^{1pc}/[drr]^{\varphi}\ar@{.>}[dr]|-{(x,y)}\\
623 & X\times_{Z}Y\ar[d]^{q}\ar[r]_{p} & X\ar[d]_{f}\\
631 \begin_layout Subsection
632 The matrix layout of diagrams
635 \begin_layout Standard
640 uses a matrix to define the layout of the vertices of a diagram.
641 For the above example, we need a
642 \begin_inset Formula $3\times3$
645 -matrix of which 5 entries are used for the vertices
646 \begin_inset Formula $U$
650 \begin_inset Formula $X\times_{Z}Y$
654 \begin_inset Formula $X$
658 \begin_inset Formula $Y$
662 \begin_inset Formula $Z$
665 , the other positions remaining empty.
666 In this case, the following matrix determines the layout:
669 \begin_layout LyX-Code
673 \begin_inset Newline newline
681 \begin_inset Newline newline
691 \begin_inset Newline newline
697 \begin_layout Standard
698 The pattern should be familiar from LaTeX: We see three rows, the first
699 two being terminated by the end-of-line-marker
708 Each line consists of entries, separated by the ampersand
716 \begin_layout Subsection
720 \begin_layout Standard
721 Having entered the vertices, we add arrows between them.
726 -command to produce an arrow is
732 , it is entered into the cell of the matrix where the arrow is to start.
733 The target of the arrow is defined by direction commands
750 These can be combined to a path and enclosed in square brackets.
751 As an example, the arrows from the vertex
752 \begin_inset Formula $U$
755 in the upper left corner down and right to the vertices
756 \begin_inset Formula $X\times_{Z}Y$
760 \begin_inset Formula $Y$
764 \begin_inset Formula $X$
767 are, respectively, defined as
786 Thus the above diagram with all arrows added becomes:
789 \begin_layout LyX-Code
793 \begin_inset Newline newline
807 \begin_inset Newline newline
823 \begin_inset Newline newline
831 \begin_layout Standard
832 \begin_inset Formula \xymatrix{ U \ar[ddr] \ar[drr] \ar[dr]\\
833 & X \times_{Z} Y \ar[d] \ar[r] & X \ar[d]\\
842 \begin_layout LyX-Code
846 \begin_layout LyX-Code
850 \begin_layout Subsection
854 \begin_layout Standard
855 Labels are attached to arrows by affixing them as upper or lower indices
871 defines an arrow going one cell down, two to the right and having the label
873 \begin_inset Formula $\varphi$
877 To attach a label below the arrow, make it a lower index as in
886 This explanation is correct only for arrows pointing to the right.
887 More precisely, imagine looking along the arrow in the direction it is
889 Then an upper index places a label to the left and a lower index places
891 Consequently, an arrow pointing from right to left, such as
902 \begin_inset Formula $\alpha$
906 \begin_inset Formula $\beta$
910 \begin_inset space \thinspace{}
914 \begin_inset space \space{}
918 \begin_inset Formula $\xymatrix{\ & \ \ar[l]_{\beta}^{\alpha}.}
922 Using the character | instead of ^ or _ , it is even possible to place the
923 label right onto the arrow, obscuring part of its shaft.
927 \begin_layout Standard
928 Normally, a label is placed halfway between an arrow's start and target
930 In the first diagram, the central arrow starting in
931 \begin_inset Formula $U$
935 \begin_inset Formula $(x,y)$
938 in the middle of the arrow's shaft, rather than in the middle between the
939 two objects it connects.
940 This is achieved by prefixing the label with a minus sign, here:
949 \begin_layout LyX-Code
953 \begin_inset Newline newline
971 \begin_inset Newline newline
987 \begin_inset Newline newline
995 \begin_layout LyX-Code
996 \begin_inset Formula \xymatrix{ U \ar[ddr]_{\psi}\ar[drr]^{\varphi}\ar[dr]|-{(x,y)}\\
997 & X \times_{Z} Y \ar[d]^{q} \ar[r]_{p} & X \ar[d]_{f}\\
1006 \begin_layout Standard
1010 \begin_layout Plain Layout
1019 -pic normally permits labels to be shifted towards the tip or towards the
1020 start of an arrow by prefixing the label with a ratio, such as e.
1021 \begin_inset space \thinspace{}
1030 In LyX this works only for labels which are placed on top of the arrow,
1043 \begin_layout Standard
1044 For labels placed to the left or to the right of the arrow this does not
1050 \begin_layout Plain Layout
1059 -pic code such as e.
1060 \begin_inset space \thinspace{}
1080 is not correctly interpreted by LyX's math editor.
1081 Two workarounds are suggested in the last section of this note.
1084 \begin_layout Subsection
1088 \begin_layout Standard
1089 Modification of the design, the form or the positioning of arrows are introduced
1095 This is followed by a pair of matching brackets, where the form of the
1108 indicates, whether we want to modify the design, the or the curvature of
1110 Various modifactions can be applied to an arrow at the same time.
1113 \begin_layout Subsubsection
1117 \begin_layout Standard
1118 Various designs such as
1134 are possible for the shaft of an arrow.
1135 These can be combined with various ends and various tips.
1136 In general, the design of an arrow is described by following the command
1147 -sign and a pair of braces {\SpecialChar \ldots{}
1148 } containing characters describing the end,
1149 the shaft and the tip of the arrow.
1150 These characters are chosen to give some form of ASCII-rendering of the
1158 produces an arrow with split end, a dotted shaft and double head.
1159 A number of other arrow designs is given in the table below.
1160 Note that the ends of embedding arrows
1161 \begin_inset Formula $\xymatrix{A\ar@{^{(}->}[r] & B}
1165 are described by raising or lowering opening parentheses, such as in
1170 \begin_inset Newline newline
1176 \begin_layout Standard
1177 \begin_inset Tabular
1178 <lyxtabular version="3" rows="11" columns="2">
1179 <features islongtable="true">
1180 <column alignment="center" valignment="top" width="0">
1181 <column alignment="center" valignment="top" width="0">
1183 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1186 \begin_layout Plain Layout
1192 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1195 \begin_layout Plain Layout
1203 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1206 \begin_layout Plain Layout
1207 \begin_inset Formula \xymatrix{\ \ar[r] & \ }
1217 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1220 \begin_layout Plain Layout
1232 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1235 \begin_layout Plain Layout
1236 \begin_inset Formula \xymatrix{\ \ar@{-->}[r] & \ }
1246 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1249 \begin_layout Plain Layout
1261 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1264 \begin_layout Plain Layout
1265 \begin_inset Formula \xymatrix{\ \ar@{..>}[r] & \ }
1275 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1278 \begin_layout Plain Layout
1290 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1293 \begin_layout Plain Layout
1294 \begin_inset Formula \xymatrix{\ \ar@{~>}[r] & \ }
1304 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1307 \begin_layout Plain Layout
1319 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1322 \begin_layout Plain Layout
1323 \begin_inset Formula \xymatrix{\ \ar@{->>}[r] & \ }
1333 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1336 \begin_layout Plain Layout
1348 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1351 \begin_layout Plain Layout
1352 \begin_inset Formula \xymatrix{\ \ar@{-->>}[r] & \ }
1362 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1365 \begin_layout Plain Layout
1377 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1380 \begin_layout Plain Layout
1381 \begin_inset Formula \xymatrix{\ \ar@{>->>}[r] & \ }
1391 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1394 \begin_layout Plain Layout
1406 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1409 \begin_layout Plain Layout
1410 \begin_inset Formula \xymatrix{\ \ar@{_{(}->}[r] & \ }
1420 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1423 \begin_layout Plain Layout
1435 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1438 \begin_layout Plain Layout
1439 \begin_inset Formula \xymatrix{\ \ar@{^{(}->}[r] & \ }
1449 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1452 \begin_layout Plain Layout
1464 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1467 \begin_layout Plain Layout
1468 \begin_inset Formula \xymatrix{\ \ar@{|-|}[r] & \ }
1478 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1481 \begin_layout Plain Layout
1499 \begin_layout Standard
1501 Following the @-character by either a 2, 3, _,or a ^, we can produce arrows
1502 with double, triple shaft or arrows showing only the lower or upper half
1503 of their tips and ends.
1504 Arrows need not have tips nor ends, as the last example shows :
1505 \begin_inset Newline newline
1511 \begin_layout Standard
1512 \begin_inset Tabular
1513 <lyxtabular version="3" rows="8" columns="2">
1514 <features islongtable="true">
1515 <column alignment="center" valignment="top" width="0">
1516 <column alignment="center" valignment="top" width="0">
1518 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1521 \begin_layout Plain Layout
1527 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1530 \begin_layout Plain Layout
1538 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1541 \begin_layout Plain Layout
1542 \begin_inset Formula \xymatrix{\ \ar@2[r] & \ }
1552 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1555 \begin_layout Plain Layout
1567 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1570 \begin_layout Plain Layout
1571 \begin_inset Formula \xymatrix{\ \ar@3[r] & \ }
1581 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1584 \begin_layout Plain Layout
1596 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1599 \begin_layout Plain Layout
1600 \begin_inset Formula \xymatrix{\ \ar@_{->}[r] & \ }
1610 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1613 \begin_layout Plain Layout
1625 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1628 \begin_layout Plain Layout
1629 \begin_inset Formula \xymatrix{\ \ar@^{->}[r] & \ }
1639 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1642 \begin_layout Plain Layout
1654 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1657 \begin_layout Plain Layout
1658 \begin_inset Formula \xymatrix{\ \ar@^{>>->>}[r] & \ }
1668 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1671 \begin_layout Plain Layout
1683 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1686 \begin_layout Plain Layout
1687 \begin_inset Formula \xymatrix{\ \ar@{^{<}-_{>}}[r] & \ }
1697 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1700 \begin_layout Plain Layout
1712 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1715 \begin_layout Plain Layout
1716 \begin_inset Formula \xymatrix{\ \ar@2{--}[r] & \ }
1726 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1729 \begin_layout Plain Layout
1747 \begin_layout Subsubsection
1748 Designing your own arrows
1751 \begin_layout Standard
1752 Within certain limits there is even a way to design your own arrows.
1753 Using some the characters
1757 one can even design one's own arrow tips using the
1763 command in the preample.
1764 For explanations, we refer to the
1770 \begin_layout Plain Layout
1781 -manual, from which we take the example:
1784 \begin_layout Standard
1789 newdir{|>}{!/4.5pt/@{|}*:(1,-.2)@^{>}*:(1,+.2)@_{>}}
1794 \begin_layout Standard
1796 This defines a new arrow tip, referred to as
1806 and which displays correctly in LyX as:
1807 \begin_inset Formula \[
1808 \xymatrix{A\ar@{-|>}[r] & \ \ B}
1816 \begin_layout Subsection
1820 \begin_layout Standard
1821 Arrows are shifted sideways with the modifier
1826 \begin_inset Formula $\ldots$
1833 where the ellipsis is replaced by a positive or negative measure.
1834 For instance, to design a pair of mutually opposing arrows between two
1835 nodes, we shift them to see them apart.
1836 Note that the direction of the shift (positive) is to the left if one looks
1841 \begin_layout Standard
1857 \begin_layout Standard
1860 \begin_inset space ~
1864 \begin_inset space ~
1868 \begin_inset Formula \[
1869 \xymatrix{\circ\ar@<1ex>[r] & \circ\ar@<1ex>[l]}
1878 \begin_layout Subsubsection
1879 Inline or centered diagrams
1882 \begin_layout Standard
1883 Arrows and diagrams can be used inline, such as this one:
1884 \begin_inset Formula $\xymatrix{\circ\ar@<1ex>[r] & \circ\ar@<1ex>[l]}
1889 When their code is written inside LyX as above, select it and choose either
1894 for inline appearence or
1899 Diagrams constructed inline can later be centered, or, conversely, centered
1900 diagrams can be changed to inline formulas with
1902 Edit\SpecialChar \menuseparator
1907 \SpecialChar \menuseparator
1911 \begin_layout Subsection
1915 \begin_layout Standard
1916 There are two simple methods to make arrows bend.
1917 The first is giving an explicit value by which the midpoint of the arrow's
1918 shaft is raised or depressed, the other is by forcing the arrow to leave
1919 its origin in a prescribed compass direction and to make him enter the
1920 target at another direction.
1921 The necessary bending of the arrow is determined automatically.
1922 We describe both methods.
1925 \begin_layout Subsubsection
1929 \begin_layout Standard
1930 For bending arrows we use the modifier @/
1931 \begin_inset Formula $\ldots$
1935 The ellipsis stands for a TeX-measure which needs to be entered as a lower
1941 , we could simply write, e.
1942 \begin_inset space \thinspace{}
1952 for an arrow bending
1956 downwards, this cannot directly be done in LyX.
1957 It is necessary, to enclose the measure in a pair of braces, such as e.
1958 \begin_inset space \thinspace{}
1969 As an example, here are two opposing arrows between
1970 \begin_inset Formula $A$
1974 \begin_inset Formula $B$
1977 , each bending by .5 pica, given by the following source code:
1980 \begin_layout Standard
1992 \begin_layout Standard
1993 \begin_inset Formula \[
1994 \xymatrix{A\ar@/{}_{.5pc}/[r] & B\ar@/{}_{.5pc}/[l]}
2002 \begin_layout Subsubsection
2003 Specifying exit- and entrance directions.
2007 \begin_layout Standard
2008 An alternative for making arrows bend is by specifying their compass direction
2009 as they are leaving their source and their direction from which they enter
2011 Instead of north, north-east, east, etc., the directions are named
2043 , standing for up, up-right, right, down-right, etc..
2044 A direction is specified as @(
2056 stands for the direction the first object is left and
2060 stands for the direction from which the target is entered.
2061 As an example, we show some bending arrows and a loop, which arises when
2062 we do not specify a target for an arrow, just its incoming and outgoing
2066 \begin_layout Standard
2067 \begin_inset Formula \[
2068 \xymatrix{A\ar@(dr,dl)[r]\ar@(dr,dl)[rr] & B\ar@(d,r)[dl] & C\\
2077 \begin_layout LyX-Code
2085 \begin_inset Newline newline
2095 \begin_inset Newline newline
2103 \begin_layout Subsection
2107 \begin_layout Standard
2108 The above example is reminiscent of an automata diagram, except that in
2109 such a diagram states would be enclosed in small circles, with double circles
2110 denoting final states.
2114 \begin_layout Subsubsection
2118 \begin_layout Standard
2123 \begin_layout Plain Layout
2132 -Pic, entries can obtain a single or a double frame, such as
2133 \begin_inset Formula $\xymatrix{*+[F]{A}}
2138 \begin_inset Formula $\xymatrix{*+[F=]{B}}
2142 by prefixing an entry with
2150 and enclosing the portion of the entry to be framed in braces.
2151 Normally, the frame will be very tight so that it must be widened by prefixing
2161 Round frames, such as
2162 \begin_inset Formula $\xymatrix{*++[o][F]{A}}
2167 \begin_inset Formula $\xymatrix{*++[o][F=]{B}}
2171 are obtained by specifying the shape as
2176 So the latter figure was constructed as *++[o][F=]{B}.
2177 This way, the following automaton
2180 \begin_layout Standard
2181 \begin_inset Formula \[
2182 \xymatrix{\txt{start}\ar[r] & *++[o][F]{1}\ar[r] & *++[o][F=]{2}\ar@(ur,dr)\ar@(ur,ul)[l]}
2190 \begin_layout Standard
2194 \begin_layout Plain Layout
2206 \begin_layout LyX-Code
2216 \begin_layout LyX-Code
2222 \begin_layout LyX-Code
2230 \begin_layout LyX-Code
2234 \begin_layout Standard
2241 \SpecialChar \ldots{}
2246 will make a certain entry style the default, that can, of course be overridden
2247 for individual entries.
2252 entrymodifiers={++[o][F-]}
2254 , all following entries inside
2258 \begin_layout Plain Layout
2267 -matrices would be encircled.
2270 \begin_layout Subsubsection
2274 \begin_layout Standard
2275 Framing a whole rectangle inside an xymatrix is done with the macro pair
2295 The dimension of the rectangle is given as a dotted pair
2296 \begin_inset Formula $P_{0}.P_{1}$
2299 of points denoting the top left and lower right corners of the rectangle.
2300 Each point, in turn,is given as a doubly quoted comma separated pair
2301 \begin_inset Quotes eld
2305 \begin_inset Formula $x,y$
2309 \begin_inset Quotes erd
2313 \begin_inset Formula $x$
2317 \begin_inset Formula $y$
2321 These are followed by the framing commands, to produce figures such as
2323 \begin_inset Formula \[
2324 \xymatrix{A & B\ar@(d,r)[dl]\sp(0.2)\phi\sp(0.7)\psi\save"1,1"."2,1"*+[F=]\frm{}\restore\,\\
2325 C & \save"1,1"."1,2"*++[F]\frm{}\restore}
2341 save"1,1"."2,1"*+[F=]
2354 produces the doubly framed rectangle, and the code for the extra wide horizonta
2366 save"1,1"."1,2"*++[F]
2380 This code can be placed in arbitrary cells of the xymatrix.
2384 \begin_layout Section
2385 Using LyX's math editor
2386 \begin_inset CommandInset label
2388 name "sec:math-editor"
2395 \begin_layout Standard
2396 As an alternative to writing the
2400 code, then transforming it into a math-editing environment by marking it
2409 , one may construct and modify the whole xypic-diagram inside LyX's math
2411 We describe the editing steps for a figure just like the one above.
2415 \begin_layout Subsection
2416 Caveat - how to enter braces
2419 \begin_layout Standard
2420 Recall that in LyX's math-editor any pair of braces
2428 that are to enclose a macro-parameter must be entered by typing just
2435 The closing brace is automatically supplied and in between a box into which
2436 to the parameter is entered.
2441 \begin_layout Plain Layout
2450 -diagrams, this applies in particular to arrow modifications that are normally
2455 \SpecialChar \ldots{}
2460 with the ellipsis standing for the description of end, shaft and tip of
2462 Inside the math-editor, enter just
2468 and let LyX provide the closing brace and the box into which to enter the
2469 description of the arrow.
2472 \begin_layout Standard
2473 Braces that are entered without the backslash
2479 will just appear as typed, but cannot be used to receive a macro parameter.
2480 They are useful, for instance to denote sets, e.
2481 \begin_inset space \thinspace{}
2496 \begin_inset Formula $\{x\in X\mid x\notin x\}$
2502 \begin_layout Subsection
2503 Setting up the matrix
2506 \begin_layout Standard
2515 open a formula environment and enter:
2523 \begin_inset Formula $\times$
2530 \begin_layout Plain Layout
2540 Add extra rows by typing
2544 and add columns by typing
2550 \begin_layout Standard
2551 At any time, further rows or columns can be entered or deleted using commands
2554 Edit\SpecialChar \menuseparator
2558 their shortcuts, beginning with
2562 for the column commands or
2566 for the row commands.
2570 \begin_layout Subsection
2571 Entering nodes, arrows and labels
2574 \begin_layout Standard
2575 Type the nodes into the correct positions of the matrix.
2576 If you move the cursor out of the matrix, you should see a first rendering
2578 Next, add the arrows at the nodes from where they should emanate by typing
2595 can be any path made up from the characters
2612 Make sure that the path indeed leads to an existing node within the matrix.
2613 Otherwise, the figure will not display when the cursor leaves the editing
2617 \begin_layout Standard
2618 Next, label the arrows by attaching a label text as upper or lower indices
2619 to the end of the arrow's path.
2620 As always in LyX's math editor, an underscore
2624 opens a box for a lower index and a
2628 followed by a space opens a box for an upper index.
2629 You can enter any LaTeX-code as a label.
2633 \begin_layout Subsection
2637 \begin_layout Standard
2638 Finally, you can modify the appearance of the arrows by entering @-modifiers
2643 \SpecialChar \ldots{}
2652 \SpecialChar \ldots{}
2657 \SpecialChar \ldots{}
2658 ,\SpecialChar \ldots{}
2663 \SpecialChar \ldots{}
2669 The above caveat applies to the first form only.
2670 It must be entered as
2676 with the arrow description entered inside the LyX-supplied box.
2677 If this box remains empty, you have specified an empty arrow.
2678 This is a useful construction, too, as you will see in the next section.
2682 \begin_layout Standard
2683 The other modifiers,
2687 \SpecialChar \ldots{}
2696 \SpecialChar \ldots{}
2697 ,\SpecialChar \ldots{}
2706 \SpecialChar \ldots{}
2711 are typed as shown with the arrow description replacing the ellipsis.
2712 The code for bending arrows, which in
2745 \begin_layout Plain Layout
2754 -measure that should be entered as upper or lower index to the first slash
2756 Make sure that the ending slash does not end up being part of the upper
2760 \begin_layout Subsection
2761 What if something goes wrong
2764 \begin_layout Standard
2765 When constructing a diagram, you should at times check it by just moving
2766 the cursor out of the editing area to see whether instant preview can successfu
2767 lly convert it into graphical output.
2768 If this does not happen, it may either be that instant preview for some
2769 reason is not aware that it should retranslate the graphics.
2770 Moving the cursor into the editing area and out again sometimes wakes up
2774 \begin_layout Standard
2775 A more serious reason could be a syntactical error in your input.
2776 If necessary, redo the last editing steps, using
2780 , or try to translate the
2784 \begin_layout Plain Layout
2803 View\SpecialChar \menuseparator
2807 There should be some error generated, which hopefully gives you a hint
2808 as to the source of the mistake.
2811 \begin_layout Section
2815 \begin_layout Standard
2816 Certain things do not work correctly inside
2820 \begin_layout Plain Layout
2830 The ones that we (used to) miss most are the horizontal and vertical scaling
2831 of diagrams, and the correct positioning of arrows.
2832 There are some workarounds that we are explaining here.
2836 \begin_layout Subsection
2837 Horizontal and vertical scaling
2840 \begin_layout Standard
2841 It is often convenient to stretch the horizontal or the vertical dimensions
2842 of an entire diagram by using spacing commands for rows and/or columns.
2847 \begin_layout Plain Layout
2856 -manual, for instance,
2862 \SpecialChar \ldots{}
2871 \begin_layout Plain Layout
2880 -matrix with row spacing of 1 pica.
2887 \SpecialChar \ldots{}
2892 \SpecialChar \ldots{}
2897 allows to modify the space between columns.
2898 Unfortunately, these commands do currently not work inside LyX, as the
2899 @-character is interpreted by LyX as ending the
2903 \begin_layout Plain Layout
2916 \begin_layout Standard
2921 \begin_layout Plain Layout
2931 \begin_inset space ~
2934 stores the values for row-spacing and column-spacing in the variables
2946 , add the following macro to the preamble (
2948 Layout\SpecialChar \menuseparator
2949 Document\SpecialChar \menuseparator
2953 \begin_layout LyX-Code
2959 \begin_layout LyX-Code
2967 \begin_layout LyX-Code
2973 \begin_layout LyX-Code
2981 \begin_layout LyX-Code
2987 \begin_layout LyX-Code
2993 \begin_layout LyX-Code
2997 \begin_layout Standard
3004 can be defined correspondingly by replacing
3017 Now, a figure can be scaled by entering
3023 \begin_layout Plain Layout
3033 Place the cursor inside the matrix, just before the first entry.
3051 Dont't forget the backslashes and remember, that the closing brace is automatic
3052 ally supplied by LyX.
3053 Inside the braces enter the dimensions.
3059 Here you see a diagram which is squashed vertically and stretched horizontally
3071 \begin_layout Standard
3072 \begin_inset Formula \[
3073 \xyC{.5pc}\xyC{9pc}\xymatrix{A\ar[r]\ar[d] & B\\
3074 C\ar@{}[ur]|{\text{{horizontal stretch}}}}
3082 \begin_layout Subsection
3086 \begin_layout Standard
3091 \begin_layout Plain Layout
3100 -vcommand allows the correct positioning of labels along the shaft of arrows.
3101 This feature is sometimes necessary, when the default position of a label
3102 would otherwise clutter the picture, or would even coincide with other
3103 items, such as the intersection of the arrows in the figure below.
3104 In order to shift a label position alongside the shaft of an arrow,
3108 \begin_layout Plain Layout
3118 \begin_inset space ~
3121 allows to prefix the label by a decimal number in parentheses, specifying
3122 the fraction of distance alongside the arrow where the label is to be placed.
3123 For instance, the code
3131 , will place the label on the shaft, but only about one third of the way.
3135 \begin_layout Standard
3136 Doing the same with labels above or below arrows as
3152 , does not work from inside LyX.
3153 Instead, one has to replace the hat-symbol ^, resp.
3154 the underscore _ , by the macros
3188 It is, in fact, possible to enter several labels this way and those labels
3189 are placed correctly, even if the arrow bends.
3190 In the following figure, the bending arrow with its four labels has been
3214 \begin_layout Standard
3215 \begin_inset Formula \[
3216 \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}}\\
3217 \circ\ar[ur]\sb(0.3)\phi & \bullet}
3225 \begin_layout Subsection
3226 Invisible stretched arrows
3229 \begin_layout Standard
3230 A more general trick uses invisible arrows to place any object almost anywhere
3232 Produce an invisible arrow, shorten (or prolong) it past its goal by adding
3233 a decimal stretching ratio, e.
3234 \begin_inset space \thinspace{}
3247 Attach a label to this invisible arrow.
3251 \begin_layout Standard
3252 Thus, the down pointing arrow with its label
3253 \begin_inset Formula $\varphi$
3256 at (0.3) of its way along the shaft might as well have been produced by
3257 adding to the regular arrow
3264 \begin_inset Formula $\varphi$
3275 , reaching only 0.6 of the way.
3276 Its label will now appear at 0.3 of the way of the original visible arrow.
3280 \begin_layout Standard
3281 This workaround has two minor drawbacks: First, it does not work with bending
3283 Secondly, prolonging an invisible arrow beyond the normal dimension of
3284 the figure will invisibly extend the figure box, and thereby cause too
3285 much vertical space between the figure and the preceding or the following
3290 \begin_layout Standard
3291 Nevertheless, invisible arrows are an important tool, since they can, in
3292 principle, be used to place information at any chosen place in a diagram.
3293 In the above figure, for instance, we have used an invisible arrow to carry
3300 as label and at the earlier figure we had used an invisible arrow to carry
3302 \begin_inset Quotes eld
3310 \begin_inset Quotes erd
3313 into the center of the figure.
3316 \begin_layout Subsection
3323 \begin_layout Plain Layout
3337 \begin_layout Standard
3338 Here we have focused only on the
3344 command, which is just one of the features available in Kris Rose's amazing
3350 \begin_layout Plain Layout
3368 \begin_layout Plain Layout
3380 \begin_inset CommandInset citation
3386 demonstrates many of the advanced possibilities of that package.
3387 Beware, that its style is rather terse and you will likely need a lot of
3388 experimenting and modifying the many worked examples.
3390 \begin_inset CommandInset citation
3400 \begin_layout Plain Layout
3409 -pic to make braids, cobordism, string diagrams, and much more.
3410 A good and rather systematic introduction to
3416 \begin_layout Plain Layout
3428 \begin_inset CommandInset citation
3435 Even if you share with me the disadvantage of not being fluent in Esperanto,
3436 you will be able to understand most of it.
3440 \begin_layout Bibliography
3441 \begin_inset CommandInset bibitem
3442 LatexCommand bibitem
3453 \begin_layout Plain Layout
3469 Available as part of the
3477 \begin_layout Bibliography
3478 \begin_inset CommandInset bibitem
3479 LatexCommand bibitem
3481 key "instant-preview"
3486 \begin_inset Flex URL
3489 \begin_layout Plain Layout
3491 http://www.tug.org/tex-archive/help/Catalogue/entries/preview-latex.html
3499 \begin_layout Bibliography
3500 \begin_inset CommandInset bibitem
3501 LatexCommand bibitem
3508 \begin_inset Flex URL
3511 \begin_layout Plain Layout
3513 http://www.tug.org/tex-archive/help/Catalogue/entries/xypic.html
3521 \begin_layout Bibliography
3522 \begin_inset CommandInset bibitem
3523 LatexCommand bibitem
3530 \begin_inset Flex URL
3533 \begin_layout Plain Layout
3535 http://www.gnu.org/software/auctex/
3543 \begin_layout Bibliography
3544 \begin_inset CommandInset bibitem
3545 LatexCommand bibitem
3555 \begin_layout Plain Layout
3570 tutorial with an archive of examples
3573 \begin_inset Flex URL
3576 \begin_layout Plain Layout
3578 http://www.dpmms.cam.ac.uk/~al366/xytutorial.html
3586 \begin_layout Bibliography
3587 \begin_inset CommandInset bibitem
3588 LatexCommand bibitem
3598 \begin_layout Plain Layout
3613 Enkonduko pri Xymatrix
3617 \begin_inset Flex URL
3620 \begin_layout Plain Layout
3622 http://filip.ouvaton.org/xypic/xymatrix/index.html