1 #LyX 1.6.5svn created this file. For more info see http://www.lyx.org/
10 % define new commands used in sec. 5.1
12 \xydef@\xymatrixrowsep@{#1}}
14 \xydef@\xymatrixcolsep@{#1}}
16 \newdir{|>}{!/4.5pt/@{|}*:(1,-.2)@^{>}*:(1,+.2)@_{>}}
18 % a pdf-bookmark for the TOC is added
19 \let\myTOC\tableofcontents
20 \renewcommand\tableofcontents{%
21 \pdfbookmark[1]{\contentsname}{}
24 % redefine the \LyX macro for PDF bookmarks
25 \def\LyX{\texorpdfstring{%
26 L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}
30 \use_default_options false
35 \font_typewriter default
36 \font_default_family default
46 \pdf_title "Using XY-pc in LyX"
47 \pdf_author "H. Peter Gumm"
48 \pdf_subject "LyX's XY-pic manual"
49 \pdf_keywords "LyX, documentation"
51 \pdf_bookmarksnumbered true
52 \pdf_bookmarksopen true
53 \pdf_bookmarksopenlevel 2
58 \pdf_pdfusetitle false
59 \pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue,pdfpagelayout=OneColumn, pdfnewwindow=true,pdfstartview=XYZ, plainpages=false, pdfpagelabels"
66 \paperorientation portrait
69 \paragraph_separation indent
71 \quotes_language english
74 \paperpagestyle default
75 \tracking_changes false
88 \begin_layout Plain Layout
105 \begin_layout Abstract
106 With the recent versions of LyX and with the
110 -style installed in the LaTeX-System, the graph drawing package
116 \begin_layout Plain Layout
127 -Pic can be conveniently used inside LyX.
128 Diagrams can be edited and displayed inside the main LyX editing window.
129 Here, we shall describe how to use the
139 inside LyX in order to draw, to edit and to preview diagrams as typically
140 used in category theory, algebra, and related fields.
144 \begin_layout Abstract
145 \begin_inset CommandInset toc
146 LatexCommand tableofcontents
153 \begin_layout Section
157 \begin_layout Standard
162 -package has long served as a convenient tool for easily constructing graphs
163 and diagrams in LaTeX.
164 Unfortunately, its use in LyX had long been restricted to the infamous
165 TeX code boxes, meaning that the LyX editor could only display the LaTeX-source
166 and not the finished diagram.
171 -style of LaTeX which is part of the AUCTeX project
172 \begin_inset CommandInset citation
178 , finally enables the editing and displaying of
182 -diagrams, constructed, displayed and interactively edited inside LyX.
185 \begin_layout Standard
186 \begin_inset VSpace defskip
192 \begin_layout Standard
194 \begin_inset Graphics
195 filename xyfigure.png
197 BoundingBox 0bp 0bp 580bp 440bp
205 \begin_layout Standard
206 \begin_inset VSpace defskip
212 \begin_layout Standard
213 In this note, we describe how
217 \begin_layout Plain Layout
226 -pic can be used from inside LyX, how diagrams can be created and edited.
227 We have tested the following using LyX versions 1.3.7 up to 1.6, running under
229 \begin_inset space \thinspace{}
232 XP and under Windows Vista.
236 \begin_layout Standard
237 There are two modes of operations: For a start, and for some first tests,
238 it may be easiest to first enter the
242 \begin_layout Plain Layout
251 -Pic code inside the LyX-window, select it all and convert it to a graphical
252 representation by pressing
265 \begin_layout Plain Layout
274 -Pic more frequently, or if you want to modify your initial figure, you
275 will want to assemble and modify your figures using LyX's math editor.
279 \begin_layout Standard
280 Once the cursor is moved over a diagram, this is displayed as an array of
281 nodes and arrow-commands.
282 These can be changed interactively.
283 When the cursor leaves the editing area, the diagram reappears.
287 \begin_layout Standard
288 In the first two sections of this documentation, we explain how to use LyX
289 in the first mentioned mode and we introduce all
293 \begin_layout Plain Layout
302 -Pic features that might be of use for drawing commutative diagrams, graphs
305 \begin_inset CommandInset ref
307 reference "sec:math-editor"
311 explains how to use the
315 \begin_layout Plain Layout
324 -Pic commands inside a math-editing area.
328 \begin_layout Standard
329 It is not our intention to write another introduction to
333 \begin_layout Plain Layout
342 -Pic, rather our motivation is to give an introduction how the most important
343 commands work inside LyX, since the keystrokes as explained in the
347 \begin_layout Plain Layout
357 \begin_inset CommandInset citation
363 will not always function correctly inside LyX.
367 \begin_layout Section
371 \begin_layout Standard
372 The following requires that the LaTeX-packages
380 are installed in the LaTeX system.
381 They are available from CTAN, see at
382 \begin_inset CommandInset citation
384 key "instant-preview"
390 \begin_inset CommandInset citation
397 After freshly installing them, it may be necessary, to run
399 Edit\SpecialChar \menuseparator
402 from the main LyX menu.
403 The steps to a first diagram output in LyX are then:
406 \begin_layout Enumerate
413 \begin_layout Enumerate
416 Edit\SpecialChar \menuseparator
417 Preferences\SpecialChar \menuseparator
418 Look and Feel\SpecialChar \menuseparator
428 \begin_layout Enumerate
431 Document\SpecialChar \menuseparator
432 Settings\SpecialChar \menuseparator
441 Use AMS Math package automatically
450 \begin_layout Enumerate
455 works by opening a LyX-document and entering any math-formula, e.
456 \begin_inset space \thinspace{}
461 \begin_inset Formula $a+b=c$
468 \begin_layout Enumerate
469 Move the cursor out of the formula, and watch it change its appearance to
470 look just like in the finished DVI- or PostScript document.
475 \begin_layout Enumerate
480 \begin_layout Plain Layout
495 \begin_layout Enumerate
496 Inside your LyX-Document, enter the text
499 \begin_inset Newline newline
511 \begin_layout Enumerate
512 Select the whole text and choose
514 Insert\SpecialChar \menuseparator
515 Math\SpecialChar \menuseparator
518 , or use the corresponding keyboard shortcut
526 \begin_layout Enumerate
527 Move the mouse cursor out of the editing box and wait for a split second
528 to see an arrow appear:
529 \begin_inset Formula $\xymatrix{A\ar[r] & B}
537 \begin_layout Section
541 \begin_layout Standard
542 The following diagram, which is taken from the documentation of
546 \begin_layout Plain Layout
556 \begin_inset CommandInset citation
562 by its creator Kristoffer H.
563 Rose, will provide an example for many of the features available with that
568 \begin_layout LyX-Code
572 \begin_inset Newline newline
584 \begin_inset Newline newline
594 \begin_inset Newline newline
610 \begin_inset Newline newline
618 \begin_layout LyX-Code
622 \begin_layout Standard
623 Again, to turn this code into a graphical output, select it all at once
630 \SpecialChar \ldots{}
631 up to the closing brace \SpecialChar \ldots{}
636 and turn it into display-math as explained above.
637 A moment after the cursor leaves the math-area, you should see the diagram
638 in its full graphical glory as shown below.
642 \begin_layout Standard
643 \begin_inset Formula $\xymatrix{U\ar@/_{1pc}/[ddr]_{\psi}\ar@/{}^{1pc}/[drr]^{\varphi}\ar@{.>}[dr]|-{(x,y)}\\
644 & X\times_{Z}Y\ar[d]^{q}\ar[r]_{p} & X\ar[d]_{f}\\
652 \begin_layout Subsection
653 The matrix layout of diagrams
656 \begin_layout Standard
661 uses a matrix to define the layout of the vertices of a diagram.
662 For the above example, we need a
663 \begin_inset Formula $3\times3$
666 -matrix of which 5 entries are used for the vertices
667 \begin_inset Formula $U$
671 \begin_inset Formula $X\times_{Z}Y$
675 \begin_inset Formula $X$
679 \begin_inset Formula $Y$
683 \begin_inset Formula $Z$
686 , the other positions remaining empty.
687 In this case, the following matrix determines the layout:
690 \begin_layout LyX-Code
694 \begin_inset Newline newline
702 \begin_inset Newline newline
712 \begin_inset Newline newline
718 \begin_layout Standard
719 The pattern should be familiar from LaTeX: We see three rows, the first
720 two being terminated by the end-of-line-marker
729 Each line consists of entries, separated by the ampersand
737 \begin_layout Subsection
741 \begin_layout Standard
742 Having entered the vertices, we add arrows between them.
747 -command to produce an arrow is
753 , it is entered into the cell of the matrix where the arrow is to start.
754 The target of the arrow is defined by direction commands
771 These can be combined to a path and enclosed in square brackets.
772 As an example, the arrows from the vertex
773 \begin_inset Formula $U$
776 in the upper left corner down and right to the vertices
777 \begin_inset Formula $X\times_{Z}Y$
781 \begin_inset Formula $Y$
785 \begin_inset Formula $X$
788 are, respectively, defined as
807 Thus the above diagram with all arrows added becomes:
810 \begin_layout LyX-Code
814 \begin_inset Newline newline
828 \begin_inset Newline newline
844 \begin_inset Newline newline
852 \begin_layout Standard
853 \begin_inset Formula \xymatrix{ U \ar[ddr] \ar[drr] \ar[dr]\\
854 & X \times_{Z} Y \ar[d] \ar[r] & X \ar[d]\\
863 \begin_layout LyX-Code
867 \begin_layout LyX-Code
871 \begin_layout Subsection
875 \begin_layout Standard
876 Labels are attached to arrows by affixing them as upper or lower indices
892 defines an arrow going one cell down, two to the right and having the label
894 \begin_inset Formula $\varphi$
898 To attach a label below the arrow, make it a lower index as in
907 This explanation is correct only for arrows pointing to the right.
908 More precisely, imagine looking along the arrow in the direction it is
910 Then an upper index places a label to the left and a lower index places
912 Consequently, an arrow pointing from right to left, such as
923 \begin_inset Formula $\alpha$
927 \begin_inset Formula $\beta$
931 \begin_inset space \thinspace{}
935 \begin_inset space \space{}
939 \begin_inset Formula $\xymatrix{\ & \ \ar[l]_{\beta}^{\alpha}.}
943 Using the character | instead of ^ or _ , it is even possible to place the
944 label right onto the arrow, obscuring part of its shaft.
948 \begin_layout Standard
949 Normally, a label is placed halfway between an arrow's start and target
951 In the first diagram, the central arrow starting in
952 \begin_inset Formula $U$
956 \begin_inset Formula $(x,y)$
959 in the middle of the arrow's shaft, rather than in the middle between the
960 two objects it connects.
961 This is achieved by prefixing the label with a minus sign, here:
970 \begin_layout LyX-Code
974 \begin_inset Newline newline
992 \begin_inset Newline newline
1008 \begin_inset Newline newline
1016 \begin_layout LyX-Code
1017 \begin_inset Formula \xymatrix{ U \ar[ddr]_{\psi}\ar[drr]^{\varphi}\ar[dr]|-{(x,y)}\\
1018 & X \times_{Z} Y \ar[d]^{q} \ar[r]_{p} & X \ar[d]_{f}\\
1019 & Y \ar[r]^{g} & Z }
1027 \begin_layout Standard
1031 \begin_layout Plain Layout
1040 -pic normally permits labels to be shifted towards the tip or towards the
1041 start of an arrow by prefixing the label with a ratio, such as e.
1042 \begin_inset space \thinspace{}
1051 In LyX this works only for labels which are placed on top of the arrow,
1064 \begin_layout Standard
1065 For labels placed to the left or to the right of the arrow this does not
1071 \begin_layout Plain Layout
1080 -pic code such as e.
1081 \begin_inset space \thinspace{}
1101 is not correctly interpreted by LyX's math editor.
1102 Two workarounds are suggested in the last section of this note.
1105 \begin_layout Subsection
1109 \begin_layout Standard
1110 Modification of the design, the form or the positioning of arrows are introduced
1116 This is followed by a pair of matching brackets, where the form of the
1129 indicates, whether we want to modify the design, the or the curvature of
1131 Various modifications can be applied to an arrow at the same time.
1134 \begin_layout Subsubsection
1138 \begin_layout Standard
1139 Various designs such as
1155 are possible for the shaft of an arrow.
1156 These can be combined with various ends and various tips.
1157 In general, the design of an arrow is described by following the command
1168 -sign and a pair of braces {\SpecialChar \ldots{}
1169 } containing characters describing the end,
1170 the shaft and the tip of the arrow.
1171 These characters are chosen to give some form of ASCII-rendering of the
1179 produces an arrow with split end, a dotted shaft and double head.
1180 A number of other arrow designs is given in the table below.
1181 Note that the ends of embedding arrows
1182 \begin_inset Formula $\xymatrix{A\ar@{^{(}->}[r] & B}
1186 are described by raising or lowering opening parentheses, such as in
1191 \begin_inset Newline newline
1197 \begin_layout Standard
1198 \begin_inset Tabular
1199 <lyxtabular version="3" rows="11" columns="2">
1200 <features islongtable="true">
1201 <column alignment="center" valignment="top" width="0">
1202 <column alignment="center" valignment="top" width="0">
1204 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1207 \begin_layout Plain Layout
1213 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1216 \begin_layout Plain Layout
1224 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1227 \begin_layout Plain Layout
1228 \begin_inset Formula \xymatrix{\ \ar[r] & \ }
1238 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1241 \begin_layout Plain Layout
1253 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1256 \begin_layout Plain Layout
1257 \begin_inset Formula \xymatrix{\ \ar@{-->}[r] & \ }
1267 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1270 \begin_layout Plain Layout
1282 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1285 \begin_layout Plain Layout
1286 \begin_inset Formula \xymatrix{\ \ar@{..>}[r] & \ }
1296 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1299 \begin_layout Plain Layout
1311 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1314 \begin_layout Plain Layout
1315 \begin_inset Formula \xymatrix{\ \ar@{~>}[r] & \ }
1325 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1328 \begin_layout Plain Layout
1340 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1343 \begin_layout Plain Layout
1344 \begin_inset Formula \xymatrix{\ \ar@{->>}[r] & \ }
1354 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1357 \begin_layout Plain Layout
1369 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1372 \begin_layout Plain Layout
1373 \begin_inset Formula \xymatrix{\ \ar@{-->>}[r] & \ }
1383 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1386 \begin_layout Plain Layout
1398 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1401 \begin_layout Plain Layout
1402 \begin_inset Formula \xymatrix{\ \ar@{>->>}[r] & \ }
1412 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1415 \begin_layout Plain Layout
1427 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1430 \begin_layout Plain Layout
1431 \begin_inset Formula \xymatrix{\ \ar@{_{(}->}[r] & \ }
1441 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1444 \begin_layout Plain Layout
1456 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1459 \begin_layout Plain Layout
1460 \begin_inset Formula \xymatrix{\ \ar@{^{(}->}[r] & \ }
1470 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1473 \begin_layout Plain Layout
1485 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1488 \begin_layout Plain Layout
1489 \begin_inset Formula \xymatrix{\ \ar@{|-|}[r] & \ }
1499 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1502 \begin_layout Plain Layout
1520 \begin_layout Standard
1522 Following the @-character by either a 2, 3, _,or a ^, we can produce arrows
1523 with double, triple shaft or arrows showing only the lower or upper half
1524 of their tips and ends.
1525 Arrows need not have tips nor ends, as the last example shows :
1526 \begin_inset Newline newline
1532 \begin_layout Standard
1533 \begin_inset Tabular
1534 <lyxtabular version="3" rows="8" columns="2">
1535 <features islongtable="true">
1536 <column alignment="center" valignment="top" width="0">
1537 <column alignment="center" valignment="top" width="0">
1539 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1542 \begin_layout Plain Layout
1548 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1551 \begin_layout Plain Layout
1559 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1562 \begin_layout Plain Layout
1563 \begin_inset Formula \xymatrix{\ \ar@2[r] & \ }
1573 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1576 \begin_layout Plain Layout
1588 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1591 \begin_layout Plain Layout
1592 \begin_inset Formula \xymatrix{\ \ar@3[r] & \ }
1602 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1605 \begin_layout Plain Layout
1617 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1620 \begin_layout Plain Layout
1621 \begin_inset Formula \xymatrix{\ \ar@_{->}[r] & \ }
1631 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1634 \begin_layout Plain Layout
1646 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1649 \begin_layout Plain Layout
1650 \begin_inset Formula \xymatrix{\ \ar@^{->}[r] & \ }
1660 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1663 \begin_layout Plain Layout
1675 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1678 \begin_layout Plain Layout
1679 \begin_inset Formula \xymatrix{\ \ar@^{>>->>}[r] & \ }
1689 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1692 \begin_layout Plain Layout
1704 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1707 \begin_layout Plain Layout
1708 \begin_inset Formula \xymatrix{\ \ar@{^{<}-_{>}}[r] & \ }
1718 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1721 \begin_layout Plain Layout
1733 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1736 \begin_layout Plain Layout
1737 \begin_inset Formula \xymatrix{\ \ar@2{--}[r] & \ }
1747 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1750 \begin_layout Plain Layout
1768 \begin_layout Subsubsection
1769 Designing your own arrows
1772 \begin_layout Standard
1773 Within certain limits there is even a way to design your own arrows.
1774 Using some the characters
1778 one can even design one's own arrow tips using the
1784 command in the preamble.
1785 For explanations, we refer to the
1791 \begin_layout Plain Layout
1802 -manual, from which we take the example:
1805 \begin_layout Standard
1810 newdir{|>}{!/4.5pt/@{|}*:(1,-.2)@^{>}*:(1,+.2)@_{>}}
1815 \begin_layout Standard
1817 This defines a new arrow tip, referred to as
1827 and which displays correctly in LyX as:
1828 \begin_inset Formula \[
1829 \xymatrix{A\ar@{-|>}[r] & \ \ B}
1837 \begin_layout Subsection
1841 \begin_layout Standard
1842 Arrows are shifted sideways with the modifier
1847 \begin_inset Formula $\ldots$
1854 where the ellipsis is replaced by a positive or negative measure.
1855 For instance, to design a pair of mutually opposing arrows between two
1856 nodes, we shift them to see them apart.
1857 Note that the direction of the shift (positive) is to the left if one looks
1862 \begin_layout Standard
1878 \begin_layout Standard
1881 \begin_inset space ~
1885 \begin_inset space ~
1889 \begin_inset Formula \[
1890 \xymatrix{\circ\ar@<1ex>[r] & \circ\ar@<1ex>[l]}
1899 \begin_layout Subsubsection
1900 Inline or centered diagrams
1903 \begin_layout Standard
1904 Arrows and diagrams can be used inline, such as this one:
1905 \begin_inset Formula $\xymatrix{\circ\ar@<1ex>[r] & \circ\ar@<1ex>[l]}
1910 When their code is written inside LyX as above, select it and choose either
1915 for inline appearance or
1920 Diagrams constructed inline can later be centered, or, conversely, centered
1921 diagrams can be changed to inline formulas with
1923 Edit\SpecialChar \menuseparator
1928 \SpecialChar \menuseparator
1932 \begin_layout Subsection
1936 \begin_layout Standard
1937 There are two simple methods to make arrows bend.
1938 The first is giving an explicit value by which the midpoint of the arrow's
1939 shaft is raised or depressed, the other is by forcing the arrow to leave
1940 its origin in a prescribed compass direction and to make him enter the
1941 target at another direction.
1942 The necessary bending of the arrow is determined automatically.
1943 We describe both methods.
1946 \begin_layout Subsubsection
1950 \begin_layout Standard
1951 For bending arrows we use the modifier @/
1952 \begin_inset Formula $\ldots$
1956 The ellipsis stands for a TeX-measure which needs to be entered as a lower
1962 , we could simply write, e.
1963 \begin_inset space \thinspace{}
1973 for an arrow bending
1977 downwards, this cannot directly be done in LyX.
1978 It is necessary, to enclose the measure in a pair of braces, such as e.
1979 \begin_inset space \thinspace{}
1990 As an example, here are two opposing arrows between
1991 \begin_inset Formula $A$
1995 \begin_inset Formula $B$
1998 , each bending by .5 pica, given by the following source code:
2001 \begin_layout Standard
2013 \begin_layout Standard
2014 \begin_inset Formula \[
2015 \xymatrix{A\ar@/{}_{.5pc}/[r] & B\ar@/{}_{.5pc}/[l]}
2023 \begin_layout Subsubsection
2024 Specifying exit- and entrance directions
2027 \begin_layout Standard
2028 An alternative for making arrows bend is by specifying their compass direction
2029 as they are leaving their source and their direction from which they enter
2031 Instead of north, north-east, east, etc., the directions are named
2063 , standing for up, up-right, right, down-right, etc..
2064 A direction is specified as @(
2076 stands for the direction the first object is left and
2080 stands for the direction from which the target is entered.
2081 As an example, we show some bending arrows and a loop, which arises when
2082 we do not specify a target for an arrow, just its incoming and outgoing
2086 \begin_layout Standard
2087 \begin_inset Formula \[
2088 \xymatrix{A\ar@(dr,dl)[r]\ar@(dr,dl)[rr] & B\ar@(d,r)[dl] & C\\
2097 \begin_layout LyX-Code
2105 \begin_inset Newline newline
2115 \begin_inset Newline newline
2123 \begin_layout Subsection
2127 \begin_layout Standard
2128 The above example is reminiscent of an automata diagram, except that in
2129 such a diagram states would be enclosed in small circles, with double circles
2130 denoting final states.
2134 \begin_layout Subsubsection
2138 \begin_layout Standard
2143 \begin_layout Plain Layout
2152 -Pic, entries can obtain a single or a double frame, such as
2153 \begin_inset Formula $\xymatrix{*+[F]{A}}
2158 \begin_inset Formula $\xymatrix{*+[F=]{B}}
2162 by prefixing an entry with
2170 and enclosing the portion of the entry to be framed in braces.
2171 Normally, the frame will be very tight so that it must be widened by prefixing
2181 Round frames, such as
2182 \begin_inset Formula $\xymatrix{*++[o][F]{A}}
2187 \begin_inset Formula $\xymatrix{*++[o][F=]{B}}
2191 are obtained by specifying the shape as
2196 So the latter figure was constructed as *++[o][F=]{B}.
2197 This way, the following automaton
2200 \begin_layout Standard
2201 \begin_inset Formula \[
2202 \xymatrix{\txt{start}\ar[r] & *++[o][F]{1}\ar[r] & *++[o][F=]{2}\ar@(ur,dr)\ar@(ur,ul)[l]}
2210 \begin_layout Standard
2215 \begin_layout LyX-Code
2225 \begin_layout LyX-Code
2231 \begin_layout LyX-Code
2239 \begin_layout LyX-Code
2243 \begin_layout Standard
2250 \SpecialChar \ldots{}
2255 will make a certain entry style the default, that can, of course be overridden
2256 for individual entries.
2261 entrymodifiers={++[o][F-]}
2263 , all following entries inside
2267 \begin_layout Plain Layout
2276 -matrices would be encircled.
2279 \begin_layout Subsubsection
2283 \begin_layout Standard
2284 Framing a whole rectangle inside an xymatrix is done with the macro pair
2304 The dimension of the rectangle is given as a dotted pair
2305 \begin_inset Formula $P_{0}.P_{1}$
2308 of points denoting the top left and lower right corners of the rectangle.
2309 Each point, in turn,is given as a doubly quoted comma separated pair
2310 \begin_inset Quotes eld
2314 \begin_inset Formula $x,y$
2318 \begin_inset Quotes erd
2322 \begin_inset Formula $x$
2326 \begin_inset Formula $y$
2330 These are followed by the framing commands, to produce figures such as
2332 \begin_inset Formula \[
2333 \xymatrix{A & B\ar@(d,r)[dl]\sp(0.2)\phi\sp(0.7)\psi\save"1,1"."2,1"*+[F=]\frm{}\restore\,\\
2334 C & \save"1,1"."1,2"*++[F]\frm{}\restore}
2350 save"1,1"."2,1"*+[F=]
2363 produces the doubly framed rectangle, and the code for the extra wide horizonta
2375 save"1,1"."1,2"*++[F]
2389 This code can be placed in arbitrary cells of the xymatrix.
2393 \begin_layout Section
2394 Using LyX's math editor
2395 \begin_inset CommandInset label
2397 name "sec:math-editor"
2404 \begin_layout Standard
2405 As an alternative to writing the
2409 code, then transforming it into a math-editing environment by marking it
2418 , one may construct and modify the whole xypic-diagram inside LyX's math
2420 We describe the editing steps for a figure just like the one above.
2424 \begin_layout Subsection
2425 Caveat - how to enter braces
2428 \begin_layout Standard
2429 Recall that in LyX's math-editor any pair of braces
2437 that are to enclose a macro-parameter must be entered by typing just
2444 The closing brace is automatically supplied and in between a box into which
2445 to the parameter is entered.
2450 \begin_layout Plain Layout
2459 -diagrams, this applies in particular to arrow modifications that are normally
2464 \SpecialChar \ldots{}
2469 with the ellipsis standing for the description of end, shaft and tip of
2471 Inside the math-editor, enter just
2477 and let LyX provide the closing brace and the box into which to enter the
2478 description of the arrow.
2481 \begin_layout Standard
2482 Braces that are entered without the backslash
2488 will just appear as typed, but cannot be used to receive a macro parameter.
2489 They are useful, for instance to denote sets, e.
2490 \begin_inset space \thinspace{}
2505 \begin_inset Formula $\{x\in X\mid x\notin x\}$
2511 \begin_layout Subsection
2512 Setting up the matrix
2515 \begin_layout Standard
2524 open a formula environment and enter:
2532 \begin_inset Formula $\times$
2539 \begin_layout Plain Layout
2549 Add extra rows by typing
2553 and add columns by typing
2559 \begin_layout Standard
2560 At any time, further rows or columns can be entered or deleted using commands
2563 Edit\SpecialChar \menuseparator
2567 their shortcuts, beginning with
2571 for the column commands or
2575 for the row commands.
2579 \begin_layout Subsection
2580 Entering nodes, arrows and labels
2583 \begin_layout Standard
2584 Type the nodes into the correct positions of the matrix.
2585 If you move the cursor out of the matrix, you should see a first rendering
2587 Next, add the arrows at the nodes from where they should emanate by typing
2604 can be any path made up from the characters
2621 Make sure that the path indeed leads to an existing node within the matrix.
2622 Otherwise, the figure will not display when the cursor leaves the editing
2626 \begin_layout Standard
2627 Next, label the arrows by attaching a label text as upper or lower indices
2628 to the end of the arrow's path.
2629 As always in LyX's math editor, an underscore
2633 opens a box for a lower index and a
2637 followed by a space opens a box for an upper index.
2638 You can enter any LaTeX-code as a label.
2641 \begin_layout Subsection
2645 \begin_layout Standard
2646 Finally, you can modify the appearance of the arrows by entering @-modifiers
2651 \SpecialChar \ldots{}
2660 \SpecialChar \ldots{}
2665 \SpecialChar \ldots{}
2666 ,\SpecialChar \ldots{}
2671 \SpecialChar \ldots{}
2677 The above caveat applies to the first form only.
2678 It must be entered as
2684 with the arrow description entered inside the LyX-supplied box.
2685 If this box remains empty, you have specified an empty arrow.
2686 This is a useful construction, too, as you will see in the next section.
2690 \begin_layout Standard
2691 The other modifiers,
2695 \SpecialChar \ldots{}
2704 \SpecialChar \ldots{}
2705 ,\SpecialChar \ldots{}
2714 \SpecialChar \ldots{}
2719 are typed as shown with the arrow description replacing the ellipsis.
2720 The code for bending arrows, which in
2749 is any valid TeX-measure that should be entered as upper or lower index
2750 to the first slash /.
2751 Make sure that the ending slash does not end up being part of the upper
2755 \begin_layout Subsection
2756 What if something goes wrong
2759 \begin_layout Standard
2760 When constructing a diagram, you should at times check it by just moving
2761 the cursor out of the editing area to see whether instant preview can successfu
2762 lly convert it into graphical output.
2763 If this does not happen, it may either be that instant preview for some
2764 reason is not aware that it should retranslate the graphics.
2765 Moving the cursor into the editing area and out again sometimes wakes up
2769 \begin_layout Standard
2770 A more serious reason could be a syntactical error in your input.
2771 If necessary, redo the last editing steps, using
2775 , or try to translate the LyX-file into
2785 View\SpecialChar \menuseparator
2789 There should be some error generated, which hopefully gives you a hint
2790 as to the source of the mistake.
2793 \begin_layout Section
2797 \begin_layout Standard
2798 Certain things do not work correctly inside LyX.
2799 The ones that we (used to) miss most are the horizontal and vertical scaling
2800 of diagrams, and the correct positioning of arrows.
2801 There are some workarounds that we are explaining here.
2805 \begin_layout Subsection
2806 Horizontal and vertical scaling
2809 \begin_layout Standard
2810 It is often convenient to stretch the horizontal or the vertical dimensions
2811 of an entire diagram by using spacing commands for rows and/or columns.
2816 \begin_layout Plain Layout
2825 -manual, for instance,
2831 \SpecialChar \ldots{}
2840 \begin_layout Plain Layout
2849 -matrix with row spacing of 1 pica.
2856 \SpecialChar \ldots{}
2861 \SpecialChar \ldots{}
2866 allows to modify the space between columns.
2867 Unfortunately, these commands do currently not work inside LyX, as the
2868 @-character is interpreted by LyX as ending the
2872 \begin_layout Plain Layout
2885 \begin_layout Standard
2890 \begin_layout Plain Layout
2900 \begin_inset space ~
2903 stores the values for row-spacing and column-spacing in the variables
2915 , add the following macro to the preamble (
2917 Layout\SpecialChar \menuseparator
2918 Document\SpecialChar \menuseparator
2922 \begin_inset Newpage pagebreak
2928 \begin_layout LyX-Code
2936 \begin_layout LyX-Code
2941 xymatrixrowsep@{#1}}
2944 \begin_layout LyX-Code
2948 \begin_layout Standard
2955 can be defined correspondingly by replacing
2968 Now, a figure can be scaled by entering
2974 \begin_layout Plain Layout
2984 Place the cursor inside the matrix, just before the first entry.
3002 Don't forget the backslashes and remember, that the closing brace is automatica
3003 lly supplied by LyX.
3004 Inside the braces enter the dimensions.
3010 Here you see a diagram which is squashed vertically and stretched horizontally
3022 \begin_layout Standard
3023 \begin_inset Formula \[
3024 \xyC{.5pc}\xyC{9pc}\xymatrix{A\ar[r]\ar[d] & B\\
3025 C\ar@{}[ur]|{\text{{horizontal stretch}}}}
3033 \begin_layout Subsection
3037 \begin_layout Standard
3042 \begin_layout Plain Layout
3051 -command allows the correct positioning of labels along the shaft of arrows.
3052 This feature is sometimes necessary, when the default position of a label
3053 would otherwise clutter the picture, or would even coincide with other
3054 items, such as the intersection of the arrows in the figure below.
3055 In order to shift a label position alongside the shaft of an arrow,
3059 \begin_layout Plain Layout
3069 \begin_inset space ~
3072 allows to prefix the label by a decimal number in parentheses, specifying
3073 the fraction of distance alongside the arrow where the label is to be placed.
3074 For instance, the code
3082 , will place the label on the shaft, but only about one third of the way.
3086 \begin_layout Standard
3087 Doing the same with labels above or below arrows as
3103 , does not work from inside LyX.
3104 Instead, one has to replace the hat-symbol ^, resp.
3105 the underscore _ , by the macros
3139 It is, in fact, possible to enter several labels this way and those labels
3140 are placed correctly, even if the arrow bends.
3141 In the following figure, the bending arrow with its four labels has been
3165 \begin_layout Standard
3166 \begin_inset Formula \[
3167 \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}}\\
3168 \circ\ar[ur]\sb(0.3)\phi & \bullet}
3176 \begin_layout Subsection
3177 Invisible stretched arrows
3180 \begin_layout Standard
3181 A more general trick uses invisible arrows to place any object almost anywhere
3183 Produce an invisible arrow, shorten (or prolong) it past its goal by adding
3184 a decimal stretching ratio, e.
3185 \begin_inset space \thinspace{}
3198 Attach a label to this invisible arrow.
3202 \begin_layout Standard
3203 Thus, the down pointing arrow with its label
3204 \begin_inset Formula $\varphi$
3207 at (0.3) of its way along the shaft might as well have been produced by
3208 adding to the regular arrow
3215 \begin_inset Formula $\varphi$
3226 , reaching only 0.6 of the way.
3227 Its label will now appear at 0.3 of the way of the original visible arrow.
3231 \begin_layout Standard
3232 This workaround has two minor drawbacks: First, it does not work with bending
3234 Secondly, prolonging an invisible arrow beyond the normal dimension of
3235 the figure will invisibly extend the figure box, and thereby cause too
3236 much vertical space between the figure and the preceding or the following
3241 \begin_layout Standard
3242 Nevertheless, invisible arrows are an important tool, since they can, in
3243 principle, be used to place information at any chosen place in a diagram.
3244 In the above figure, for instance, we have used an invisible arrow to carry
3251 as label and at the earlier figure we had used an invisible arrow to carry
3253 \begin_inset Quotes eld
3261 \begin_inset Quotes erd
3264 into the center of the figure.
3267 \begin_layout Subsection
3274 \begin_layout Plain Layout
3288 \begin_layout Standard
3289 Here we have focused only on the
3295 command, which is just one of the features available in Kris Rose's amazing
3301 \begin_layout Plain Layout
3319 \begin_layout Plain Layout
3331 \begin_inset CommandInset citation
3337 demonstrates many of the advanced possibilities of that package.
3338 Beware, that its style is rather terse and you will likely need a lot of
3339 experimenting and modifying the many worked examples.
3341 \begin_inset CommandInset citation
3351 \begin_layout Plain Layout
3360 -pic to make braids, cobordism, string diagrams, and much more.
3361 A good and rather systematic introduction to
3367 \begin_layout Plain Layout
3379 \begin_inset CommandInset citation
3386 Even if you share with me the disadvantage of not being fluent in Esperanto,
3387 you will be able to understand most of it.
3391 \begin_layout Bibliography
3392 \begin_inset CommandInset bibitem
3393 LatexCommand bibitem
3404 \begin_layout Plain Layout
3420 Available as part of the
3428 \begin_layout Bibliography
3429 \begin_inset CommandInset bibitem
3430 LatexCommand bibitem
3432 key "instant-preview"
3437 \begin_inset Flex URL
3440 \begin_layout Plain Layout
3442 http://www.tug.org/tex-archive/help/Catalogue/entries/preview-latex.html
3450 \begin_layout Bibliography
3451 \begin_inset CommandInset bibitem
3452 LatexCommand bibitem
3459 \begin_inset Flex URL
3462 \begin_layout Plain Layout
3464 http://www.tug.org/tex-archive/help/Catalogue/entries/xypic.html
3472 \begin_layout Bibliography
3473 \begin_inset CommandInset bibitem
3474 LatexCommand bibitem
3481 \begin_inset Flex URL
3484 \begin_layout Plain Layout
3486 http://www.gnu.org/software/auctex/
3494 \begin_layout Bibliography
3495 \begin_inset CommandInset bibitem
3496 LatexCommand bibitem
3506 \begin_layout Plain Layout
3521 tutorial with an archive of examples
3524 \begin_inset Flex URL
3527 \begin_layout Plain Layout
3529 http://www.dpmms.cam.ac.uk/~al366/xytutorial.html
3537 \begin_layout Bibliography
3538 \begin_inset CommandInset bibitem
3539 LatexCommand bibitem
3549 \begin_layout Plain Layout
3564 Enkonduko pri Xymatrix
3568 \begin_inset Flex URL
3571 \begin_layout Plain Layout
3573 http://filip.ouvaton.org/xypic/xymatrix/index.html