1 #LyX 1.6.2svn created this file. For more info see http://www.lyx.org/
10 % define new commands used in sec. 5.1
13 \xydef@\xymatrixrowsep@{#1}}
15 \xydef@\xymatrixcolsep@{#1}}
17 \newdir{|>}{!/4.5pt/@{|}*:(1,-.2)@^{>}*:(1,+.2)@_{>}}
19 % a pdf-bookmark for the TOC is added
20 \let\myTOC\tableofcontents
21 \renewcommand\tableofcontents{%
22 \pdfbookmark[1]{\contentsname}{}
25 % redefine the \LyX macro for PDF bookmarks
26 \def\LyX{\texorpdfstring{%
27 L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}
31 \use_default_options false
36 \font_typewriter default
37 \font_default_family default
47 \pdf_title "Using XY-pc in LyX"
48 \pdf_author "H. Peter Gumm"
49 \pdf_subject "LyX's XY-pic manual"
50 \pdf_keywords "LyX, documentation"
52 \pdf_bookmarksnumbered true
53 \pdf_bookmarksopen true
54 \pdf_bookmarksopenlevel 2
59 \pdf_pdfusetitle false
60 \pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue,pdfpagelayout=OneColumn, pdfnewwindow=true,pdfstartview=XYZ, plainpages=false, pdfpagelabels"
67 \paperorientation portrait
70 \paragraph_separation indent
72 \quotes_language english
75 \paperpagestyle default
76 \tracking_changes false
89 \begin_layout Plain Layout
106 \begin_layout Abstract
107 With the recent versions of LyX and with the
111 -style installed in the LaTeX-System, the graph drawing package
117 \begin_layout Plain Layout
128 -Pic can be conveniently used inside LyX.
129 Diagrams can be edited and displayed inside the main LyX editing window.
130 Here, we shall describe how to use the
140 inside LyX in order to draw, to edit and to preview diagrams as typically
141 used in category theory, algebra, and related fields.
145 \begin_layout Abstract
146 \begin_inset CommandInset toc
147 LatexCommand tableofcontents
154 \begin_layout Section
158 \begin_layout Standard
163 -package has long served as a convenient tool for easily constructing graphs
164 and diagrams in LaTeX.
165 Unfortunately, its use in LyX had long been restricted to the infamous
166 ERT-boxes, meaning that the LyX editor could only display the LaTeX-source
167 and not the finished diagram.
172 -style of LaTeX which is part of the AUCTeX project
173 \begin_inset CommandInset citation
179 , finally enables the editing and displaying of
183 -diagrams, constructed, displayed and interactively edited inside LyX.
186 \begin_layout Standard
187 \begin_inset VSpace defskip
193 \begin_layout Standard
195 \begin_inset Graphics
196 filename xyfigure.png
198 BoundingBox 0bp 0bp 580bp 440bp
206 \begin_layout Standard
207 \begin_inset VSpace defskip
213 \begin_layout Standard
214 In this note, we describe how
218 \begin_layout Plain Layout
227 -pic can be used from inside LyX, how diagrams can be created and edited.
228 We have tested the following using LyX versions 1.3.7 up to 1.6, running under
229 WindowsXP and under Windows Vista.
233 \begin_layout Standard
234 There are two modes of operations: For a start, and for some first tests,
235 it may be easiest to first enter the
239 \begin_layout Plain Layout
248 -Pic code inside the LyX-window, select it all and convert it to a graphical
249 representation by pressing
262 \begin_layout Plain Layout
271 -Pic more frequently, or if you want to modify your initial figure, you
272 will want to assemble and modify your figures using LyX's math editor.
276 \begin_layout Standard
277 Once the cursor is moved over a diagram, this is displayed as an array of
278 nodes and arrow-commands.
279 These can be changed interactively.
280 When the cursor leaves the editing area, the diagram reappears.
284 \begin_layout Standard
285 In the first two sections of this documentation, we explain how to use LyX
286 in the first mentioned mode and we introduce all
290 \begin_layout Plain Layout
299 -Pic features that might be of use for drawing commutative diagrams, graphs
302 \begin_inset CommandInset ref
304 reference "sec:math-editor"
308 explains how to use the
312 \begin_layout Plain Layout
321 -Pic commands inside a math-editing area.
325 \begin_layout Standard
326 It is not our intention to write another introduction to
330 \begin_layout Plain Layout
339 -Pic, rather our motivation is to give an introduction how the most important
340 commands work inside LyX, since the keystrokes as explained in the
344 \begin_layout Plain Layout
354 \begin_inset CommandInset citation
360 will not always function correctly inside LyX.
364 \begin_layout Section
368 \begin_layout Standard
369 The following requires that the LaTeX-packages
377 are installed in the LaTeX system.
378 They are available from CTAN, see at
379 \begin_inset CommandInset citation
381 key "instant-preview"
387 \begin_inset CommandInset citation
394 After freshly installing them, it may be necessary, to run
396 Edit\SpecialChar \menuseparator
399 from the main LyX menu.
400 The steps to a first diagram output in LyX are then:
403 \begin_layout Enumerate
410 \begin_layout Enumerate
413 Edit\SpecialChar \menuseparator
414 Preferences\SpecialChar \menuseparator
415 Look and Feel\SpecialChar \menuseparator
418 and place a check-mark at
426 \begin_layout Enumerate
431 works by opening a LyX-document and entering any math-formula, e.
432 \begin_inset space \thinspace{}
437 \begin_inset Formula $a+b=c$
444 \begin_layout Enumerate
445 Move the cursor out of the formula, and watch it change its appearance to
446 look just like in the finished dvi- or postscript document.
451 \begin_layout Enumerate
456 \begin_layout Plain Layout
471 \begin_layout Enumerate
472 Inside your LyX-Document, enter the text
475 \begin_inset Newline newline
487 \begin_layout Enumerate
488 Select the whole text and choose
490 Insert\SpecialChar \menuseparator
491 Math\SpecialChar \menuseparator
494 , or use the corresponding keyboard shortcut
502 \begin_layout Enumerate
503 Move the mouse cursor out of the editing box and wait for a split second
504 to see an arrow appear:
505 \begin_inset Formula $\xymatrix{A\ar[r] & B}
514 \begin_layout Standard
515 The following diagram, which is taken from the documentation of
519 \begin_layout Plain Layout
529 \begin_inset CommandInset citation
535 by its creator Kristoffer H.
536 Rose, will provide an example for many of the features available with that
541 \begin_layout LyX-Code
545 \begin_inset Newline newline
557 \begin_inset Newline newline
567 \begin_inset Newline newline
583 \begin_inset Newline newline
591 \begin_layout LyX-Code
595 \begin_layout Standard
596 Again, to turn this code into a graphical output, select it all at once
603 \SpecialChar \ldots{}
604 up to the closing brace \SpecialChar \ldots{}
609 and turn it into display-math as explained above.
610 A moment after the cursor leaves the math-area, you should see the diagram
611 in its full graphical glory as shown below.
615 \begin_layout Standard
616 \begin_inset Formula $\xymatrix{U\ar@/_{1pc}/[ddr]_{\psi}\ar@/{}^{1pc}/[drr]^{\varphi}\ar@{.>}[dr]|-{(x,y)}\\
617 & X\times_{Z}Y\ar[d]^{q}\ar[r]_{p} & X\ar[d]_{f}\\
625 \begin_layout Subsection
626 The matrix layout of diagrams
629 \begin_layout Standard
634 uses a matrix to define the layout of the vertices of a diagram.
635 For the above example, we need a
636 \begin_inset Formula $3\times3$
639 -matrix of which 5 entries are used for the vertices
640 \begin_inset Formula $U$
644 \begin_inset Formula $X\times_{Z}Y$
648 \begin_inset Formula $X$
652 \begin_inset Formula $Y$
656 \begin_inset Formula $Z$
659 , the other positions remaining empty.
660 In this case, the following matrix determines the layout:
663 \begin_layout LyX-Code
667 \begin_inset Newline newline
675 \begin_inset Newline newline
685 \begin_inset Newline newline
691 \begin_layout Standard
692 The pattern should be familiar from LaTeX: We see three rows, the first
693 two being terminated by the end-of-line-marker
702 Each line consists of entries, separated by the ampersand
710 \begin_layout Subsection
714 \begin_layout Standard
715 Having entered the vertices, we add arrows between them.
720 -command to produce an arrow is
726 , it is entered into the cell of the matrix where the arrow is to start.
727 The target of the arrow is defined by direction commands
744 These can be combined to a path and enclosed in square brackets.
745 As an example, the arrows from the vertex
746 \begin_inset Formula $U$
749 in the upper left corner down and right to the vertices
750 \begin_inset Formula $X\times_{Z}Y$
754 \begin_inset Formula $Y$
758 \begin_inset Formula $X$
761 are, respectively, defined as
780 Thus the above diagram with all arrows added becomes:
783 \begin_layout LyX-Code
787 \begin_inset Newline newline
801 \begin_inset Newline newline
817 \begin_inset Newline newline
825 \begin_layout Standard
826 \begin_inset Formula \xymatrix{ U \ar[ddr] \ar[drr] \ar[dr]\\
827 & X \times_{Z} Y \ar[d] \ar[r] & X \ar[d]\\
836 \begin_layout LyX-Code
840 \begin_layout LyX-Code
844 \begin_layout Subsection
848 \begin_layout Standard
849 Labels are attached to arrows by affixing them as upper or lower indices
865 defines an arrow going one cell down, two to the right and having the label
867 \begin_inset Formula $\varphi$
871 To attach a label below the arrow, make it a lower index as in
880 This explanation is correct only for arrows pointing to the right.
881 More precisely, imagine looking along the arrow in the direction it is
883 Then an upper index places a label to the left and a lower index places
885 Consequently, an arrow pointing from right to left, such as
896 \begin_inset Formula $\alpha$
900 \begin_inset Formula $\beta$
904 \begin_inset space \thinspace{}
908 \begin_inset space \space{}
912 \begin_inset Formula $\xymatrix{\ & \ \ar[l]_{\beta}^{\alpha}.}
916 Using the character | instead of ^ or _ , it is even possible to place the
917 label right onto the arrow, obscuring part of its shaft.
921 \begin_layout Standard
922 Normally, a label is placed halfway between an arrow's start and target
924 In the first diagram, the central arrow starting in
925 \begin_inset Formula $U$
929 \begin_inset Formula $(x,y)$
932 in the middle of the arrow's shaft, rather than in the middle between the
933 two objects it connects.
934 This is achieved by prefixing the label with a minus sign, here:
943 \begin_layout LyX-Code
947 \begin_inset Newline newline
965 \begin_inset Newline newline
981 \begin_inset Newline newline
989 \begin_layout LyX-Code
990 \begin_inset Formula \xymatrix{ U \ar[ddr]_{\psi}\ar[drr]^{\varphi}\ar[dr]|-{(x,y)}\\
991 & X \times_{Z} Y \ar[d]^{q} \ar[r]_{p} & X \ar[d]_{f}\\
1000 \begin_layout Standard
1004 \begin_layout Plain Layout
1013 -pic normally permits labels to be shifted towards the tip or towards the
1014 start of an arrow by prefixing the label with a ratio, such as e.
1015 \begin_inset space \thinspace{}
1024 In LyX this works only for labels which are placed on top of the arrow,
1037 \begin_layout Standard
1038 For labels placed to the left or to the right of the arrow this does not
1044 \begin_layout Plain Layout
1053 -pic code such as e.
1054 \begin_inset space \thinspace{}
1074 is not correctly interpreted by LyX's math editor.
1075 Two workarounds are suggested in the last section of this note.
1078 \begin_layout Subsection
1082 \begin_layout Standard
1083 Modification of the design, the form or the positioning of arrows are introduced
1089 This is followed by a pair of matching brackets, where the form of the
1102 indicates, whether we want to modify the design, the or the curvature of
1104 Various modifactions can be applied to an arrow at the same time.
1107 \begin_layout Subsubsection
1111 \begin_layout Standard
1112 Various designs such as
1128 are possible for the shaft of an arrow.
1129 These can be combined with various ends and various tips.
1130 In general, the design of an arrow is described by following the command
1141 -sign and a pair of braces {\SpecialChar \ldots{}
1142 } containing characters describing the end,
1143 the shaft and the tip of the arrow.
1144 These characters are chosen to give some form of ASCII-rendering of the
1152 produces an arrow with split end, a dotted shaft and double head.
1153 A number of other arrow designs is given in the table below.
1154 Note that the ends of embedding arrows
1155 \begin_inset Formula $\xymatrix{A\ar@{^{(}->}[r] & B}
1159 are described by raising or lowering opening parentheses, such as in
1164 \begin_inset Newline newline
1170 \begin_layout Standard
1171 \begin_inset Tabular
1172 <lyxtabular version="3" rows="11" columns="2">
1173 <features islongtable="true">
1174 <column alignment="center" valignment="top" width="0">
1175 <column alignment="center" valignment="top" width="0">
1177 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1180 \begin_layout Plain Layout
1186 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1189 \begin_layout Plain Layout
1197 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1200 \begin_layout Plain Layout
1201 \begin_inset Formula \xymatrix{\ \ar[r] & \ }
1211 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1214 \begin_layout Plain Layout
1226 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1229 \begin_layout Plain Layout
1230 \begin_inset Formula \xymatrix{\ \ar@{-->}[r] & \ }
1240 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1243 \begin_layout Plain Layout
1255 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1258 \begin_layout Plain Layout
1259 \begin_inset Formula \xymatrix{\ \ar@{..>}[r] & \ }
1269 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1272 \begin_layout Plain Layout
1284 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1287 \begin_layout Plain Layout
1288 \begin_inset Formula \xymatrix{\ \ar@{~>}[r] & \ }
1298 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1301 \begin_layout Plain Layout
1313 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1316 \begin_layout Plain Layout
1317 \begin_inset Formula \xymatrix{\ \ar@{->>}[r] & \ }
1327 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1330 \begin_layout Plain Layout
1342 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1345 \begin_layout Plain Layout
1346 \begin_inset Formula \xymatrix{\ \ar@{-->>}[r] & \ }
1356 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1359 \begin_layout Plain Layout
1371 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1374 \begin_layout Plain Layout
1375 \begin_inset Formula \xymatrix{\ \ar@{>->>}[r] & \ }
1385 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1388 \begin_layout Plain Layout
1400 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1403 \begin_layout Plain Layout
1404 \begin_inset Formula \xymatrix{\ \ar@{_{(}->}[r] & \ }
1414 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1417 \begin_layout Plain Layout
1429 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1432 \begin_layout Plain Layout
1433 \begin_inset Formula \xymatrix{\ \ar@{^{(}->}[r] & \ }
1443 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1446 \begin_layout Plain Layout
1458 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1461 \begin_layout Plain Layout
1462 \begin_inset Formula \xymatrix{\ \ar@{|-|}[r] & \ }
1472 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1475 \begin_layout Plain Layout
1493 \begin_layout Standard
1495 Following the @-character by either a 2, 3, _,or a ^, we can produce arrows
1496 with double, triple shaft or arrows showing only the lower or upper half
1497 of their tips and ends.
1498 Arrows need not have tips nor ends, as the last example shows :
1499 \begin_inset Newline newline
1505 \begin_layout Standard
1506 \begin_inset Tabular
1507 <lyxtabular version="3" rows="8" columns="2">
1508 <features islongtable="true">
1509 <column alignment="center" valignment="top" width="0">
1510 <column alignment="center" valignment="top" width="0">
1512 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1515 \begin_layout Plain Layout
1521 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1524 \begin_layout Plain Layout
1532 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1535 \begin_layout Plain Layout
1536 \begin_inset Formula \xymatrix{\ \ar@2[r] & \ }
1546 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1549 \begin_layout Plain Layout
1561 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1564 \begin_layout Plain Layout
1565 \begin_inset Formula \xymatrix{\ \ar@3[r] & \ }
1575 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1578 \begin_layout Plain Layout
1590 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1593 \begin_layout Plain Layout
1594 \begin_inset Formula \xymatrix{\ \ar@_{->}[r] & \ }
1604 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1607 \begin_layout Plain Layout
1619 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1622 \begin_layout Plain Layout
1623 \begin_inset Formula \xymatrix{\ \ar@^{->}[r] & \ }
1633 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1636 \begin_layout Plain Layout
1648 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1651 \begin_layout Plain Layout
1652 \begin_inset Formula \xymatrix{\ \ar@^{>>->>}[r] & \ }
1662 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1665 \begin_layout Plain Layout
1677 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1680 \begin_layout Plain Layout
1681 \begin_inset Formula \xymatrix{\ \ar@{^{<}-_{>}}[r] & \ }
1691 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1694 \begin_layout Plain Layout
1706 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1709 \begin_layout Plain Layout
1710 \begin_inset Formula \xymatrix{\ \ar@2{--}[r] & \ }
1720 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1723 \begin_layout Plain Layout
1741 \begin_layout Subsubsection
1742 Designing your own arrows
1745 \begin_layout Standard
1746 Within certain limits there is even a way to design your own arrows.
1747 Using some the characters
1751 one can even design one's own arrow tips using the
1757 command in the preample.
1758 For explanations, we refer to the
1764 \begin_layout Plain Layout
1775 -manual, from which we take the example:
1778 \begin_layout Standard
1783 newdir{|>}{!/4.5pt/@{|}*:(1,-.2)@^{>}*:(1,+.2)@_{>}}
1788 \begin_layout Standard
1790 This defines a new arrow tip, referred to as
1800 and which displays correctly in LyX as:
1801 \begin_inset Formula \[
1802 \xymatrix{A\ar@{-|>}[r] & \ \ B}
1810 \begin_layout Subsection
1814 \begin_layout Standard
1815 Arrows are shifted sideways with the modifier
1820 \begin_inset Formula $\ldots$
1827 where the ellipsis is replaced by a positive or negative measure.
1828 For instance, to design a pair of mutually opposing arrows between two
1829 nodes, we shift them to see them apart.
1830 Note that the direction of the shift (positive) is to the left if one looks
1835 \begin_layout Standard
1851 \begin_layout Standard
1854 \begin_inset space ~
1858 \begin_inset space ~
1862 \begin_inset Formula \[
1863 \xymatrix{\circ\ar@<1ex>[r] & \circ\ar@<1ex>[l]}
1872 \begin_layout Subsubsection
1873 Inline or centered diagrams
1876 \begin_layout Standard
1877 Arrows and diagrams can be used inline, such as this one:
1878 \begin_inset Formula $\xymatrix{\circ\ar@<1ex>[r] & \circ\ar@<1ex>[l]}
1883 When their code is written inside LyX as above, select it and choose either
1888 for inline appearence or
1893 Diagrams constructed inline can later be centered, or, conversely, centered
1894 diagrams can be changed to inline formulas with
1896 Edit\SpecialChar \menuseparator
1901 \SpecialChar \menuseparator
1905 \begin_layout Subsection
1909 \begin_layout Standard
1910 There are two simple methods to make arrows bend.
1911 The first is giving an explicit value by which the midpoint of the arrow's
1912 shaft is raised or depressed, the other is by forcing the arrow to leave
1913 its origin in a prescribed compass direction and to make him enter the
1914 target at another direction.
1915 The necessary bending of the arrow is determined automatically.
1916 We describe both methods.
1919 \begin_layout Subsubsection
1923 \begin_layout Standard
1924 For bending arrows we use the modifier @/
1925 \begin_inset Formula $\ldots$
1929 The ellipsis stands for a TeX-measure which needs to be entered as a lower
1935 , we could simply write, e.
1936 \begin_inset space \thinspace{}
1946 for an arrow bending
1950 downwards, this cannot directly be done in LyX.
1951 It is necessary, to enclose the measure in a pair of braces, such as e.
1952 \begin_inset space \thinspace{}
1963 As an example, here are two opposing arrows between
1964 \begin_inset Formula $A$
1968 \begin_inset Formula $B$
1971 , each bending by .5 pica, given by the following source code:
1974 \begin_layout Standard
1986 \begin_layout Standard
1987 \begin_inset Formula \[
1988 \xymatrix{A\ar@/{}_{.5pc}/[r] & B\ar@/{}_{.5pc}/[l]}
1996 \begin_layout Subsubsection
1997 Specifying exit- and entrance directions.
2001 \begin_layout Standard
2002 An alternative for making arrows bend is by specifying their compass direction
2003 as they are leaving their source and their direction from which they enter
2005 Instead of north, north-east, east, etc., the directions are named
2037 , standing for up, up-right, right, down-right, etc..
2038 A direction is specified as @(
2050 stands for the direction the first object is left and
2054 stands for the direction from which the target is entered.
2055 As an example, we show some bending arrows and a loop, which arises when
2056 we do not specify a target for an arrow, just its incoming and outgoing
2060 \begin_layout Standard
2061 \begin_inset Formula \[
2062 \xymatrix{A\ar@(dr,dl)[r]\ar@(dr,dl)[rr] & B\ar@(d,r)[dl] & C\\
2071 \begin_layout LyX-Code
2079 \begin_inset Newline newline
2089 \begin_inset Newline newline
2097 \begin_layout Subsection
2101 \begin_layout Standard
2102 The above example is reminiscent of an automata diagram, except that in
2103 such a diagram states would be enclosed in small circles, with double circles
2104 denoting final states.
2108 \begin_layout Subsubsection
2112 \begin_layout Standard
2117 \begin_layout Plain Layout
2126 -Pic, entries can obtain a single or a double frame, such as
2127 \begin_inset Formula $\xymatrix{*+[F]{A}}
2132 \begin_inset Formula $\xymatrix{*+[F=]{B}}
2136 by prefixing an entry with
2144 and enclosing the portion of the entry to be framed in braces.
2145 Normally, the frame will be very tight so that it must be widened by prefixing
2155 Round frames, such as
2156 \begin_inset Formula $\xymatrix{*++[o][F]{A}}
2161 \begin_inset Formula $\xymatrix{*++[o][F=]{B}}
2165 are obtained by specifying the shape as
2170 So the latter figure was constructed as *++[o][F=]{B}.
2171 This way, the following automaton
2174 \begin_layout Standard
2175 \begin_inset Formula \[
2176 \xymatrix{\txt{start}\ar[r] & *++[o][F]{1}\ar[r] & *++[o][F=]{2}\ar@(ur,dr)\ar@(ur,ul)[l]}
2184 \begin_layout Standard
2188 \begin_layout Plain Layout
2200 \begin_layout LyX-Code
2210 \begin_layout LyX-Code
2216 \begin_layout LyX-Code
2224 \begin_layout LyX-Code
2228 \begin_layout Standard
2235 \SpecialChar \ldots{}
2240 will make a certain entry style the default, that can, of course be overridden
2241 for individual entries.
2246 entrymodifiers={++[o][F-]}
2248 , all following entries inside
2252 \begin_layout Plain Layout
2261 -matrices would be encircled.
2264 \begin_layout Subsubsection
2268 \begin_layout Standard
2269 Framing a whole rectangle inside an xymatrix is done with the macro pair
2289 The dimension of the rectangle is given as a dotted pair
2290 \begin_inset Formula $P_{0}.P_{1}$
2293 of points denoting the top left and lower right corners of the rectangle.
2294 Each point, in turn,is given as a doubly quoted comma separated pair
2295 \begin_inset Quotes eld
2299 \begin_inset Formula $x,y$
2303 \begin_inset Quotes erd
2307 \begin_inset Formula $x$
2311 \begin_inset Formula $y$
2315 These are followed by the framing commands, to produce figures such as
2317 \begin_inset Formula \[
2318 \xymatrix{A & B\ar@(d,r)[dl]\sp(0.2)\phi\sp(0.7)\psi\save"1,1"."2,1"*+[F=]\frm{}\restore\,\\
2319 C & \save"1,1"."1,2"*++[F]\frm{}\restore}
2335 save"1,1"."2,1"*+[F=]
2348 produces the doubly framed rectangle, and the code for the extra wide horizonta
2360 save"1,1"."1,2"*++[F]
2374 This code can be placed in arbitrary cells of the xymatrix.
2378 \begin_layout Section
2379 Using LyX's math editor
2380 \begin_inset CommandInset label
2382 name "sec:math-editor"
2389 \begin_layout Standard
2390 As an alternative to writing the
2394 code, then transforming it into a math-editing environment by marking it
2403 , one may construct and modify the whole xypic-diagram inside LyX's math
2405 We describe the editing steps for a figure just like the one above.
2409 \begin_layout Subsection
2410 Caveat - how to enter braces
2413 \begin_layout Standard
2414 Recall that in LyX's math-editor any pair of braces
2422 that are to enclose a macro-parameter must be entered by typing just
2429 The closing brace is automatically supplied and in between a box into which
2430 to the parameter is entered.
2435 \begin_layout Plain Layout
2444 -diagrams, this applies in particular to arrow modifications that are normally
2449 \SpecialChar \ldots{}
2454 with the ellipsis standing for the description of end, shaft and tip of
2456 Inside the math-editor, enter just
2462 and let LyX provide the closing brace and the box into which to enter the
2463 description of the arrow.
2466 \begin_layout Standard
2467 Braces that are entered without the backslash
2473 will just appear as typed, but cannot be used to receive a macro parameter.
2474 They are useful, for instance to denote sets, e.
2475 \begin_inset space \thinspace{}
2490 \begin_inset Formula $\{x\in X\mid x\notin x\}$
2496 \begin_layout Subsection
2497 Setting up the matrix
2500 \begin_layout Standard
2509 open a formula environment and enter:
2517 \begin_inset Formula $\times$
2524 \begin_layout Plain Layout
2534 Add extra rows by typing
2538 and add columns by typing
2544 \begin_layout Standard
2545 At any time, further rows or columns can be entered or deleted using commands
2548 Edit\SpecialChar \menuseparator
2552 their shortcuts, beginning with
2556 for the column commands or
2560 for the row commands.
2564 \begin_layout Subsection
2565 Entering nodes, arrows and labels
2568 \begin_layout Standard
2569 Type the nodes into the correct positions of the matrix.
2570 If you move the cursor out of the matrix, you should see a first rendering
2572 Next, add the arrows at the nodes from where they should emanate by typing
2589 can be any path made up from the characters
2606 Make sure that the path indeed leads to an existing node within the matrix.
2607 Otherwise, the figure will not display when the cursor leaves the editing
2611 \begin_layout Standard
2612 Next, label the arrows by attaching a label text as upper or lower indices
2613 to the end of the arrow's path.
2614 As always in LyX's math editor, an underscore
2618 opens a box for a lower index and a
2622 followed by a space opens a box for an upper index.
2623 You can enter any LaTeX-code as a label.
2627 \begin_layout Subsection
2631 \begin_layout Standard
2632 Finally, you can modify the appearance of the arrows by entering @-modifiers
2637 \SpecialChar \ldots{}
2646 \SpecialChar \ldots{}
2651 \SpecialChar \ldots{}
2652 ,\SpecialChar \ldots{}
2657 \SpecialChar \ldots{}
2663 The above caveat applies to the first form only.
2664 It must be entered as
2670 with the arrow description entered inside the LyX-supplied box.
2671 If this box remains empty, you have specified an empty arrow.
2672 This is a useful construction, too, as you will see in the next section.
2676 \begin_layout Standard
2677 The other modifiers,
2681 \SpecialChar \ldots{}
2690 \SpecialChar \ldots{}
2691 ,\SpecialChar \ldots{}
2700 \SpecialChar \ldots{}
2705 are typed as shown with the arrow description replacing the ellipsis.
2706 The code for bending arrows, which in
2739 \begin_layout Plain Layout
2748 -measure that should be entered as upper or lower index to the first slash
2750 Make sure that the ending slash does not end up being part of the upper
2754 \begin_layout Subsection
2755 What if something goes wrong
2758 \begin_layout Standard
2759 When constructing a diagram, you should at times check it by just moving
2760 the cursor out of the editing area to see whether instant preview can successfu
2761 lly convert it into graphical output.
2762 If this does not happen, it may either be that instant preview for some
2763 reason is not aware that it should retranslate the graphics.
2764 Moving the cursor into the editing area and out again sometimes wakes up
2768 \begin_layout Standard
2769 A more serious reason could be a syntactical error in your input.
2770 If necessary, redo the last editing steps, using
2774 , or try to translate the
2778 \begin_layout Plain Layout
2797 View\SpecialChar \menuseparator
2801 There should be some error generated, which hopefully gives you a hint
2802 as to the source of the mistake.
2805 \begin_layout Section
2809 \begin_layout Standard
2810 Certain things do not work correctly inside
2814 \begin_layout Plain Layout
2824 The ones that we (used to) miss most are the horizontal and vertical scaling
2825 of diagrams, and the correct positioning of arrows.
2826 There are some workarounds that we are explaining here.
2830 \begin_layout Subsection
2831 Horizontal and vertical scaling
2834 \begin_layout Standard
2835 It is often convenient to stretch the horizontal or the vertical dimensions
2836 of an entire diagram by using spacing commands for rows and/or columns.
2841 \begin_layout Plain Layout
2850 -manual, for instance,
2856 \SpecialChar \ldots{}
2865 \begin_layout Plain Layout
2874 -matrix with row spacing of 1 pica.
2881 \SpecialChar \ldots{}
2886 \SpecialChar \ldots{}
2891 allows to modify the space between columns.
2892 Unfortunately, these commands do currently not work inside LyX, as the
2893 @-character is interpreted by LyX as ending the
2897 \begin_layout Plain Layout
2910 \begin_layout Standard
2915 \begin_layout Plain Layout
2925 \begin_inset space ~
2928 stores the values for row-spacing and column-spacing in the variables
2940 , add the following macro to the preamble (
2942 Layout\SpecialChar \menuseparator
2943 Document\SpecialChar \menuseparator
2947 \begin_inset Newpage pagebreak
2953 \begin_layout LyX-Code
2961 \begin_layout LyX-Code
2966 xymatrixrowsep@{#1}}
2969 \begin_layout LyX-Code
2973 \begin_layout Standard
2980 can be defined correspondingly by replacing
2993 Now, a figure can be scaled by entering
2999 \begin_layout Plain Layout
3009 Place the cursor inside the matrix, just before the first entry.
3027 Dont't forget the backslashes and remember, that the closing brace is automatic
3028 ally supplied by LyX.
3029 Inside the braces enter the dimensions.
3035 Here you see a diagram which is squashed vertically and stretched horizontally
3047 \begin_layout Standard
3048 \begin_inset Formula \[
3049 \xyC{.5pc}\xyC{9pc}\xymatrix{A\ar[r]\ar[d] & B\\
3050 C\ar@{}[ur]|{\text{{horizontal stretch}}}}
3058 \begin_layout Subsection
3062 \begin_layout Standard
3067 \begin_layout Plain Layout
3076 -vcommand allows the correct positioning of labels along the shaft of arrows.
3077 This feature is sometimes necessary, when the default position of a label
3078 would otherwise clutter the picture, or would even coincide with other
3079 items, such as the intersection of the arrows in the figure below.
3080 In order to shift a label position alongside the shaft of an arrow,
3084 \begin_layout Plain Layout
3094 \begin_inset space ~
3097 allows to prefix the label by a decimal number in parentheses, specifying
3098 the fraction of distance alongside the arrow where the label is to be placed.
3099 For instance, the code
3107 , will place the label on the shaft, but only about one third of the way.
3111 \begin_layout Standard
3112 Doing the same with labels above or below arrows as
3128 , does not work from inside LyX.
3129 Instead, one has to replace the hat-symbol ^, resp.
3130 the underscore _ , by the macros
3164 It is, in fact, possible to enter several labels this way and those labels
3165 are placed correctly, even if the arrow bends.
3166 In the following figure, the bending arrow with its four labels has been
3190 \begin_layout Standard
3191 \begin_inset Formula \[
3192 \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}}\\
3193 \circ\ar[ur]\sb(0.3)\phi & \bullet}
3201 \begin_layout Subsection
3202 Invisible stretched arrows
3205 \begin_layout Standard
3206 A more general trick uses invisible arrows to place any object almost anywhere
3208 Produce an invisible arrow, shorten (or prolong) it past its goal by adding
3209 a decimal stretching ratio, e.
3210 \begin_inset space \thinspace{}
3223 Attach a label to this invisible arrow.
3227 \begin_layout Standard
3228 Thus, the down pointing arrow with its label
3229 \begin_inset Formula $\varphi$
3232 at (0.3) of its way along the shaft might as well have been produced by
3233 adding to the regular arrow
3240 \begin_inset Formula $\varphi$
3251 , reaching only 0.6 of the way.
3252 Its label will now appear at 0.3 of the way of the original visible arrow.
3256 \begin_layout Standard
3257 This workaround has two minor drawbacks: First, it does not work with bending
3259 Secondly, prolonging an invisible arrow beyond the normal dimension of
3260 the figure will invisibly extend the figure box, and thereby cause too
3261 much vertical space between the figure and the preceding or the following
3266 \begin_layout Standard
3267 Nevertheless, invisible arrows are an important tool, since they can, in
3268 principle, be used to place information at any chosen place in a diagram.
3269 In the above figure, for instance, we have used an invisible arrow to carry
3276 as label and at the earlier figure we had used an invisible arrow to carry
3278 \begin_inset Quotes eld
3286 \begin_inset Quotes erd
3289 into the center of the figure.
3292 \begin_layout Subsection
3299 \begin_layout Plain Layout
3313 \begin_layout Standard
3314 Here we have focused only on the
3320 command, which is just one of the features available in Kris Rose's amazing
3326 \begin_layout Plain Layout
3344 \begin_layout Plain Layout
3356 \begin_inset CommandInset citation
3362 demonstrates many of the advanced possibilities of that package.
3363 Beware, that its style is rather terse and you will likely need a lot of
3364 experimenting and modifying the many worked examples.
3366 \begin_inset CommandInset citation
3376 \begin_layout Plain Layout
3385 -pic to make braids, cobordism, string diagrams, and much more.
3386 A good and rather systematic introduction to
3392 \begin_layout Plain Layout
3404 \begin_inset CommandInset citation
3411 Even if you share with me the disadvantage of not being fluent in Esperanto,
3412 you will be able to understand most of it.
3416 \begin_layout Bibliography
3417 \begin_inset CommandInset bibitem
3418 LatexCommand bibitem
3429 \begin_layout Plain Layout
3445 Available as part of the
3453 \begin_layout Bibliography
3454 \begin_inset CommandInset bibitem
3455 LatexCommand bibitem
3457 key "instant-preview"
3462 \begin_inset Flex URL
3465 \begin_layout Plain Layout
3467 http://www.tug.org/tex-archive/help/Catalogue/entries/preview-latex.html
3475 \begin_layout Bibliography
3476 \begin_inset CommandInset bibitem
3477 LatexCommand bibitem
3484 \begin_inset Flex URL
3487 \begin_layout Plain Layout
3489 http://www.tug.org/tex-archive/help/Catalogue/entries/xypic.html
3497 \begin_layout Bibliography
3498 \begin_inset CommandInset bibitem
3499 LatexCommand bibitem
3506 \begin_inset Flex URL
3509 \begin_layout Plain Layout
3511 http://www.gnu.org/software/auctex/
3519 \begin_layout Bibliography
3520 \begin_inset CommandInset bibitem
3521 LatexCommand bibitem
3531 \begin_layout Plain Layout
3546 tutorial with an archive of examples
3549 \begin_inset Flex URL
3552 \begin_layout Plain Layout
3554 http://www.dpmms.cam.ac.uk/~al366/xytutorial.html
3562 \begin_layout Bibliography
3563 \begin_inset CommandInset bibitem
3564 LatexCommand bibitem
3574 \begin_layout Plain Layout
3589 Enkonduko pri Xymatrix
3593 \begin_inset Flex URL
3596 \begin_layout Plain Layout
3598 http://filip.ouvaton.org/xypic/xymatrix/index.html