1 #LyX 2.2 created this file. For more info see http://www.lyx.org/
5 \origin /systemlyxdir/examples/
8 % DO NOT ALTER THIS PREAMBLE!!!
10 % This preamble is designed to ensure that the file prints
11 % out as advertised. If you mess with this preamble,
12 % parts of this document may not print out as expected. If you
13 % have problems LaTeXing this file, please contact
14 % the documentation team
15 % email: lyx-docs@lists.lyx.org
19 % define new commands used in sec. 5.1
21 \xydef@\xymatrixrowsep@{#1}}
23 \xydef@\xymatrixcolsep@{#1}}
25 \newdir{|>}{!/4.5pt/@{|}*:(1,-.2)@^{>}*:(1,+.2)@_{>}}
27 % a pdf-bookmark for the TOC is added
28 \let\myTOC\tableofcontents
29 \renewcommand\tableofcontents{%
30 \pdfbookmark[1]{\contentsname}{}
33 % redefine the \LyX macro for PDF bookmarks
34 \def\LyX{\texorpdfstring{%
35 L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}
42 % set fonts for nicer pdf view
43 \IfFileExists{lmodern.sty}
44 {\usepackage{lmodern}}{}
46 \fi % end if pdflatex is used
49 \use_default_options false
50 \maintain_unincluded_children false
52 \language_package default
55 \font_roman "default" "default"
56 \font_sans "default" "default"
57 \font_typewriter "default" "default"
58 \font_math "auto" "auto"
59 \font_default_family default
60 \use_non_tex_fonts false
63 \font_sf_scale 100 100
64 \font_tt_scale 100 100
66 \default_output_format default
68 \bibtex_command default
69 \index_command default
73 \pdf_title "Using XY-pc in LyX"
74 \pdf_author "H. Peter Gumm"
75 \pdf_subject "LyX's XY-pic manual"
76 \pdf_keywords "LyX, documentation"
78 \pdf_bookmarksnumbered true
79 \pdf_bookmarksopen true
80 \pdf_bookmarksopenlevel 2
85 \pdf_pdfusetitle false
86 \pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue,pdfpagelayout=OneColumn, pdfnewwindow=true,pdfstartview=XYZ, plainpages=false"
89 \use_package amsmath 1
90 \use_package amssymb 1
93 \use_package mathdots 1
94 \use_package mathtools 0
96 \use_package stackrel 0
97 \use_package stmaryrd 0
98 \use_package undertilde 0
100 \cite_engine_type default
104 \paperorientation portrait
108 \notefontcolor #0000ff
115 \paragraph_separation indent
116 \paragraph_indentation default
117 \quotes_language english
120 \paperpagestyle default
121 \tracking_changes false
122 \output_changes false
135 \begin_layout Plain Layout
144 -pic in \SpecialCharNoPassThru LyX
152 \begin_layout Abstract
153 With the recent versions of \SpecialCharNoPassThru LyX
158 -style installed in the \SpecialCharNoPassThru LaTeX
159 -System, the graph drawing package
165 \begin_layout Plain Layout
176 -pic can be conveniently used inside \SpecialCharNoPassThru LyX
178 Diagrams can be edited and displayed inside the main \SpecialCharNoPassThru LyX
180 Here, we shall describe how to use the
190 inside \SpecialCharNoPassThru LyX
191 in order to draw, to edit and to preview diagrams as typically
192 used in category theory, algebra, and related fields.
196 \begin_layout Abstract
197 \begin_inset CommandInset toc
198 LatexCommand tableofcontents
205 \begin_layout Section
209 \begin_layout Standard
214 -package has long served as a convenient tool for easily constructing graphs
215 and diagrams in \SpecialCharNoPassThru LaTeX
217 Unfortunately, its use in \SpecialCharNoPassThru LyX
218 had long been restricted to the infamous
219 \SpecialCharNoPassThru TeX
220 code boxes, meaning that the \SpecialCharNoPassThru LyX
221 editor could only display the \SpecialCharNoPassThru LaTeX
223 and not the finished diagram.
228 -style of \SpecialCharNoPassThru LaTeX
229 which is part of the AUC\SpecialCharNoPassThru TeX
231 \begin_inset CommandInset citation
237 , finally enables the editing and displaying of
241 -diagrams, constructed, displayed and interactively edited inside \SpecialCharNoPassThru LyX
245 \begin_layout Standard
246 \begin_inset VSpace defskip
252 \begin_layout Standard
254 \begin_inset Graphics
255 filename xyfigure.png
263 \begin_layout Standard
264 \begin_inset VSpace defskip
270 \begin_layout Standard
271 In this note, we describe how
275 \begin_layout Plain Layout
284 -pic can be used from inside \SpecialCharNoPassThru LyX
285 , how diagrams can be created and edited.
286 We have tested the following using \SpecialCharNoPassThru LyX
287 versions 1.3.7 up to 1.6, running under
289 \begin_inset space \thinspace{}
292 XP and under Windows Vista.
296 \begin_layout Standard
297 There are two modes of operations: For a start, and for some first tests,
298 it may be easiest to first enter the
302 \begin_layout Plain Layout
311 -pic code inside the \SpecialCharNoPassThru LyX
312 -window, select it all and convert it to a graphical
313 representation by pressing
326 \begin_layout Plain Layout
335 -pic more frequently, or if you want to modify your initial figure, you
336 will want to assemble and modify your figures using \SpecialCharNoPassThru LyX
341 \begin_layout Standard
342 Once the cursor is moved over a diagram, this is displayed as an array of
343 nodes and arrow-commands.
344 These can be changed interactively.
345 When the cursor leaves the editing area, the diagram reappears.
349 \begin_layout Standard
350 In the first two sections of this documentation, we explain how to use \SpecialCharNoPassThru LyX
351 in the first mentioned mode and we introduce all
355 \begin_layout Plain Layout
364 -pic features that might be of use for drawing commutative diagrams, graphs
367 \begin_inset CommandInset ref
369 reference "sec:math-editor"
373 explains how to use the
377 \begin_layout Plain Layout
386 -pic commands inside a math-editing area.
390 \begin_layout Standard
391 It is not our intention to write another introduction to
395 \begin_layout Plain Layout
404 -pic, rather our motivation is to give an introduction how the most important
405 commands work inside \SpecialCharNoPassThru LyX
406 , since the keystrokes as explained in the
410 \begin_layout Plain Layout
420 \begin_inset CommandInset citation
426 will not always function correctly inside \SpecialCharNoPassThru LyX
431 \begin_layout Section
435 \begin_layout Standard
436 The following requires that the \SpecialCharNoPassThru LaTeX
445 are installed in the \SpecialCharNoPassThru LaTeX
447 They are available from CTAN, see at
448 \begin_inset CommandInset citation
450 key "instant-preview"
456 \begin_inset CommandInset citation
463 After freshly installing them, it may be necessary, to run
465 Tools\SpecialChar menuseparator
468 from the main \SpecialCharNoPassThru LyX
470 The steps to a first diagram output in \SpecialCharNoPassThru LyX
474 \begin_layout Enumerate
479 \begin_inset Separator parbreak
485 \begin_layout Enumerate
486 Open \SpecialCharNoPassThru LyX
489 Tools\SpecialChar menuseparator
490 Preferences\SpecialChar menuseparator
491 Look and Feel\SpecialChar menuseparator
501 \begin_layout Enumerate
504 Document\SpecialChar menuseparator
505 Settings\SpecialChar menuseparator
514 Use AMS Math package automatically
523 \begin_layout Enumerate
528 works by opening a \SpecialCharNoPassThru LyX
529 -document and entering any math-formula, e.
530 \begin_inset space \thinspace{}
534 \begin_inset space \space{}
538 \begin_inset Formula $a+b=c$
545 \begin_layout Enumerate
546 Move the cursor out of the formula, and watch it change its appearance to
547 look just like in the finished DVI- or PostScript document.
552 \begin_layout Enumerate
557 \begin_layout Plain Layout
570 \begin_inset Separator parbreak
576 \begin_layout Enumerate
577 Inside your \SpecialCharNoPassThru LyX
578 -Document, enter the text
581 \begin_inset Newline newline
593 \begin_layout Enumerate
594 Select the whole text and choose
596 Insert\SpecialChar menuseparator
597 Math\SpecialChar menuseparator
600 , or use the corresponding keyboard shortcut
608 \begin_layout Enumerate
609 Move the mouse cursor out of the editing box and wait for a split second
610 to see an arrow appear:
611 \begin_inset Formula $\xymatrix{A\ar[r] & B}
619 \begin_layout Section
623 \begin_layout Standard
624 The following diagram, which is taken from the documentation of
628 \begin_layout Plain Layout
638 \begin_inset CommandInset citation
644 by its creator Kristoffer H.
645 Rose, will provide an example for many of the features available with that
650 \begin_layout LyX-Code
654 \begin_inset Newline newline
666 \begin_inset Newline newline
676 \begin_inset Newline newline
692 \begin_inset Newline newline
700 \begin_layout LyX-Code
704 \begin_layout Standard
705 Again, to turn this code into a graphical output, select it all at once
713 up to the closing brace \SpecialChar ldots
718 and turn it into display-math as explained above.
719 A moment after the cursor leaves the math-area, you should see the diagram
720 in its full graphical glory as shown below.
724 \begin_layout Standard
725 \begin_inset Formula $\xymatrix{U\ar@/_{1pc}/[ddr]_{\psi}\ar@/{}^{1pc}/[drr]^{\varphi}\ar@{.>}[dr]|-{(x,y)}\\
726 & X\times_{Z}Y\ar[d]^{q}\ar[r]_{p} & X\ar[d]_{f}\\
735 \begin_layout Subsection
736 The matrix layout of diagrams
739 \begin_layout Standard
744 uses a matrix to define the layout of the vertices of a diagram.
745 For the above example, we need a
746 \begin_inset Formula $3\times3$
749 -matrix of which 5 entries are used for the vertices
750 \begin_inset Formula $U$
754 \begin_inset Formula $X\times_{Z}Y$
758 \begin_inset Formula $X$
762 \begin_inset Formula $Y$
766 \begin_inset Formula $Z$
769 , the other positions remaining empty.
770 In this case, the following matrix determines the layout:
773 \begin_layout LyX-Code
777 \begin_inset Newline newline
785 \begin_inset Newline newline
795 \begin_inset Newline newline
801 \begin_layout Standard
802 The pattern should be familiar from \SpecialCharNoPassThru LaTeX
803 : We see three rows, the first
804 two being terminated by the end-of-line-marker
813 Each line consists of entries, separated by the ampersand
821 \begin_layout Subsection
825 \begin_layout Standard
826 Having entered the vertices, we add arrows between them.
831 -command to produce an arrow is
837 , it is entered into the cell of the matrix where the arrow is to start.
838 The target of the arrow is defined by direction commands
855 These can be combined to a path and enclosed in square brackets.
856 As an example, the arrows from the vertex
857 \begin_inset Formula $U$
860 in the upper left corner down and right to the vertices
861 \begin_inset Formula $X\times_{Z}Y$
865 \begin_inset Formula $Y$
869 \begin_inset Formula $X$
872 are, respectively, defined as
891 Thus the above diagram with all arrows added becomes:
894 \begin_layout LyX-Code
898 \begin_inset Newline newline
912 \begin_inset Newline newline
928 \begin_inset Newline newline
936 \begin_layout LyX-Code
937 \begin_inset Formula $\xymatrix{U\ar[ddr]\ar[drr]\ar[dr]\\
938 & X\times_{Z}Y\ar[d]\ar[r] & X\ar[d]\\
947 \begin_layout LyX-Code
951 \begin_layout LyX-Code
955 \begin_layout Subsection
959 \begin_layout Standard
960 Labels are attached to arrows by affixing them as upper or lower indices
976 defines an arrow going one cell down, two to the right and having the label
978 \begin_inset Formula $\varphi$
982 To attach a label below the arrow, make it a lower index as in
991 This explanation is correct only for arrows pointing to the right.
992 More precisely, imagine looking along the arrow in the direction it is
994 Then an upper index places a label to the left and a lower index places
996 Consequently, an arrow pointing from right to left, such as
1007 \begin_inset Formula $\alpha$
1011 \begin_inset Formula $\beta$
1015 \begin_inset space \thinspace{}
1019 \begin_inset space \space{}
1023 \begin_inset Formula $\xymatrix{\ & \ \ar[l]_{\beta}^{\alpha}.}
1027 Using the character | instead of ^ or _ , it is even possible to place the
1028 label right onto the arrow, obscuring part of its shaft.
1032 \begin_layout Standard
1033 Normally, a label is placed halfway between an arrow's start and target
1035 In the first diagram, the central arrow starting in
1036 \begin_inset Formula $U$
1040 \begin_inset Formula $(x,y)$
1043 in the middle of the arrow's shaft, rather than in the middle between the
1044 two objects it connects.
1045 This is achieved by prefixing the label with a minus sign, here:
1054 \begin_layout LyX-Code
1058 \begin_inset Newline newline
1076 \begin_inset Newline newline
1092 \begin_inset Newline newline
1100 \begin_layout LyX-Code
1101 \begin_inset Formula $\xymatrix{U\ar[ddr]_{\psi}\ar[drr]^{\varphi}\ar[dr]|-{(x,y)}\\
1102 & X\times_{Z}Y\ar[d]^{q}\ar[r]_{p} & X\ar[d]_{f}\\
1111 \begin_layout Standard
1115 \begin_layout Plain Layout
1124 -pic normally permits labels to be shifted towards the tip or towards the
1125 start of an arrow by prefixing the label with a ratio, such as e.
1126 \begin_inset space \thinspace{}
1130 \begin_inset space \space{}
1138 In \SpecialCharNoPassThru LyX
1139 this works only for labels which are placed on top of the arrow,
1152 \begin_layout Standard
1153 For labels placed to the left or to the right of the arrow this does not
1159 \begin_layout Plain Layout
1168 -pic code such as e.
1169 \begin_inset space \thinspace{}
1173 \begin_inset space \space{}
1192 is not correctly interpreted by \SpecialCharNoPassThru LyX
1194 Two workarounds are suggested in the last section of this note.
1197 \begin_layout Subsection
1201 \begin_layout Standard
1202 Modification of the design, the form or the positioning of arrows are introduced
1208 This is followed by a pair of matching brackets, where the form of the
1221 indicates, whether we want to modify the design, the or the curvature of
1223 Various modifications can be applied to an arrow at the same time.
1226 \begin_layout Subsubsection
1230 \begin_layout Standard
1231 Various designs such as
1247 are possible for the shaft of an arrow.
1248 These can be combined with various ends and various tips.
1249 In general, the design of an arrow is described by following the command
1260 -sign and a pair of braces {\SpecialChar ldots
1261 } containing characters describing the end,
1262 the shaft and the tip of the arrow.
1263 These characters are chosen to give some form of ASCII-rendering of the
1271 produces an arrow with split end, a dotted shaft and double head.
1272 A number of other arrow designs is given in the table below.
1273 Note that the ends of embedding arrows
1274 \begin_inset Formula $\xymatrix{A\ar@{^{(}->}[r] & B}
1278 are described by raising or lowering opening parentheses, such as in
1284 \begin_inset Separator parbreak
1289 \begin_layout Standard
1291 \begin_inset Tabular
1292 <lyxtabular version="3" rows="11" columns="2">
1293 <features rotate="0" tabularvalignment="middle">
1294 <column alignment="center" valignment="top" width="0pt">
1295 <column alignment="center" valignment="top">
1297 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1300 \begin_layout Plain Layout
1306 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1309 \begin_layout Plain Layout
1310 Source code in \SpecialCharNoPassThru LyX
1317 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1320 \begin_layout Plain Layout
1321 \begin_inset Formula $\xymatrix{\ \ar[r] & \ }
1330 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1333 \begin_layout Plain Layout
1345 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1348 \begin_layout Plain Layout
1349 \begin_inset Formula $\xymatrix{\ \ar@{-->}[r] & \ }
1358 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1361 \begin_layout Plain Layout
1374 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1377 \begin_layout Plain Layout
1378 \begin_inset Formula $\xymatrix{\ \ar@{..>}[r] & \ }
1387 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1390 \begin_layout Plain Layout
1402 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1405 \begin_layout Plain Layout
1406 \begin_inset Formula $\xymatrix{\ \ar@{~>}[r] & \ }
1415 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1418 \begin_layout Plain Layout
1430 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1433 \begin_layout Plain Layout
1434 \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" leftline="true" usebox="none">
1461 \begin_layout Plain Layout
1462 \begin_inset Formula $\xymatrix{\ \ar@{-->>}[r] & \ }
1471 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1474 \begin_layout Plain Layout
1487 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1490 \begin_layout Plain Layout
1491 \begin_inset Formula $\xymatrix{\ \ar@{>->>}[r] & \ }
1500 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1503 \begin_layout Plain Layout
1515 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1518 \begin_layout Plain Layout
1519 \begin_inset Formula $\xymatrix{\ \ar@{_{(}->}[r] & \ }
1528 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1531 \begin_layout Plain Layout
1543 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1546 \begin_layout Plain Layout
1547 \begin_inset Formula $\xymatrix{\ \ar@{^{(}->}[r] & \ }
1556 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1559 \begin_layout Plain Layout
1571 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1574 \begin_layout Plain Layout
1575 \begin_inset Formula $\xymatrix{\ \ar@{|-|}[r] & \ }
1584 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1587 \begin_layout Plain Layout
1605 \begin_layout Standard
1607 Following the @-character by either a 2, 3, _ or a ^, we can produce arrows
1608 with double, triple shaft or arrows showing only the lower or upper half
1609 of their tips and ends.
1610 Arrows need not have tips nor ends, as the last example shows:
1611 \begin_inset Separator parbreak
1616 \begin_layout Standard
1618 \begin_inset Tabular
1619 <lyxtabular version="3" rows="8" columns="2">
1620 <features rotate="0" tabularvalignment="middle">
1621 <column alignment="center" valignment="top">
1622 <column alignment="center" valignment="top">
1624 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1627 \begin_layout Plain Layout
1633 <cell alignment="center" valignment="top" topline="true" bottomline="true" rightline="true" usebox="none">
1636 \begin_layout Plain Layout
1637 Source code for \SpecialCharNoPassThru LyX
1644 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1647 \begin_layout Plain Layout
1648 \begin_inset Formula $\xymatrix{\ \ar@2[r] & \ }
1657 <cell alignment="center" valignment="top" topline="true" rightline="true" usebox="none">
1660 \begin_layout Plain Layout
1672 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1675 \begin_layout Plain Layout
1676 \begin_inset Formula $\xymatrix{\ \ar@3[r] & \ }
1685 <cell alignment="center" valignment="top" topline="true" rightline="true" usebox="none">
1688 \begin_layout Plain Layout
1700 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1703 \begin_layout Plain Layout
1704 \begin_inset Formula $\xymatrix{\ \ar@_{->}[r] & \ }
1713 <cell alignment="center" valignment="top" topline="true" rightline="true" usebox="none">
1716 \begin_layout Plain Layout
1728 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1731 \begin_layout Plain Layout
1732 \begin_inset Formula $\xymatrix{\ \ar@^{->}[r] & \ }
1741 <cell alignment="center" valignment="top" topline="true" rightline="true" usebox="none">
1744 \begin_layout Plain Layout
1756 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1759 \begin_layout Plain Layout
1760 \begin_inset Formula $\xymatrix{\ \ar@^{>>->>}[r] & \ }
1769 <cell alignment="center" valignment="top" topline="true" rightline="true" usebox="none">
1772 \begin_layout Plain Layout
1777 ar@^{>\SpecialChar ligaturebreak
1778 >->\SpecialChar ligaturebreak
1786 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1789 \begin_layout Plain Layout
1790 \begin_inset Formula $\xymatrix{\ \ar@{^{<}-_{>}}[r] & \ }
1799 <cell alignment="center" valignment="top" topline="true" bottomline="true" rightline="true" usebox="none">
1802 \begin_layout Plain Layout
1814 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1817 \begin_layout Plain Layout
1818 \begin_inset Formula $\xymatrix{\ \ar@2{--}[r] & \ }
1827 <cell alignment="center" valignment="top" topline="true" bottomline="true" rightline="true" usebox="none">
1830 \begin_layout Plain Layout
1849 \begin_layout Subsubsection
1850 Designing your own arrows
1853 \begin_layout Standard
1854 Within certain limits there is even a way to design your own arrows.
1855 Using some the characters
1859 one can even design one's own arrow tips using the
1865 command in the preamble.
1866 For explanations, we refer to the
1872 \begin_layout Plain Layout
1883 -manual, from which we take the example:
1886 \begin_layout Standard
1891 newdir{|>}{!/4.5pt/@{|}*:(1,-.2)@^{>}*:(1,+.2)@_{>}}
1896 \begin_layout Standard
1898 This defines a new arrow tip, referred to as
1908 and which displays correctly in \SpecialCharNoPassThru LyX
1910 \begin_inset Formula
1912 \xymatrix{A\ar@{-|>}[r] & \ \ B}
1920 \begin_layout Subsection
1924 \begin_layout Standard
1925 Arrows are shifted sideways with the modifier
1930 \begin_inset Formula $\ldots$
1937 where the ellipsis is replaced by a positive or negative measure.
1938 For instance, to design a pair of mutually opposing arrows between two
1939 nodes, we shift them to see them apart.
1940 Note that the direction of the shift (positive) is to the left if one looks
1945 \begin_layout Standard
1961 \begin_layout Standard
1964 \begin_inset Formula
1966 \xymatrix{\circ\ar@<1ex>[r] & \circ\ar@<1ex>[l]}
1974 \begin_layout Subsubsection
1975 Inline or centered diagrams
1978 \begin_layout Standard
1979 Arrows and diagrams can be used inline, such as this one:
1980 \begin_inset Formula $\xymatrix{\circ\ar@<1ex>[r] & \circ\ar@<1ex>[l]}
1985 When their code is written inside \SpecialCharNoPassThru LyX
1986 as above, select it and choose either
1991 for inline appearance or
1996 Diagrams constructed inline can later be centered, or, conversely, centered
1997 diagrams can be changed to inline formulas with
1999 Edit\SpecialChar menuseparator
2004 \SpecialChar menuseparator
2005 Change Formula Type.
2008 \begin_layout Subsection
2012 \begin_layout Standard
2013 There are two simple methods to make arrows bend.
2014 The first is giving an explicit value by which the midpoint of the arrow's
2015 shaft is raised or depressed, the other is by forcing the arrow to leave
2016 its origin in a prescribed compass direction and to make him enter the
2017 target at another direction.
2018 The necessary bending of the arrow is determined automatically.
2019 We describe both methods.
2022 \begin_layout Subsubsection
2026 \begin_layout Standard
2027 For bending arrows we use the modifier @/
2028 \begin_inset Formula $\ldots$
2032 The ellipsis stands for a \SpecialCharNoPassThru TeX
2033 -measure which needs to be entered as a lower
2039 , we could simply write, e.
2040 \begin_inset space \thinspace{}
2044 \begin_inset space \space{}
2053 for an arrow bending
2057 downwards, this cannot directly be done in \SpecialCharNoPassThru LyX
2059 It is necessary, to enclose the measure in a pair of braces, such as e.
2060 \begin_inset space \thinspace{}
2064 \begin_inset space \space{}
2074 As an example, here are two opposing arrows between
2075 \begin_inset Formula $A$
2079 \begin_inset Formula $B$
2082 , each bending by .5 pica, given by the following source code:
2085 \begin_layout Standard
2097 \begin_layout Standard
2098 \begin_inset Formula
2100 \xymatrix{A\ar@/{}_{.5pc}/[r] & B\ar@/{}_{.5pc}/[l]}
2108 \begin_layout Subsubsection
2109 Specifying exit- and entrance directions
2112 \begin_layout Standard
2113 An alternative for making arrows bend is by specifying their compass direction
2114 as they are leaving their source and their direction from which they enter
2116 Instead of north, north-east, east, etc., the directions are named
2148 , standing for up, up-right, right, down-right, etc..
2149 A direction is specified as @(
2161 stands for the direction the first object is left and
2165 stands for the direction from which the target is entered.
2166 As an example, we show some bending arrows and a loop, which arises when
2167 we do not specify a target for an arrow, just its incoming and outgoing
2171 \begin_layout Standard
2172 \begin_inset Formula
2174 \xymatrix{A\ar@(dr,dl)[r]\ar@(dr,dl)[rr] & B\ar@(d,r)[dl] & C\\
2184 \begin_layout LyX-Code
2192 \begin_inset Newline newline
2202 \begin_inset Newline newline
2210 \begin_layout Subsection
2214 \begin_layout Standard
2215 The above example is reminiscent of an automata diagram, except that in
2216 such a diagram states would be enclosed in small circles, with double circles
2217 denoting final states.
2221 \begin_layout Subsubsection
2225 \begin_layout Standard
2230 \begin_layout Plain Layout
2239 -pic, entries can obtain a single or a double frame, such as
2240 \begin_inset Formula $\xymatrix{*+[F]{A}}
2245 \begin_inset Formula $\xymatrix{*+[F=]{B}}
2249 by prefixing an entry with
2257 and enclosing the portion of the entry to be framed in braces.
2258 Normally, the frame will be very tight so that it must be widened by prefixing
2268 Round frames, such as
2269 \begin_inset Formula $\xymatrix{*++[o][F]{A}}
2274 \begin_inset Formula $\xymatrix{*++[o][F=]{B}}
2278 are obtained by specifying the shape as
2283 So the latter figure was constructed as *++[o][F=]{B}.
2284 This way, the following automaton
2287 \begin_layout Standard
2288 \begin_inset Formula
2290 \xymatrix{\txt{start}\ar[r] & *++[o][F]{1}\ar[r] & *++[o][F=]{2}\ar@(ur,dr)\ar@(ur,ul)[l]}
2298 \begin_layout Standard
2303 \begin_layout LyX-Code
2313 \begin_layout LyX-Code
2319 \begin_layout LyX-Code
2327 \begin_layout LyX-Code
2331 \begin_layout Standard
2332 The \SpecialCharNoPassThru LaTeX
2344 will make a certain entry style the default, that can, of course be overridden
2345 for individual entries.
2350 entrymodifiers={++[o][F-]}
2352 , all following entries inside
2356 \begin_layout Plain Layout
2365 -matrices would be encircled.
2368 \begin_layout Subsubsection
2372 \begin_layout Standard
2373 Framing a whole rectangle inside an xymatrix is done with the macro pair
2393 The dimension of the rectangle is given as a dotted pair
2394 \begin_inset Formula $P_{0}.P_{1}$
2397 of points denoting the top left and lower right corners of the rectangle.
2398 Each point, in turn,is given as a doubly quoted comma separated pair
2399 \begin_inset Quotes eld
2403 \begin_inset Formula $x,y$
2407 \begin_inset Quotes erd
2411 \begin_inset Formula $x$
2415 \begin_inset Formula $y$
2419 These are followed by the framing commands, to produce figures such as
2421 \begin_inset Formula
2423 \xymatrix{A & B\ar@(d,r)[dl]\sp(0.2)\phi\sp(0.7)\psi\save"1,1"."2,1"*+[F=]\frm{}\restore\,\\
2424 C & \save"1,1"."1,2"*++[F]\frm{}\restore
2441 save"1,1"."2,1"*+[F=]
2454 produces the doubly framed rectangle, and the code for the extra wide horizonta
2466 save"1,1"."1,2"*++[F]
2480 This code can be placed in arbitrary cells of the xymatrix.
2484 \begin_layout Section
2485 Using \SpecialCharNoPassThru LyX
2487 \begin_inset CommandInset label
2489 name "sec:math-editor"
2496 \begin_layout Standard
2497 As an alternative to writing the
2501 code, then transforming it into a math-editing environment by marking it
2510 , one may construct and modify the whole xypic-diagram inside \SpecialCharNoPassThru LyX
2513 We describe the editing steps for a figure just like the one above.
2517 \begin_layout Subsection
2518 Caveat - how to enter braces
2521 \begin_layout Standard
2522 Recall that in \SpecialCharNoPassThru LyX
2523 's math-editor any pair of braces
2531 that are to enclose a macro-parameter must be entered by typing just
2538 The closing brace is automatically supplied and in between a box into which
2539 to the parameter is entered.
2544 \begin_layout Plain Layout
2553 -diagrams, this applies in particular to arrow modifications that are normally
2563 with the ellipsis standing for the description of end, shaft and tip of
2565 Inside the math-editor, enter just
2571 and let \SpecialCharNoPassThru LyX
2572 provide the closing brace and the box into which to enter the
2573 description of the arrow.
2576 \begin_layout Standard
2577 Braces that are entered without the backslash
2583 will just appear as typed, but cannot be used to receive a macro parameter.
2584 They are useful, for instance to denote sets, e.
2585 \begin_inset space \thinspace{}
2589 \begin_inset space \space{}
2603 \begin_inset Formula $\{x\in X\mid x\notin x\}$
2609 \begin_layout Subsection
2610 Setting up the matrix
2613 \begin_layout Standard
2622 open a formula environment and enter:
2630 \begin_inset Formula $\times$
2637 \begin_layout Plain Layout
2647 Add extra rows by typing
2651 and add columns by typing
2657 \begin_layout Standard
2658 At any time, further rows or columns can be entered or deleted using commands
2661 Edit\SpecialChar menuseparator
2665 their shortcuts, beginning with
2669 for the column commands or
2673 for the row commands.
2674 A more direct way uses the icons in the math toolbar once it has been activated
2677 View\SpecialChar menuseparator
2681 \begin_layout Subsection
2682 Entering nodes, arrows and labels
2685 \begin_layout Standard
2686 Type the nodes into the correct positions of the matrix.
2687 If you move the cursor out of the matrix, you should see a first rendering
2689 Next, add the arrows at the nodes from where they should emanate by typing
2706 can be any path made up from the characters
2723 Make sure that the path indeed leads to an existing node within the matrix.
2724 Otherwise, the figure will not display when the cursor leaves the editing
2728 \begin_layout Standard
2729 Next, label the arrows by attaching a label text as upper or lower indices
2730 to the end of the arrow's path.
2731 As always in \SpecialCharNoPassThru LyX
2732 's math editor, an underscore
2736 opens a box for a lower index and a
2740 followed by a space opens a box for an upper index.
2741 You can enter any \SpecialCharNoPassThru LaTeX
2745 \begin_layout Subsection
2749 \begin_layout Standard
2750 Finally, you can modify the appearance of the arrows by entering @-modifiers
2781 The above caveat applies to the first form only.
2782 It must be entered as
2788 with the arrow description entered inside the \SpecialCharNoPassThru LyX
2790 If this box remains empty, you have specified an empty arrow.
2791 This is a useful construction, too, as you will see in the next section.
2795 \begin_layout Standard
2796 The other modifiers,
2824 are typed as shown with the arrow description replacing the ellipsis.
2825 The code for bending arrows, which in
2854 is any valid \SpecialCharNoPassThru TeX
2855 -measure that should be entered as upper or lower index
2856 to the first slash /.
2857 Make sure that the ending slash does not end up being part of the upper
2861 \begin_layout Subsection
2862 What if something goes wrong
2865 \begin_layout Standard
2866 When constructing a diagram, you should at times check it by just moving
2867 the cursor out of the editing area to see whether instant preview can successfu
2868 lly convert it into graphical output.
2869 If this does not happen, it may either be that instant preview for some
2870 reason is not aware that it should retranslate the graphics.
2871 Moving the cursor into the editing area and out again sometimes wakes up
2875 \begin_layout Standard
2876 A more serious reason could be a syntactical error in your input (in that
2877 case, the math edition area disappears completely).
2878 If necessary, undo the last editing steps, using
2882 , or try to translate the \SpecialCharNoPassThru LyX
2893 View\SpecialChar menuseparator
2897 There should be some error generated, which hopefully gives you a hint
2898 as to the source of the mistake.
2901 \begin_layout Section
2905 \begin_layout Standard
2906 Certain things do not work correctly inside \SpecialCharNoPassThru LyX
2908 The ones that we (used to) miss most are the horizontal and vertical scaling
2909 of diagrams, and the correct positioning of arrows.
2910 There are some workarounds that we are explaining here.
2914 \begin_layout Subsection
2915 Horizontal and vertical scaling
2918 \begin_layout Standard
2919 It is often convenient to stretch the horizontal or the vertical dimensions
2920 of an entire diagram by using spacing commands for rows and/or columns.
2925 \begin_layout Plain Layout
2935 \begin_inset CommandInset citation
2956 \begin_layout Plain Layout
2965 -matrix with row spacing of 1
2966 \begin_inset space ~
2986 allows to modify the space between columns.
2987 Unfortunately, one cannot type
2988 \begin_inset Quotes eld
2998 \begin_inset Quotes erd
3001 into a formula to get the desired matrix because the @-character is interpreted
3002 by \SpecialCharNoPassThru LyX
3010 But there are two other ways of getting the desired matrix:
3013 \begin_layout Itemize
3015 \begin_inset space \space{}
3024 as normal document text, then either highlight it and press
3030 to get a formula, or copy it into an existing formula.
3031 You can now continue as normal.
3032 \begin_inset Newline newline
3036 \begin_inset Note Greyedout
3039 \begin_layout Plain Layout
3044 This method only works for single spacing settings, so using
3045 \begin_inset Newline newline
3058 xymatrix@M=1pt@C=1dd
3061 The method also don't work if you use '!' to get a fixed grid with a defined
3063 \begin_inset space \space{}
3084 \begin_inset Newline newline
3087 For the following matrix, the command
3094 \begin_inset Formula
3096 \xymatrix@C=9pc{A\ar[r]\ar[d] & B\\
3097 C\ar@{}[ur]|{\text{{horizontal stretch}}}
3106 \begin_layout Itemize
3110 \begin_layout Plain Layout
3120 \begin_inset space ~
3123 stores the values for row-spacing and column-spacing in the variables
3124 \begin_inset Newline newline
3140 So one can add the following macro to the preamble (
3142 Layout\SpecialChar menuseparator
3143 Document\SpecialChar menuseparator
3148 \begin_inset Separator parbreak
3154 \begin_layout LyX-Code
3162 \begin_layout LyX-Code
3167 xymatrixrowsep@{#1}}
3170 \begin_layout Standard
3177 can be defined correspondingly by replacing
3190 Now, a figure can be scaled by entering
3192 xyR{ into the formula before the
3196 \begin_layout Plain Layout
3206 Place the cursor inside the matrix, just before the first entry.
3224 Don't forget the backslashes and remember, that the closing brace is automatica
3225 lly supplied by \SpecialCharNoPassThru LyX
3227 Inside the braces enter the dimensions.
3228 \begin_inset Newline newline
3232 \begin_inset Note Greyedout
3235 \begin_layout Plain Layout
3240 these commands affect all following
3244 \begin_layout Plain Layout
3254 Therefore don't forget to reset the values to default after the usage of
3267 \begin_inset Newline newline
3275 Here you see a diagram which is squashed vertically and stretched horizontally
3285 \begin_inset Formula
3287 \xyR{.5pc}\xyC{9pc}\xymatrix{A\ar[r]\ar[d] & B\\
3288 C\ar@{}[ur]|{\text{{horizontal stretch}}}
3295 \begin_inset Formula $\xyR{2pc}\xyC{2pc}$
3299 \begin_inset Note Note
3302 \begin_layout Plain Layout
3312 \begin_layout Subsection
3316 \begin_layout Standard
3321 \begin_layout Plain Layout
3330 -command allows the correct positioning of labels along the shaft of arrows.
3331 This feature is sometimes necessary, when the default position of a label
3332 would otherwise clutter the picture, or would even coincide with other
3333 items, such as the intersection of the arrows in the figure below.
3334 In order to shift a label position alongside the shaft of an arrow,
3338 \begin_layout Plain Layout
3348 \begin_inset space ~
3351 allows to prefix the label by a decimal number in parentheses, specifying
3352 the fraction of distance alongside the arrow where the label is to be placed.
3353 For instance, the code
3361 , will place the label on the shaft, but only about one third of the way.
3365 \begin_layout Standard
3366 Doing the same with labels above or below arrows as
3382 , does not work from inside \SpecialCharNoPassThru LyX
3384 Instead, one has to replace the hat-symbol ^, resp.
3385 the underscore _ , by the macros
3419 It is, in fact, possible to enter several labels this way and those labels
3420 are placed correctly, even if the arrow bends.
3421 In the following figure, the bending arrow with its four labels has been
3445 \begin_layout Standard
3446 \begin_inset Formula
3448 \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}}\\
3449 \circ\ar[ur]\sb(0.3)\phi & \bullet
3458 \begin_layout Subsection
3459 Invisible stretched arrows
3462 \begin_layout Standard
3463 A more general trick uses invisible arrows to place any object almost anywhere
3465 Produce an invisible arrow, shorten (or prolong) it past its goal by adding
3466 a decimal stretching ratio, e.
3467 \begin_inset space \thinspace{}
3471 \begin_inset space \space{}
3483 Attach a label to this invisible arrow.
3487 \begin_layout Standard
3488 Thus, the down pointing arrow with its label
3489 \begin_inset Formula $\varphi$
3492 at (0.3) of its way along the shaft might as well have been produced by
3493 adding to the regular arrow
3500 \begin_inset Formula $\varphi$
3511 , reaching only 0.6 of the way.
3512 Its label will now appear at 0.3 of the way of the original visible arrow.
3516 \begin_layout Standard
3517 This workaround has two minor drawbacks: First, it does not work with bending
3519 Secondly, prolonging an invisible arrow beyond the normal dimension of
3520 the figure will invisibly extend the figure box, and thereby cause too
3521 much vertical space between the figure and the preceding or the following
3526 \begin_layout Standard
3527 Nevertheless, invisible arrows are an important tool, since they can, in
3528 principle, be used to place information at any chosen place in a diagram.
3529 In the above figure, for instance, we have used an invisible arrow to carry
3536 as label and at the earlier figure we had used an invisible arrow to carry
3538 \begin_inset Quotes eld
3546 \begin_inset Quotes erd
3549 into the center of the figure.
3552 \begin_layout Subsection
3560 \begin_layout Standard
3561 Here we have focused only on the
3567 command, which is just one of the features available in Kris Rose's amazing
3573 \begin_layout Plain Layout
3591 \begin_layout Plain Layout
3603 \begin_inset CommandInset citation
3609 demonstrates many of the advanced possibilities of that package.
3610 Beware, that its style is rather terse and you will likely need a lot of
3611 experimenting and modifying the many worked examples.
3613 \begin_inset CommandInset citation
3623 \begin_layout Plain Layout
3632 -pic to make braids, cobordism, string diagrams, and much more.
3633 You might want to look on
3637 example shipped with \SpecialCharNoPassThru LyX
3638 , which demonstrates how to use more advanced
3642 \begin_layout Plain Layout
3653 \SpecialCharNoPassThru TeX
3654 \begin_inset space ~
3666 \begin_layout Standard
3667 \begin_inset Newpage newpage
3673 \begin_layout Bibliography
3674 \begin_inset CommandInset bibitem
3675 LatexCommand bibitem
3685 \begin_layout Plain Layout
3699 \begin_inset Newline newline
3703 \begin_inset Flex URL
3706 \begin_layout Plain Layout
3708 https://www.ctan.org/tex-archive/macros/generic/diagrams/xypic/doc/xyguide.pdf
3716 \begin_layout Bibliography
3717 \begin_inset CommandInset bibitem
3718 LatexCommand bibitem
3719 key "xypic reference"
3724 Rose and Ross Moore:
3728 \begin_layout Plain Layout
3739 -pic Reference Manual
3742 \begin_inset Newline newline
3746 \begin_inset Flex URL
3749 \begin_layout Plain Layout
3751 https://www.ctan.org/tex-archive/macros/generic/diagrams/xypic/doc/xyrefer.pdf
3759 \begin_layout Bibliography
3760 \begin_inset CommandInset bibitem
3761 LatexCommand bibitem
3766 Homepage of the package
3770 \begin_layout Plain Layout
3784 \begin_inset Flex URL
3787 \begin_layout Plain Layout
3789 http://www.ctan.org/pkg/xypic
3797 \begin_layout Bibliography
3798 \begin_inset CommandInset bibitem
3799 LatexCommand bibitem
3800 key "instant-preview"
3804 Homepage of preview-latex:
3805 \begin_inset Newline newline
3809 \begin_inset Flex URL
3812 \begin_layout Plain Layout
3814 http://www.gnu.org/software/auctex/preview-latex.html
3822 \begin_layout Bibliography
3823 \begin_inset CommandInset bibitem
3824 LatexCommand bibitem
3829 Homepage of AUC\SpecialCharNoPassThru TeX
3831 \begin_inset Flex URL
3834 \begin_layout Plain Layout
3836 http://www.gnu.org/software/auctex/
3844 \begin_layout Bibliography
3845 \begin_inset CommandInset bibitem
3846 LatexCommand bibitem
3855 \begin_layout Plain Layout
3870 tutorial with an archive of examples
3873 \begin_inset Newline newline
3877 \begin_inset Flex URL
3880 \begin_layout Plain Layout
3882 https://www.ctan.org/tex-archive/macros/generic/diagrams/xypic/doc/xyguide.pdf