]> git.lyx.org Git - lyx.git/blob - lib/examples/xypic.lyx
Literate.lyx: move date with other InTitle layouts
[lyx.git] / lib / examples / xypic.lyx
1 #LyX 2.2 created this file. For more info see http://www.lyx.org/
2 \lyxformat 508
3 \begin_document
4 \begin_header
5 \save_transient_properties true
6 \origin /systemlyxdir/examples/
7 \textclass scrartcl
8 \begin_preamble
9 % DO NOT ALTER THIS PREAMBLE!!!
10 %
11 % This preamble is designed to ensure that the file prints
12 % out as advertised. If you mess with this preamble,
13 % parts of this document may not print out as expected.  If you
14 % have problems LaTeXing this file, please contact 
15 % the documentation team
16 % email: lyx-docs@lists.lyx.org
17
18 \usepackage[all]{xy}
19
20 % define new commands used in sec. 5.1
21 \newcommand{\xyR}[1]{
22   \xydef@\xymatrixrowsep@{#1}}
23 \newcommand{\xyC}[1]{
24   \xydef@\xymatrixcolsep@{#1}}
25
26 \newdir{|>}{!/4.5pt/@{|}*:(1,-.2)@^{>}*:(1,+.2)@_{>}}
27
28 % a pdf-bookmark for the TOC is added
29 \let\myTOC\tableofcontents
30 \renewcommand\tableofcontents{%
31   \pdfbookmark[1]{\contentsname}{}
32   \myTOC }
33
34 % redefine the \LyX macro for PDF bookmarks
35 \def\LyX{\texorpdfstring{%
36   L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}
37   {LyX}}
38
39 % if pdflatex is used
40 \usepackage{ifpdf}
41 \ifpdf
42
43 % set fonts for nicer pdf view
44 \IfFileExists{lmodern.sty}
45  {\usepackage{lmodern}}{}
46
47 \fi % end if pdflatex is used
48 \end_preamble
49 \options BCOR7.5mm
50 \use_default_options false
51 \maintain_unincluded_children false
52 \language english
53 \language_package default
54 \inputencoding auto
55 \fontencoding global
56 \font_roman "default" "default"
57 \font_sans "default" "default"
58 \font_typewriter "default" "default"
59 \font_math "auto" "auto"
60 \font_default_family default
61 \use_non_tex_fonts false
62 \font_sc false
63 \font_osf false
64 \font_sf_scale 100 100
65 \font_tt_scale 100 100
66 \graphics default
67 \default_output_format default
68 \output_sync 0
69 \bibtex_command default
70 \index_command default
71 \paperfontsize 12
72 \spacing single
73 \use_hyperref true
74 \pdf_title "Using XY-pc in LyX"
75 \pdf_author "H. Peter Gumm"
76 \pdf_subject "LyX's XY-pic manual"
77 \pdf_keywords "LyX, documentation"
78 \pdf_bookmarks true
79 \pdf_bookmarksnumbered true
80 \pdf_bookmarksopen true
81 \pdf_bookmarksopenlevel 2
82 \pdf_breaklinks false
83 \pdf_pdfborder false
84 \pdf_colorlinks true
85 \pdf_backref false
86 \pdf_pdfusetitle false
87 \pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue,pdfpagelayout=OneColumn, pdfnewwindow=true,pdfstartview=XYZ, plainpages=false"
88 \papersize a4paper
89 \use_geometry false
90 \use_package amsmath 1
91 \use_package amssymb 1
92 \use_package cancel 0
93 \use_package esint 0
94 \use_package mathdots 1
95 \use_package mathtools 0
96 \use_package mhchem 1
97 \use_package stackrel 0
98 \use_package stmaryrd 0
99 \use_package undertilde 0
100 \cite_engine basic
101 \cite_engine_type default
102 \biblio_style plain
103 \use_bibtopic false
104 \use_indices false
105 \paperorientation portrait
106 \suppress_date false
107 \justification true
108 \use_refstyle 0
109 \notefontcolor #0000ff
110 \index Index
111 \shortcut idx
112 \color #008000
113 \end_index
114 \secnumdepth 3
115 \tocdepth 3
116 \paragraph_separation indent
117 \paragraph_indentation default
118 \quotes_language english
119 \papercolumns 1
120 \papersides 2
121 \paperpagestyle default
122 \tracking_changes false
123 \output_changes false
124 \html_math_output 0
125 \html_css_as_file 0
126 \html_be_strict true
127 \end_header
128
129 \begin_body
130
131 \begin_layout Title
132 Using 
133 \begin_inset ERT
134 status collapsed
135
136 \begin_layout Plain Layout
137
138
139 \backslash
140 Xy
141 \end_layout
142
143 \end_inset
144
145 -pic in \SpecialChar LyX
146
147 \end_layout
148
149 \begin_layout Author
150 H.
151  Peter Gumm
152 \end_layout
153
154 \begin_layout Abstract
155 With the recent versions of \SpecialChar LyX
156  and with the 
157 \family typewriter
158 preview
159 \family default
160 -style installed in the \SpecialChar LaTeX
161 -System, the graph drawing package 
162 \family typewriter
163
164 \begin_inset ERT
165 status collapsed
166
167 \begin_layout Plain Layout
168
169
170 \backslash
171 Xy
172 \end_layout
173
174 \end_inset
175
176
177 \family default
178 -pic can be conveniently used inside \SpecialChar LyX
179 .
180  Diagrams can be edited and displayed inside the main \SpecialChar LyX
181  editing window.
182  Here, we shall describe how to use the 
183 \family typewriter
184
185 \backslash
186 xymatrix
187 \family default
188  command from 
189 \family typewriter
190 xypic
191 \family default
192  inside \SpecialChar LyX
193  in order to draw, to edit and to preview diagrams as typically
194  used in category theory, algebra, and related fields.
195  
196 \end_layout
197
198 \begin_layout Abstract
199 \begin_inset CommandInset toc
200 LatexCommand tableofcontents
201
202 \end_inset
203
204
205 \end_layout
206
207 \begin_layout Section
208 Introduction 
209 \end_layout
210
211 \begin_layout Standard
212 The 
213 \family typewriter
214 xypic
215 \family default
216 -package has long served as a convenient tool for easily constructing graphs
217  and diagrams in \SpecialChar LaTeX
218 .
219  Unfortunately, its use in \SpecialChar LyX
220  had long been restricted to the infamous \SpecialChar TeX
221  code
222  boxes, meaning that the \SpecialChar LyX
223  editor could only display the \SpecialChar LaTeX
224 -source and not
225  the finished diagram.
226  The new 
227 \family typewriter
228 preview
229 \family default
230 -style of \SpecialChar LaTeX
231  which is part of the AUC\SpecialChar TeX
232  project
233 \begin_inset CommandInset citation
234 LatexCommand cite
235 key "AUCTeX"
236
237 \end_inset
238
239 , finally enables the editing and displaying of 
240 \family typewriter
241 xypic
242 \family default
243 -diagrams, constructed, displayed and interactively edited inside \SpecialChar LyX
244 .
245 \end_layout
246
247 \begin_layout Standard
248 \begin_inset VSpace defskip
249 \end_inset
250
251
252 \end_layout
253
254 \begin_layout Standard
255 \align center
256 \begin_inset Graphics
257         filename xyfigure.png
258         width 75col%
259
260 \end_inset
261
262
263 \end_layout
264
265 \begin_layout Standard
266 \begin_inset VSpace defskip
267 \end_inset
268
269
270 \end_layout
271
272 \begin_layout Standard
273 In this note, we describe how 
274 \begin_inset ERT
275 status collapsed
276
277 \begin_layout Plain Layout
278
279
280 \backslash
281 Xy
282 \end_layout
283
284 \end_inset
285
286 -pic can be used from inside \SpecialChar LyX
287 , how diagrams can be created and edited.
288  We have tested the following using \SpecialChar LyX
289  versions 1.3.7 up to 1.6, running under
290  Windows
291 \begin_inset space \thinspace{}
292 \end_inset
293
294 XP and under Windows Vista.
295  
296 \end_layout
297
298 \begin_layout Standard
299 There are two modes of operations: For a start, and for some first tests,
300  it may be easiest to first enter the 
301 \begin_inset ERT
302 status collapsed
303
304 \begin_layout Plain Layout
305
306
307 \backslash
308 Xy
309 \end_layout
310
311 \end_inset
312
313 -pic code inside the \SpecialChar LyX
314 -window, select it all and convert it to a graphical
315  representation by pressing 
316 \family sans
317 Ctrl-m
318 \family default
319  or 
320 \family sans
321 Ctrl-M
322 \family default
323 .
324  If you use 
325 \begin_inset ERT
326 status collapsed
327
328 \begin_layout Plain Layout
329
330
331 \backslash
332 Xy
333 \end_layout
334
335 \end_inset
336
337 -pic more frequently, or if you want to modify your initial figure, you
338  will want to assemble and modify your figures using \SpecialChar LyX
339 's math editor.
340  
341 \end_layout
342
343 \begin_layout Standard
344 Once the cursor is moved over a diagram, this is displayed as an array of
345  nodes and arrow-commands.
346  These can be changed interactively.
347  When the cursor leaves the editing area, the diagram reappears.
348  
349 \end_layout
350
351 \begin_layout Standard
352 In the first two sections of this documentation, we explain how to use \SpecialChar LyX
353
354  in the first mentioned mode and we introduce all 
355 \begin_inset ERT
356 status collapsed
357
358 \begin_layout Plain Layout
359
360
361 \backslash
362 Xy
363 \end_layout
364
365 \end_inset
366
367 -pic features that might be of use for drawing commutative diagrams, graphs
368  or automata.
369  Section 
370 \begin_inset CommandInset ref
371 LatexCommand ref
372 reference "sec:math-editor"
373
374 \end_inset
375
376  explains how to use the 
377 \begin_inset ERT
378 status collapsed
379
380 \begin_layout Plain Layout
381
382
383 \backslash
384 Xy
385 \end_layout
386
387 \end_inset
388
389 -pic commands inside a math-editing area.
390  
391 \end_layout
392
393 \begin_layout Standard
394 It is not our intention to write another introduction to 
395 \begin_inset ERT
396 status collapsed
397
398 \begin_layout Plain Layout
399
400
401 \backslash
402 Xy
403 \end_layout
404
405 \end_inset
406
407 -pic, rather our motivation is to give an introduction how the most important
408  commands work inside \SpecialChar LyX
409 , since the keystrokes as explained in the 
410 \begin_inset ERT
411 status collapsed
412
413 \begin_layout Plain Layout
414
415
416 \backslash
417 Xy
418 \end_layout
419
420 \end_inset
421
422 -pic manual
423 \begin_inset CommandInset citation
424 LatexCommand cite
425 key "xypic manual"
426
427 \end_inset
428
429  will not always function correctly inside \SpecialChar LyX
430 .
431  
432 \end_layout
433
434 \begin_layout Section
435 Preparation
436 \end_layout
437
438 \begin_layout Standard
439 The following requires that the \SpecialChar LaTeX
440 -packages 
441 \family typewriter
442 xypic
443 \family default
444  and 
445 \family typewriter
446 preview
447 \family default
448  are installed in the \SpecialChar LaTeX
449  system.
450  They are available from CTAN, see at 
451 \begin_inset CommandInset citation
452 LatexCommand cite
453 key "instant-preview"
454
455 \end_inset
456
457 , resp.
458  at 
459 \begin_inset CommandInset citation
460 LatexCommand cite
461 key "xypic"
462
463 \end_inset
464
465 .
466  After freshly installing them, it may be necessary, to run 
467 \family sans
468 Tools\SpecialChar menuseparator
469 Reconfigure
470 \family default
471  from the main \SpecialChar LyX
472  menu.
473  The steps to a first diagram output in \SpecialChar LyX
474  are then:
475 \end_layout
476
477 \begin_layout Enumerate
478 Activate and test 
479 \family typewriter
480 preview
481 \end_layout
482
483 \begin_deeper
484 \begin_layout Enumerate
485 Open \SpecialChar LyX
486 , choose 
487 \family sans
488 Tools\SpecialChar menuseparator
489 Preferences\SpecialChar menuseparator
490 Look and Feel\SpecialChar menuseparator
491 Display
492 \family default
493  and turn 
494 \emph on
495 Instant Preview
496 \emph default
497  on.
498 \end_layout
499
500 \begin_layout Enumerate
501 In 
502 \family sans
503 Document\SpecialChar menuseparator
504 Settings\SpecialChar menuseparator
505 Math
506 \begin_inset space ~
507 \end_inset
508
509 Options
510 \family default
511 , uncheck 
512 \emph on
513 Use AMS Math package automatically
514 \emph default
515  and check 
516 \emph on
517 Use AMS Math package
518 \emph default
519 .
520 \end_layout
521
522 \begin_layout Enumerate
523 Test, if 
524 \family typewriter
525 instant-preview
526 \family default
527  works by opening a \SpecialChar LyX
528 -document and entering any math-formula, e.
529 \begin_inset space \thinspace{}
530 \end_inset
531
532 g.
533 \begin_inset space \space{}
534 \end_inset
535
536
537 \begin_inset Formula $a+b=c$
538 \end_inset
539
540 .
541  
542 \end_layout
543
544 \begin_layout Enumerate
545 Move the cursor out of the formula, and watch it change its appearance to
546  look just like in the finished DVI- or PostScript document.
547  
548 \end_layout
549
550 \end_deeper
551 \begin_layout Enumerate
552 Activate and test 
553 \begin_inset ERT
554 status collapsed
555
556 \begin_layout Plain Layout
557
558
559 \backslash
560 Xy
561 \end_layout
562
563 \end_inset
564
565 -pic
566 \family typewriter
567 :
568 \end_layout
569
570 \begin_deeper
571 \begin_layout Enumerate
572 Inside your \SpecialChar LyX
573 -Document, enter the text 
574 \family typewriter
575
576 \begin_inset Newline newline
577 \end_inset
578
579
580 \backslash
581 xymatrix{A 
582 \backslash
583 ar[r] & B}
584 \family default
585  .
586 \end_layout
587
588 \begin_layout Enumerate
589 Select the whole text and choose 
590 \family sans
591 Insert\SpecialChar menuseparator
592 Math\SpecialChar menuseparator
593 Display Formula
594 \family default
595 , or use the corresponding keyboard shortcut 
596 \family sans
597 Ctrl-M
598 \family default
599 .
600  
601 \end_layout
602
603 \begin_layout Enumerate
604 Move the mouse cursor out of the editing box and wait for a split second
605  to see an arrow appear: 
606 \begin_inset Formula $\xymatrix{A\ar[r] & B}
607 $
608 \end_inset
609
610 .
611 \end_layout
612
613 \end_deeper
614 \begin_layout Section
615 Commutative diagrams
616 \end_layout
617
618 \begin_layout Standard
619 The following diagram, which is taken from the documentation of 
620 \begin_inset ERT
621 status collapsed
622
623 \begin_layout Plain Layout
624
625
626 \backslash
627 Xy
628 \end_layout
629
630 \end_inset
631
632 -pic
633 \begin_inset CommandInset citation
634 LatexCommand cite
635 key "xypic manual"
636
637 \end_inset
638
639  by its creator Kristoffer H.
640  Rose, will provide an example for many of the features available with that
641  package.
642  Its source code is: 
643 \end_layout
644
645 \begin_layout LyX-Code
646
647 \backslash
648 xymatrix{
649 \begin_inset Newline newline
650 \end_inset
651
652   U     
653 \backslash
654 ar@/_{1pc}/[ddr]_
655 \backslash
656 psi
657 \backslash
658 ar@/^{1pc}/[drr]^
659 \backslash
660 varphi
661 \begin_inset Newline newline
662 \end_inset
663
664
665 \backslash
666 ar@{.>}[dr]|-{(x,y)}
667 \backslash
668
669 \backslash
670
671 \begin_inset Newline newline
672 \end_inset
673
674     & X 
675 \backslash
676 times_Z Y 
677 \backslash
678 ar[d]^q 
679 \backslash
680 ar[r]_p  &  X 
681 \backslash
682 ar[d]_f
683 \backslash
684
685 \backslash
686
687 \begin_inset Newline newline
688 \end_inset
689
690     & Y 
691 \backslash
692 ar[r]^g                      &  Z }
693 \end_layout
694
695 \begin_layout LyX-Code
696
697 \end_layout
698
699 \begin_layout Standard
700 Again, to turn this code into a graphical output, select it all at once
701  starting from the 
702 \family typewriter
703
704 \backslash
705 xymatrix{
706 \family default
707  \SpecialChar ldots
708  up to the closing brace \SpecialChar ldots
709  
710 \family typewriter
711 }
712 \family default
713  and turn it into display-math as explained above.
714  A moment after the cursor leaves the math-area, you should see the diagram
715  in its full graphical glory as shown below.
716  
717 \end_layout
718
719 \begin_layout Standard
720 \begin_inset Formula $\xymatrix{U\ar@/_{1pc}/[ddr]_{\psi}\ar@/{}^{1pc}/[drr]^{\varphi}\ar@{.>}[dr]|-{(x,y)}\\
721  & X\times_{Z}Y\ar[d]^{q}\ar[r]_{p} & X\ar[d]_{f}\\
722  & Y\ar[r]^{g} & Z
723 }
724 $
725 \end_inset
726
727  
728 \end_layout
729
730 \begin_layout Subsection
731 The matrix layout of diagrams
732 \end_layout
733
734 \begin_layout Standard
735
736 \family typewriter
737 xymatrix
738 \family default
739  uses a matrix to define the layout of the vertices of a diagram.
740  For the above example, we need a 
741 \begin_inset Formula $3\times3$
742 \end_inset
743
744 -matrix of which 5 entries are used for the vertices 
745 \begin_inset Formula $U$
746 \end_inset
747
748
749 \begin_inset Formula $X\times_{Z}Y$
750 \end_inset
751
752
753 \begin_inset Formula $X$
754 \end_inset
755
756
757 \begin_inset Formula $Y$
758 \end_inset
759
760
761 \begin_inset Formula $Z$
762 \end_inset
763
764 , the other positions remaining empty.
765  In this case, the following matrix determines the layout:
766 \end_layout
767
768 \begin_layout LyX-Code
769
770 \backslash
771 xymatrix{
772 \begin_inset Newline newline
773 \end_inset
774
775     U                       
776 \backslash
777
778 \backslash
779  
780 \begin_inset Newline newline
781 \end_inset
782
783        & X
784 \backslash
785 times_Z Y   & X  
786 \backslash
787
788 \backslash
789  
790 \begin_inset Newline newline
791 \end_inset
792
793        & Y             & Z    } 
794 \end_layout
795
796 \begin_layout Standard
797 The pattern should be familiar from \SpecialChar LaTeX
798 : We see three rows, the first two being
799  terminated by the end-of-line-marker 
800 \family typewriter
801
802 \backslash
803
804 \backslash
805
806 \family default
807  .
808  Each line consists of entries, separated by the ampersand 
809 \family typewriter
810 &
811 \family default
812 .
813  
814 \end_layout
815
816 \begin_layout Subsection
817 Arrows
818 \end_layout
819
820 \begin_layout Standard
821 Having entered the vertices, we add arrows between them.
822  The basic 
823 \family typewriter
824 xypic
825 \family default
826 -command to produce an arrow is 
827 \family typewriter
828
829 \backslash
830 ar
831 \family default
832  , it is entered into the cell of the matrix where the arrow is to start.
833  The target of the arrow is defined by direction commands 
834 \family typewriter
835 u
836 \family default
837  (up) 
838 \family typewriter
839 d
840 \family default
841  (down) 
842 \family typewriter
843 l
844 \family default
845  (left), or 
846 \family typewriter
847 r
848 \family default
849  (right).
850  These can be combined to a path and enclosed in square brackets.
851  As an example, the arrows from the vertex 
852 \begin_inset Formula $U$
853 \end_inset
854
855  in the upper left corner down and right to the vertices 
856 \begin_inset Formula $X\times_{Z}Y$
857 \end_inset
858
859
860 \begin_inset Formula $Y$
861 \end_inset
862
863 , and 
864 \begin_inset Formula $X$
865 \end_inset
866
867  are, respectively, defined as 
868 \family typewriter
869
870 \backslash
871 ar[dr]
872 \family default
873
874 \family typewriter
875
876 \backslash
877 ar[ddr]
878 \family default
879  and 
880 \family typewriter
881
882 \backslash
883 ar[drr]
884 \family default
885 .
886  Thus the above diagram with all arrows added becomes:
887 \end_layout
888
889 \begin_layout LyX-Code
890
891 \backslash
892 xymatrix{
893 \begin_inset Newline newline
894 \end_inset
895
896     U 
897 \backslash
898 ar[ddr] 
899 \backslash
900 ar[drr] 
901 \backslash
902 ar[dr]
903 \backslash
904
905 \backslash
906
907 \begin_inset Newline newline
908 \end_inset
909
910     & X 
911 \backslash
912 times_Z Y 
913 \backslash
914 ar[d] 
915 \backslash
916 ar[r]& X 
917 \backslash
918 ar[d]
919 \backslash
920
921 \backslash
922
923 \begin_inset Newline newline
924 \end_inset
925
926     & Y 
927 \backslash
928 ar[r] & Z }
929 \end_layout
930
931 \begin_layout LyX-Code
932 \begin_inset Formula $\xymatrix{U\ar[ddr]\ar[drr]\ar[dr]\\
933  & X\times_{Z}Y\ar[d]\ar[r] & X\ar[d]\\
934  & Y\ar[r] & Z
935 }
936 $
937 \end_inset
938
939
940 \end_layout
941
942 \begin_layout LyX-Code
943
944 \end_layout
945
946 \begin_layout LyX-Code
947
948 \end_layout
949
950 \begin_layout Subsection
951 Labels
952 \end_layout
953
954 \begin_layout Standard
955 Labels are attached to arrows by affixing them as upper or lower indices
956  to the 
957 \family typewriter
958
959 \backslash
960 ar
961 \family default
962 -command.
963  Thus, 
964 \family typewriter
965
966 \backslash
967 ar[drr]^
968 \backslash
969 varphi
970 \family default
971  defines an arrow going one cell down, two to the right and having the label
972  
973 \begin_inset Formula $\varphi$
974 \end_inset
975
976  attached above.
977  To attach a label below the arrow, make it a lower index as in 
978 \family typewriter
979
980 \backslash
981 ar[ddr]_
982 \backslash
983 psi
984 \family default
985 .
986  This explanation is correct only for arrows pointing to the right.
987  More precisely, imagine looking along the arrow in the direction it is
988  pointing.
989  Then an upper index places a label to the left and a lower index places
990  it to the right.
991  Consequently, an arrow pointing from right to left, such as 
992 \family typewriter
993
994 \backslash
995 ar[l]^
996 \backslash
997 alpha_
998 \backslash
999 beta
1000 \family default
1001  will have label 
1002 \begin_inset Formula $\alpha$
1003 \end_inset
1004
1005  below and label 
1006 \begin_inset Formula $\beta$
1007 \end_inset
1008
1009  above the arrow, e.
1010 \begin_inset space \thinspace{}
1011 \end_inset
1012
1013 g.
1014 \begin_inset space \space{}
1015 \end_inset
1016
1017
1018 \begin_inset Formula $\xymatrix{\  & \ \ar[l]_{\beta}^{\alpha}.}
1019 $
1020 \end_inset
1021
1022 Using the character | instead of ^ or _ , it is even possible to place the
1023  label right onto the arrow, obscuring part of its shaft.
1024  
1025 \end_layout
1026
1027 \begin_layout Standard
1028 Normally, a label is placed halfway between an arrow's start and target
1029  objects.
1030  In the first diagram, the central arrow starting in 
1031 \begin_inset Formula $U$
1032 \end_inset
1033
1034  has the label 
1035 \begin_inset Formula $(x,y)$
1036 \end_inset
1037
1038  in the middle of the arrow's shaft, rather than in the middle between the
1039  two objects it connects.
1040  This is achieved by prefixing the label with a minus sign, here: 
1041 \family typewriter
1042
1043 \backslash
1044 ar[dr]|-{(x,y)}
1045 \family default
1046 .
1047 \end_layout
1048
1049 \begin_layout LyX-Code
1050
1051 \backslash
1052 xymatrix{
1053 \begin_inset Newline newline
1054 \end_inset
1055
1056     U 
1057 \backslash
1058 ar[ddr]_
1059 \backslash
1060 psi 
1061 \backslash
1062 ar[drr]^
1063 \backslash
1064 varphi
1065 \backslash
1066 ar[dr]|-{(x,y)}
1067 \backslash
1068
1069 \backslash
1070
1071 \begin_inset Newline newline
1072 \end_inset
1073
1074     & X 
1075 \backslash
1076 times_Z Y 
1077 \backslash
1078 ar[d]^q 
1079 \backslash
1080 ar[r]_p& X 
1081 \backslash
1082 ar[d]_f
1083 \backslash
1084
1085 \backslash
1086
1087 \begin_inset Newline newline
1088 \end_inset
1089
1090     & Y 
1091 \backslash
1092 ar[r]^g & Z }
1093 \end_layout
1094
1095 \begin_layout LyX-Code
1096 \begin_inset Formula $\xymatrix{U\ar[ddr]_{\psi}\ar[drr]^{\varphi}\ar[dr]|-{(x,y)}\\
1097  & X\times_{Z}Y\ar[d]^{q}\ar[r]_{p} & X\ar[d]_{f}\\
1098  & Y\ar[r]^{g} & Z
1099 }
1100 $
1101 \end_inset
1102
1103
1104 \end_layout
1105
1106 \begin_layout Standard
1107 \begin_inset ERT
1108 status collapsed
1109
1110 \begin_layout Plain Layout
1111
1112
1113 \backslash
1114 Xy
1115 \end_layout
1116
1117 \end_inset
1118
1119 -pic normally permits labels to be shifted towards the tip or towards the
1120  start of an arrow by prefixing the label with a ratio, such as e.
1121 \begin_inset space \thinspace{}
1122 \end_inset
1123
1124 g.
1125 \begin_inset space \space{}
1126 \end_inset
1127
1128
1129 \family typewriter
1130 (.3)
1131 \family default
1132 .
1133  In \SpecialChar LyX
1134  this works only for labels which are placed on top of the arrow, such
1135  as 
1136 \family typewriter
1137
1138 \backslash
1139 ar[r]|(0.3){
1140 \backslash
1141 phi}
1142 \family default
1143 .
1144  
1145 \end_layout
1146
1147 \begin_layout Standard
1148 For labels placed to the left or to the right of the arrow this does not
1149  work.
1150  The corresponding 
1151 \begin_inset ERT
1152 status collapsed
1153
1154 \begin_layout Plain Layout
1155
1156
1157 \backslash
1158 Xy
1159 \end_layout
1160
1161 \end_inset
1162
1163 -pic code such as e.
1164 \begin_inset space \thinspace{}
1165 \end_inset
1166
1167 g.
1168 \begin_inset space \space{}
1169 \end_inset
1170
1171
1172 \family typewriter
1173
1174 \backslash
1175 ar[r]^(.3)
1176 \backslash
1177 phi
1178 \family default
1179  or 
1180 \family typewriter
1181
1182 \backslash
1183 ar[r]_(.3)
1184 \backslash
1185 psi
1186 \family default
1187  is not correctly interpreted by \SpecialChar LyX
1188 's math editor.
1189  Two workarounds are suggested in the last section of this note.
1190 \end_layout
1191
1192 \begin_layout Subsection
1193 Arrow modification
1194 \end_layout
1195
1196 \begin_layout Standard
1197 Modification of the design, the form or the positioning of arrows are introduced
1198  by the 
1199 \family typewriter
1200 @
1201 \family default
1202 -character.
1203  This is followed by a pair of matching brackets, where the form of the
1204  bracket pair, 
1205 \family typewriter
1206 { }
1207 \family default
1208  or 
1209 \family typewriter
1210 < >
1211 \family default
1212  or 
1213 \family typewriter
1214 / /
1215 \family default
1216  indicates, whether we want to modify the design, the or the curvature of
1217  the arrow.
1218  Various modifications can be applied to an arrow at the same time.
1219 \end_layout
1220
1221 \begin_layout Subsubsection
1222 Arrow design
1223 \end_layout
1224
1225 \begin_layout Standard
1226 Various designs such as 
1227 \emph on
1228 solid
1229 \emph default
1230
1231 \emph on
1232 dotted
1233 \emph default
1234
1235 \emph on
1236 dashed
1237 \emph default
1238  or 
1239 \emph on
1240 double
1241 \emph default
1242  are possible for the shaft of an arrow.
1243  These can be combined with various ends and various tips.
1244  In general, the design of an arrow is described by following the command
1245  
1246 \family typewriter
1247
1248 \backslash
1249 ar
1250 \family default
1251  immediately by an 
1252 \family typewriter
1253 @
1254 \family default
1255 -sign and a pair of braces {\SpecialChar ldots
1256 } containing characters describing the end,
1257  the shaft and the tip of the arrow.
1258  These characters are chosen to give some form of ASCII-rendering of the
1259  real thing.
1260  For instance 
1261 \family typewriter
1262
1263 \backslash
1264 ar@{>..>>}
1265 \family default
1266  produces an arrow with split end, a dotted shaft and double head.
1267  A number of other arrow designs is given in the table below.
1268  Note that the ends of embedding arrows 
1269 \begin_inset Formula $\xymatrix{A\ar@{^{(}->}[r] & B}
1270 $
1271 \end_inset
1272
1273  are described by raising or lowering opening parentheses, such as in 
1274 \family typewriter
1275
1276 \backslash
1277 ar@{^(->}[r].
1278 \end_layout
1279
1280 \begin_layout Standard
1281 \align center
1282 \begin_inset Tabular
1283 <lyxtabular version="3" rows="11" columns="2">
1284 <features tabularvalignment="middle">
1285 <column alignment="center" valignment="top" width="0pt">
1286 <column alignment="center" valignment="top">
1287 <row>
1288 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1289 \begin_inset Text
1290
1291 \begin_layout Plain Layout
1292 Result
1293 \end_layout
1294
1295 \end_inset
1296 </cell>
1297 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1298 \begin_inset Text
1299
1300 \begin_layout Plain Layout
1301 Source code in \SpecialChar LyX
1302
1303 \end_layout
1304
1305 \end_inset
1306 </cell>
1307 </row>
1308 <row>
1309 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1310 \begin_inset Text
1311
1312 \begin_layout Plain Layout
1313 \begin_inset Formula $\xymatrix{\ \ar[r] & \ }
1314 $
1315 \end_inset
1316
1317  
1318 \end_layout
1319
1320 \end_inset
1321 </cell>
1322 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1323 \begin_inset Text
1324
1325 \begin_layout Plain Layout
1326
1327 \family typewriter
1328
1329 \backslash
1330 ar 
1331 \end_layout
1332
1333 \end_inset
1334 </cell>
1335 </row>
1336 <row>
1337 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1338 \begin_inset Text
1339
1340 \begin_layout Plain Layout
1341 \begin_inset Formula $\xymatrix{\ \ar@{-->}[r] & \ }
1342 $
1343 \end_inset
1344
1345  
1346 \end_layout
1347
1348 \end_inset
1349 </cell>
1350 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1351 \begin_inset Text
1352
1353 \begin_layout Plain Layout
1354
1355 \family typewriter
1356
1357 \backslash
1358 ar@{-->}
1359 \end_layout
1360
1361 \end_inset
1362 </cell>
1363 </row>
1364 <row>
1365 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1366 \begin_inset Text
1367
1368 \begin_layout Plain Layout
1369 \begin_inset Formula $\xymatrix{\ \ar@{..>}[r] & \ }
1370 $
1371 \end_inset
1372
1373  
1374 \end_layout
1375
1376 \end_inset
1377 </cell>
1378 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1379 \begin_inset Text
1380
1381 \begin_layout Plain Layout
1382
1383 \family typewriter
1384
1385 \backslash
1386 ar@{..>}
1387 \end_layout
1388
1389 \end_inset
1390 </cell>
1391 </row>
1392 <row>
1393 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1394 \begin_inset Text
1395
1396 \begin_layout Plain Layout
1397 \begin_inset Formula $\xymatrix{\ \ar@{~>}[r] & \ }
1398 $
1399 \end_inset
1400
1401  
1402 \end_layout
1403
1404 \end_inset
1405 </cell>
1406 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1407 \begin_inset Text
1408
1409 \begin_layout Plain Layout
1410
1411 \family typewriter
1412
1413 \backslash
1414 ar@{~>}
1415 \end_layout
1416
1417 \end_inset
1418 </cell>
1419 </row>
1420 <row>
1421 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1422 \begin_inset Text
1423
1424 \begin_layout Plain Layout
1425 \begin_inset Formula $\xymatrix{\ \ar@{->>}[r] & \ }
1426 $
1427 \end_inset
1428
1429
1430 \end_layout
1431
1432 \end_inset
1433 </cell>
1434 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1435 \begin_inset Text
1436
1437 \begin_layout Plain Layout
1438
1439 \family typewriter
1440
1441 \backslash
1442 ar@{->>}
1443 \end_layout
1444
1445 \end_inset
1446 </cell>
1447 </row>
1448 <row>
1449 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1450 \begin_inset Text
1451
1452 \begin_layout Plain Layout
1453 \begin_inset Formula $\xymatrix{\ \ar@{-->>}[r] & \ }
1454 $
1455 \end_inset
1456
1457
1458 \end_layout
1459
1460 \end_inset
1461 </cell>
1462 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1463 \begin_inset Text
1464
1465 \begin_layout Plain Layout
1466
1467 \family typewriter
1468
1469 \backslash
1470 ar@{-->>}
1471 \end_layout
1472
1473 \end_inset
1474 </cell>
1475 </row>
1476 <row>
1477 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1478 \begin_inset Text
1479
1480 \begin_layout Plain Layout
1481 \begin_inset Formula $\xymatrix{\ \ar@{>->>}[r] & \ }
1482 $
1483 \end_inset
1484
1485
1486 \end_layout
1487
1488 \end_inset
1489 </cell>
1490 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1491 \begin_inset Text
1492
1493 \begin_layout Plain Layout
1494
1495 \family typewriter
1496
1497 \backslash
1498 ar@{>->>}
1499 \end_layout
1500
1501 \end_inset
1502 </cell>
1503 </row>
1504 <row>
1505 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1506 \begin_inset Text
1507
1508 \begin_layout Plain Layout
1509 \begin_inset Formula $\xymatrix{\ \ar@{_{(}->}[r] & \ }
1510 $
1511 \end_inset
1512
1513
1514 \end_layout
1515
1516 \end_inset
1517 </cell>
1518 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1519 \begin_inset Text
1520
1521 \begin_layout Plain Layout
1522
1523 \family typewriter
1524
1525 \backslash
1526 ar@{_(->}
1527 \end_layout
1528
1529 \end_inset
1530 </cell>
1531 </row>
1532 <row>
1533 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1534 \begin_inset Text
1535
1536 \begin_layout Plain Layout
1537 \begin_inset Formula $\xymatrix{\ \ar@{^{(}->}[r] & \ }
1538 $
1539 \end_inset
1540
1541
1542 \end_layout
1543
1544 \end_inset
1545 </cell>
1546 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1547 \begin_inset Text
1548
1549 \begin_layout Plain Layout
1550
1551 \family typewriter
1552
1553 \backslash
1554 ar@{^(->}
1555 \end_layout
1556
1557 \end_inset
1558 </cell>
1559 </row>
1560 <row>
1561 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1562 \begin_inset Text
1563
1564 \begin_layout Plain Layout
1565 \begin_inset Formula $\xymatrix{\ \ar@{|-|}[r] & \ }
1566 $
1567 \end_inset
1568
1569
1570 \end_layout
1571
1572 \end_inset
1573 </cell>
1574 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1575 \begin_inset Text
1576
1577 \begin_layout Plain Layout
1578
1579 \family typewriter
1580
1581 \backslash
1582 ar@{|-|}
1583 \end_layout
1584
1585 \end_inset
1586 </cell>
1587 </row>
1588 </lyxtabular>
1589
1590 \end_inset
1591
1592
1593 \end_layout
1594
1595 \begin_layout Standard
1596 \noindent
1597 Following the @-character by either a 2, 3, _ or a ^, we can produce arrows
1598  with double, triple shaft or arrows showing only the lower or upper half
1599  of their tips and ends.
1600  Arrows need not have tips nor ends, as the last example shows:
1601 \end_layout
1602
1603 \begin_layout Standard
1604 \align center
1605 \begin_inset Tabular
1606 <lyxtabular version="3" rows="8" columns="2">
1607 <features tabularvalignment="middle">
1608 <column alignment="center" valignment="top">
1609 <column alignment="center" valignment="top">
1610 <row>
1611 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1612 \begin_inset Text
1613
1614 \begin_layout Plain Layout
1615 Result 
1616 \end_layout
1617
1618 \end_inset
1619 </cell>
1620 <cell alignment="center" valignment="top" topline="true" bottomline="true" rightline="true" usebox="none">
1621 \begin_inset Text
1622
1623 \begin_layout Plain Layout
1624 Source code for \SpecialChar LyX
1625
1626 \end_layout
1627
1628 \end_inset
1629 </cell>
1630 </row>
1631 <row>
1632 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1633 \begin_inset Text
1634
1635 \begin_layout Plain Layout
1636 \begin_inset Formula $\xymatrix{\ \ar@2[r] & \ }
1637 $
1638 \end_inset
1639
1640  
1641 \end_layout
1642
1643 \end_inset
1644 </cell>
1645 <cell alignment="center" valignment="top" topline="true" rightline="true" usebox="none">
1646 \begin_inset Text
1647
1648 \begin_layout Plain Layout
1649
1650 \family typewriter
1651
1652 \backslash
1653 ar@2
1654 \end_layout
1655
1656 \end_inset
1657 </cell>
1658 </row>
1659 <row>
1660 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1661 \begin_inset Text
1662
1663 \begin_layout Plain Layout
1664 \begin_inset Formula $\xymatrix{\ \ar@3[r] & \ }
1665 $
1666 \end_inset
1667
1668  
1669 \end_layout
1670
1671 \end_inset
1672 </cell>
1673 <cell alignment="center" valignment="top" topline="true" rightline="true" usebox="none">
1674 \begin_inset Text
1675
1676 \begin_layout Plain Layout
1677
1678 \family typewriter
1679
1680 \backslash
1681 ar@3
1682 \end_layout
1683
1684 \end_inset
1685 </cell>
1686 </row>
1687 <row>
1688 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1689 \begin_inset Text
1690
1691 \begin_layout Plain Layout
1692 \begin_inset Formula $\xymatrix{\ \ar@_{->}[r] & \ }
1693 $
1694 \end_inset
1695
1696  
1697 \end_layout
1698
1699 \end_inset
1700 </cell>
1701 <cell alignment="center" valignment="top" topline="true" rightline="true" usebox="none">
1702 \begin_inset Text
1703
1704 \begin_layout Plain Layout
1705
1706 \family typewriter
1707
1708 \backslash
1709 ar@_{->}
1710 \end_layout
1711
1712 \end_inset
1713 </cell>
1714 </row>
1715 <row>
1716 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1717 \begin_inset Text
1718
1719 \begin_layout Plain Layout
1720 \begin_inset Formula $\xymatrix{\ \ar@^{->}[r] & \ }
1721 $
1722 \end_inset
1723
1724  
1725 \end_layout
1726
1727 \end_inset
1728 </cell>
1729 <cell alignment="center" valignment="top" topline="true" rightline="true" usebox="none">
1730 \begin_inset Text
1731
1732 \begin_layout Plain Layout
1733
1734 \family typewriter
1735
1736 \backslash
1737 ar@^{->}
1738 \end_layout
1739
1740 \end_inset
1741 </cell>
1742 </row>
1743 <row>
1744 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1745 \begin_inset Text
1746
1747 \begin_layout Plain Layout
1748 \begin_inset Formula $\xymatrix{\ \ar@^{>>->>}[r] & \ }
1749 $
1750 \end_inset
1751
1752  
1753 \end_layout
1754
1755 \end_inset
1756 </cell>
1757 <cell alignment="center" valignment="top" topline="true" rightline="true" usebox="none">
1758 \begin_inset Text
1759
1760 \begin_layout Plain Layout
1761
1762 \family typewriter
1763
1764 \backslash
1765 ar@^{>\SpecialChar ligaturebreak
1766 >->\SpecialChar ligaturebreak
1767 >}
1768 \end_layout
1769
1770 \end_inset
1771 </cell>
1772 </row>
1773 <row>
1774 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1775 \begin_inset Text
1776
1777 \begin_layout Plain Layout
1778 \begin_inset Formula $\xymatrix{\ \ar@{^{<}-_{>}}[r] & \ }
1779 $
1780 \end_inset
1781
1782  
1783 \end_layout
1784
1785 \end_inset
1786 </cell>
1787 <cell alignment="center" valignment="top" topline="true" bottomline="true" rightline="true" usebox="none">
1788 \begin_inset Text
1789
1790 \begin_layout Plain Layout
1791
1792 \family typewriter
1793
1794 \backslash
1795 ar@{^<-_>}
1796 \end_layout
1797
1798 \end_inset
1799 </cell>
1800 </row>
1801 <row>
1802 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1803 \begin_inset Text
1804
1805 \begin_layout Plain Layout
1806 \begin_inset Formula $\xymatrix{\ \ar@2{--}[r] & \ }
1807 $
1808 \end_inset
1809
1810  
1811 \end_layout
1812
1813 \end_inset
1814 </cell>
1815 <cell alignment="center" valignment="top" topline="true" bottomline="true" rightline="true" usebox="none">
1816 \begin_inset Text
1817
1818 \begin_layout Plain Layout
1819
1820 \family typewriter
1821
1822 \backslash
1823 ar@2{--}
1824 \end_layout
1825
1826 \end_inset
1827 </cell>
1828 </row>
1829 </lyxtabular>
1830
1831 \end_inset
1832
1833
1834 \end_layout
1835
1836 \begin_layout Subsubsection
1837 Designing your own arrows
1838 \end_layout
1839
1840 \begin_layout Standard
1841 Within certain limits there is even a way to design your own arrows.
1842  Using some the characters 
1843 \family typewriter
1844 ><|ox+/()[
1845 \family default
1846  one can even design one's own arrow tips using the 
1847 \family typewriter
1848
1849 \backslash
1850 newdir
1851 \family default
1852  command in the preamble.
1853  For explanations, we refer to the 
1854 \family typewriter
1855
1856 \begin_inset ERT
1857 status collapsed
1858
1859 \begin_layout Plain Layout
1860
1861
1862 \backslash
1863 Xy
1864 \end_layout
1865
1866 \end_inset
1867
1868
1869 \family default
1870 -manual, from which we take the example: 
1871 \end_layout
1872
1873 \begin_layout Standard
1874
1875 \family typewriter
1876
1877 \backslash
1878 newdir{|>}{!/4.5pt/@{|}*:(1,-.2)@^{>}*:(1,+.2)@_{>}}
1879 \family default
1880 .
1881 \end_layout
1882
1883 \begin_layout Standard
1884 \noindent
1885 This defines a new arrow tip, referred to as 
1886 \family typewriter
1887 |>
1888 \family default
1889  in 
1890 \family typewriter
1891
1892 \backslash
1893 ar@{-|>}[r]
1894 \family default
1895  and which displays correctly in \SpecialChar LyX
1896  as:
1897 \begin_inset Formula 
1898 \[
1899 \xymatrix{A\ar@{-|>}[r] & \ \ B}
1900 \]
1901
1902 \end_inset
1903
1904
1905 \end_layout
1906
1907 \begin_layout Subsection
1908 Arrow positioning
1909 \end_layout
1910
1911 \begin_layout Standard
1912 Arrows are shifted sideways with the modifier 
1913 \family typewriter
1914 @<
1915 \family default
1916
1917 \begin_inset Formula $\ldots$
1918 \end_inset
1919
1920  
1921 \family typewriter
1922 >
1923 \family default
1924  where the ellipsis is replaced by a positive or negative measure.
1925  For instance, to design a pair of mutually opposing arrows between two
1926  nodes, we shift them to see them apart.
1927  Note that the direction of the shift (positive) is to the left if one looks
1928  along the arrow.
1929  Thus
1930 \end_layout
1931
1932 \begin_layout Standard
1933
1934 \family typewriter
1935
1936 \backslash
1937 xymatrix{
1938 \backslash
1939 circ 
1940 \backslash
1941 ar@<1ex>[r]& 
1942 \backslash
1943 circ 
1944 \backslash
1945 ar@<1ex>[l]}
1946 \end_layout
1947
1948 \begin_layout Standard
1949 \noindent
1950 produces
1951 \begin_inset Formula 
1952 \[
1953 \xymatrix{\circ\ar@<1ex>[r] & \circ\ar@<1ex>[l]}
1954 \]
1955
1956 \end_inset
1957
1958
1959 \end_layout
1960
1961 \begin_layout Subsubsection
1962 Inline or centered diagrams
1963 \end_layout
1964
1965 \begin_layout Standard
1966 Arrows and diagrams can be used inline, such as this one: 
1967 \begin_inset Formula $\xymatrix{\circ\ar@<1ex>[r] & \circ\ar@<1ex>[l]}
1968 $
1969 \end_inset
1970
1971 .
1972  When their code is written inside \SpecialChar LyX
1973  as above, select it and choose either
1974  
1975 \family sans
1976 Ctrl-m
1977 \family default
1978  for inline appearance or 
1979 \family sans
1980 Ctrl-M
1981 \family default
1982  for displaystyle.
1983  Diagrams constructed inline can later be centered, or, conversely, centered
1984  diagrams can be changed to inline formulas with 
1985 \family sans
1986 Edit\SpecialChar menuseparator
1987 Math
1988 \family default
1989  
1990 \family sans
1991 \SpecialChar menuseparator
1992 Change Formula Type.
1993 \end_layout
1994
1995 \begin_layout Subsection
1996 Bending arrows
1997 \end_layout
1998
1999 \begin_layout Standard
2000 There are two simple methods to make arrows bend.
2001  The first is giving an explicit value by which the midpoint of the arrow's
2002  shaft is raised or depressed, the other is by forcing the arrow to leave
2003  its origin in a prescribed compass direction and to make him enter the
2004  target at another direction.
2005  The necessary bending of the arrow is determined automatically.
2006  We describe both methods.
2007 \end_layout
2008
2009 \begin_layout Subsubsection
2010 Raising the shaft
2011 \end_layout
2012
2013 \begin_layout Standard
2014 For bending arrows we use the modifier @/
2015 \begin_inset Formula $\ldots$
2016 \end_inset
2017
2018 / .
2019  The ellipsis stands for a \SpecialChar TeX
2020 -measure which needs to be entered as a lower
2021  or upper index.
2022  Whereas in 
2023 \family typewriter
2024 xypic
2025 \family default
2026 , we could simply write, e.
2027 \begin_inset space \thinspace{}
2028 \end_inset
2029
2030 g.
2031 \begin_inset space \space{}
2032 \end_inset
2033
2034
2035 \family typewriter
2036
2037 \backslash
2038 ar@/_1pc/
2039 \family default
2040  for an arrow bending 
2041 \family typewriter
2042 1pc
2043 \family default
2044  downwards, this cannot directly be done in \SpecialChar LyX
2045 .
2046  It is necessary, to enclose the measure in a pair of braces, such as e.
2047 \begin_inset space \thinspace{}
2048 \end_inset
2049
2050 g.
2051 \begin_inset space \space{}
2052 \end_inset
2053
2054
2055 \family typewriter
2056
2057 \backslash
2058 ar@/_{1pc}/
2059 \family default
2060 .
2061  As an example, here are two opposing arrows between 
2062 \begin_inset Formula $A$
2063 \end_inset
2064
2065  and 
2066 \begin_inset Formula $B$
2067 \end_inset
2068
2069 , each bending by .5 pica, given by the following source code: 
2070 \end_layout
2071
2072 \begin_layout Standard
2073
2074 \family typewriter
2075
2076 \backslash
2077 xymatrix{A 
2078 \backslash
2079 ar@/_{.5pc}/[r] & B 
2080 \backslash
2081 ar@/_{.5pc}/[l]}
2082 \end_layout
2083
2084 \begin_layout Standard
2085 \begin_inset Formula 
2086 \[
2087 \xymatrix{A\ar@/{}_{.5pc}/[r] & B\ar@/{}_{.5pc}/[l]}
2088 \]
2089
2090 \end_inset
2091
2092
2093 \end_layout
2094
2095 \begin_layout Subsubsection
2096 Specifying exit- and entrance directions
2097 \end_layout
2098
2099 \begin_layout Standard
2100 An alternative for making arrows bend is by specifying their compass direction
2101  as they are leaving their source and their direction from which they enter
2102  their target.
2103  Instead of north, north-east, east, etc., the directions are named 
2104 \family typewriter
2105 u
2106 \family default
2107
2108 \family typewriter
2109 ur
2110 \family default
2111
2112 \family typewriter
2113 r
2114 \family default
2115
2116 \family typewriter
2117 dr
2118 \family default
2119
2120 \family typewriter
2121 d
2122 \family default
2123
2124 \family typewriter
2125 dl
2126 \family default
2127
2128 \family typewriter
2129 l
2130 \family default
2131
2132 \family typewriter
2133 ul
2134 \family default
2135 , standing for up, up-right, right, down-right, etc..
2136  A direction is specified as @(
2137 \emph on
2138 out
2139 \emph default
2140 ,
2141 \emph on
2142 in
2143 \emph default
2144 ) where 
2145 \emph on
2146 out
2147 \emph default
2148  stands for the direction the first object is left and 
2149 \emph on
2150 in
2151 \emph default
2152  stands for the direction from which the target is entered.
2153  As an example, we show some bending arrows and a loop, which arises when
2154  we do not specify a target for an arrow, just its incoming and outgoing
2155  direction:
2156 \end_layout
2157
2158 \begin_layout Standard
2159 \begin_inset Formula 
2160 \[
2161 \xymatrix{A\ar@(dr,dl)[r]\ar@(dr,dl)[rr] & B\ar@(d,r)[dl] & C\\
2162 E\ar@(ul,ur)
2163 }
2164 \]
2165
2166 \end_inset
2167
2168
2169 \end_layout
2170
2171 \begin_layout LyX-Code
2172
2173 \backslash
2174 xymatrix{A 
2175 \backslash
2176 ar@(dr,dl)[r]
2177 \backslash
2178 ar@(dr,dl)[rr] 
2179 \begin_inset Newline newline
2180 \end_inset
2181
2182                     &B
2183 \backslash
2184 ar@(d,r)[dl]  &C 
2185 \backslash
2186
2187 \backslash
2188  
2189 \begin_inset Newline newline
2190 \end_inset
2191
2192             E 
2193 \backslash
2194 ar@(ul,ur)}
2195 \end_layout
2196
2197 \begin_layout Subsection
2198 Modifying vertices
2199 \end_layout
2200
2201 \begin_layout Standard
2202 The above example is reminiscent of an automata diagram, except that in
2203  such a diagram states would be enclosed in small circles, with double circles
2204  denoting final states.
2205  
2206 \end_layout
2207
2208 \begin_layout Subsubsection
2209 Framing objects
2210 \end_layout
2211
2212 \begin_layout Standard
2213 With 
2214 \begin_inset ERT
2215 status collapsed
2216
2217 \begin_layout Plain Layout
2218
2219
2220 \backslash
2221 Xy
2222 \end_layout
2223
2224 \end_inset
2225
2226 -pic, entries can obtain a single or a double frame, such as 
2227 \begin_inset Formula $\xymatrix{*+[F]{A}}
2228 $
2229 \end_inset
2230
2231  or 
2232 \begin_inset Formula $\xymatrix{*+[F=]{B}}
2233 $
2234 \end_inset
2235
2236  by prefixing an entry with 
2237 \family typewriter
2238 *[F-]
2239 \family default
2240  or 
2241 \family typewriter
2242 *[F=]
2243 \family default
2244  and enclosing the portion of the entry to be framed in braces.
2245  Normally, the frame will be very tight so that it must be widened by prefixing
2246  with 
2247 \family typewriter
2248 +
2249 \family default
2250  or with 
2251 \family typewriter
2252 ++
2253 \family default
2254 .
2255  Round frames, such as 
2256 \begin_inset Formula $\xymatrix{*++[o][F]{A}}
2257 $
2258 \end_inset
2259
2260  and 
2261 \begin_inset Formula $\xymatrix{*++[o][F=]{B}}
2262 $
2263 \end_inset
2264
2265  are obtained by specifying the shape as 
2266 \family typewriter
2267 [o].
2268
2269 \family default
2270  So the latter figure was constructed as *++[o][F=]{B}.
2271  This way, the following automaton 
2272 \end_layout
2273
2274 \begin_layout Standard
2275 \begin_inset Formula 
2276 \[
2277 \xymatrix{\txt{start}\ar[r] & *++[o][F]{1}\ar[r] & *++[o][F=]{2}\ar@(ur,dr)\ar@(ur,ul)[l]}
2278 \]
2279
2280 \end_inset
2281
2282
2283 \end_layout
2284
2285 \begin_layout Standard
2286 \noindent
2287 can be typeset as
2288 \end_layout
2289
2290 \begin_layout LyX-Code
2291
2292 \backslash
2293 xymatrix{
2294 \backslash
2295 txt{start}
2296 \backslash
2297 ar[r]
2298 \end_layout
2299
2300 \begin_layout LyX-Code
2301             & *++[o][F]{1}
2302 \backslash
2303 ar[r]
2304 \end_layout
2305
2306 \begin_layout LyX-Code
2307             & *++[o][F=]{2}
2308 \backslash
2309 ar@(ur,dr)
2310 \backslash
2311 ar@(ur,ul)[l]
2312 \end_layout
2313
2314 \begin_layout LyX-Code
2315            }.
2316 \end_layout
2317
2318 \begin_layout Standard
2319 The \SpecialChar LaTeX
2320  command 
2321 \family typewriter
2322
2323 \backslash
2324 entrymodifiers={
2325 \family default
2326 \SpecialChar ldots
2327
2328 \family typewriter
2329 }
2330 \family default
2331  will make a certain entry style the default, that can, of course be overridden
2332  for individual entries.
2333  Thus, after 
2334 \family typewriter
2335
2336 \backslash
2337 entrymodifiers={++[o][F-]}
2338 \family default
2339 , all following entries inside 
2340 \begin_inset ERT
2341 status collapsed
2342
2343 \begin_layout Plain Layout
2344
2345
2346 \backslash
2347 Xy
2348 \end_layout
2349
2350 \end_inset
2351
2352 -matrices would be encircled.
2353 \end_layout
2354
2355 \begin_layout Subsubsection
2356 Framing rectangles
2357 \end_layout
2358
2359 \begin_layout Standard
2360 Framing a whole rectangle inside an xymatrix is done with the macro pair
2361  
2362 \family typewriter
2363
2364 \backslash
2365 save ...
2366  
2367 \backslash
2368 restore
2369 \family default
2370 .
2371  
2372 \family roman
2373 \series medium
2374 \shape up
2375 \size normal
2376 \emph off
2377 \bar no
2378 \noun off
2379 \color none
2380 The dimension of the rectangle is given as a dotted pair 
2381 \begin_inset Formula $P_{0}.P_{1}$
2382 \end_inset
2383
2384  of points denoting the top left and lower right corners of the rectangle.
2385  Each point, in turn,is given as a doubly quoted comma separated pair 
2386 \begin_inset Quotes eld
2387 \end_inset
2388
2389
2390 \begin_inset Formula $x,y$
2391 \end_inset
2392
2393
2394 \begin_inset Quotes erd
2395 \end_inset
2396
2397  specifying row 
2398 \begin_inset Formula $x$
2399 \end_inset
2400
2401  and column 
2402 \begin_inset Formula $y$
2403 \end_inset
2404
2405 .
2406  These are followed by the framing commands, to produce figures such as
2407  the following: 
2408 \begin_inset Formula 
2409 \[
2410 \xymatrix{A & B\ar@(d,r)[dl]\sp(0.2)\phi\sp(0.7)\psi\save"1,1"."2,1"*+[F=]\frm{}\restore\,\\
2411 C & \save"1,1"."1,2"*++[F]\frm{}\restore
2412 }
2413 \]
2414
2415 \end_inset
2416
2417  Here, the code 
2418 \family typewriter
2419 \series default
2420 \shape default
2421 \size default
2422 \emph default
2423 \bar default
2424 \noun default
2425 \color inherit
2426
2427 \backslash
2428 save"1,1"."2,1"*+[F=]
2429 \backslash
2430 frm{}
2431 \backslash
2432 restore
2433 \family roman
2434 \series medium
2435 \shape up
2436 \size normal
2437 \emph off
2438 \bar no
2439 \noun off
2440 \color none
2441  produces the doubly framed rectangle, and the code for the extra wide horizonta
2442 l rectangle is 
2443 \family typewriter
2444 \series default
2445 \shape default
2446 \size default
2447 \emph default
2448 \bar default
2449 \noun default
2450 \color inherit
2451
2452 \backslash
2453 save"1,1"."1,2"*++[F]
2454 \backslash
2455 frm{}
2456 \backslash
2457 restore
2458 \family roman
2459 \series medium
2460 \shape up
2461 \size normal
2462 \emph off
2463 \bar no
2464 \noun off
2465 \color none
2466 .
2467  This code can be placed in arbitrary cells of the xymatrix.
2468  
2469 \end_layout
2470
2471 \begin_layout Section
2472 Using \SpecialChar LyX
2473 's math editor
2474 \begin_inset CommandInset label
2475 LatexCommand label
2476 name "sec:math-editor"
2477
2478 \end_inset
2479
2480
2481 \end_layout
2482
2483 \begin_layout Standard
2484 As an alternative to writing the 
2485 \family typewriter
2486 xypic
2487 \family default
2488  code, then transforming it into a math-editing environment by marking it
2489  and applying 
2490 \family sans
2491 Ctrl-m
2492 \family default
2493 , or 
2494 \family sans
2495 Ctrl-M
2496 \family default
2497 , one may construct and modify the whole xypic-diagram inside \SpecialChar LyX
2498 's math editor.
2499  We describe the editing steps for a figure just like the one above.
2500  
2501 \end_layout
2502
2503 \begin_layout Subsection
2504 Caveat - how to enter braces
2505 \end_layout
2506
2507 \begin_layout Standard
2508 Recall that in \SpecialChar LyX
2509 's math-editor any pair of braces 
2510 \family typewriter
2511 {
2512 \family default
2513  and 
2514 \family typewriter
2515 }
2516 \family default
2517  that are to enclose a macro-parameter must be entered by typing just 
2518 \family typewriter
2519
2520 \backslash
2521 {
2522 \family default
2523  .
2524  The closing brace is automatically supplied and in between a box into which
2525  to the parameter is entered.
2526  In connection with 
2527 \begin_inset ERT
2528 status collapsed
2529
2530 \begin_layout Plain Layout
2531
2532
2533 \backslash
2534 Xy
2535 \end_layout
2536
2537 \end_inset
2538
2539 -diagrams, this applies in particular to arrow modifications that are normally
2540  given in the form 
2541 \family typewriter
2542 @{
2543 \family default
2544  \SpecialChar ldots
2545  
2546 \family typewriter
2547 }
2548 \family default
2549  with the ellipsis standing for the description of end, shaft and tip of
2550  the arrow.
2551  Inside the math-editor, enter just 
2552 \family typewriter
2553 @
2554 \backslash
2555 {
2556 \family default
2557  and let \SpecialChar LyX
2558  provide the closing brace and the box into which to enter the
2559  description of the arrow.
2560 \end_layout
2561
2562 \begin_layout Standard
2563 Braces that are entered without the backslash 
2564 \family typewriter
2565
2566 \backslash
2567
2568 \family default
2569  will just appear as typed, but cannot be used to receive a macro parameter.
2570  They are useful, for instance to denote sets, e.
2571 \begin_inset space \thinspace{}
2572 \end_inset
2573
2574 g.
2575 \begin_inset space \space{}
2576 \end_inset
2577
2578
2579 \family typewriter
2580 {x
2581 \backslash
2582 in X 
2583 \backslash
2584 mid x
2585 \backslash
2586 notin x}
2587 \family default
2588  will display as 
2589 \begin_inset Formula $\{x\in X\mid x\notin x\}$
2590 \end_inset
2591
2592 .
2593 \end_layout
2594
2595 \begin_layout Subsection
2596 Setting up the matrix
2597 \end_layout
2598
2599 \begin_layout Standard
2600 With 
2601 \family sans
2602 Ctrl-m
2603 \family default
2604  or 
2605 \family sans
2606 Ctrl-M
2607 \family default
2608  open a formula environment and enter: 
2609 \family typewriter
2610
2611 \backslash
2612 xymatrix
2613 \family default
2614 .
2615  This produces a 1
2616 \begin_inset Formula $\times$
2617 \end_inset
2618
2619 1- 
2620 \begin_inset ERT
2621 status collapsed
2622
2623 \begin_layout Plain Layout
2624
2625
2626 \backslash
2627 Xy
2628 \end_layout
2629
2630 \end_inset
2631
2632 -matrix.
2633  Add extra rows by typing 
2634 \family sans
2635 Ctrl-Enter
2636 \family default
2637  and add columns by typing 
2638 \family sans
2639 Alt-m c i.
2640  
2641 \end_layout
2642
2643 \begin_layout Standard
2644 At any time, further rows or columns can be entered or deleted using commands
2645  available from 
2646 \family sans
2647 Edit\SpecialChar menuseparator
2648 Math,
2649 \family default
2650  resp.
2651  their shortcuts, beginning with 
2652 \family sans
2653 Alt-m c
2654 \family default
2655  for the column commands or 
2656 \family sans
2657 Alt-m w
2658 \family default
2659  for the row commands.
2660  A more direct way uses the icons in the math toolbar once it has been activated
2661  via 
2662 \family sans
2663 View\SpecialChar menuseparator
2664 Toolbars.
2665 \end_layout
2666
2667 \begin_layout Subsection
2668 Entering nodes, arrows and labels
2669 \end_layout
2670
2671 \begin_layout Standard
2672 Type the nodes into the correct positions of the matrix.
2673  If you move the cursor out of the matrix, you should see a first rendering
2674  of the node layout.
2675  Next, add the arrows at the nodes from where they should emanate by typing
2676  
2677 \family typewriter
2678
2679 \backslash
2680 ar[
2681 \family default
2682 \emph on
2683 p
2684 \family typewriter
2685 \emph default
2686 ]
2687 \family default
2688 , where 
2689 \emph on
2690 p
2691 \emph default
2692  can be any path made up from the characters 
2693 \family typewriter
2694 u
2695 \family default
2696
2697 \family typewriter
2698 d
2699 \family default
2700
2701 \family typewriter
2702 l
2703 \family default
2704
2705 \family typewriter
2706 r
2707 \family default
2708 .
2709  Make sure that the path indeed leads to an existing node within the matrix.
2710  Otherwise, the figure will not display when the cursor leaves the editing
2711  area.
2712 \end_layout
2713
2714 \begin_layout Standard
2715 Next, label the arrows by attaching a label text as upper or lower indices
2716  to the end of the arrow's path.
2717  As always in \SpecialChar LyX
2718 's math editor, an underscore 
2719 \family typewriter
2720 _
2721 \family default
2722  opens a box for a lower index and a 
2723 \family typewriter
2724 ^
2725 \family default
2726  followed by a space opens a box for an upper index.
2727  You can enter any \SpecialChar LaTeX
2728 -code as a label.
2729 \end_layout
2730
2731 \begin_layout Subsection
2732 Modifying arrows
2733 \end_layout
2734
2735 \begin_layout Standard
2736 Finally, you can modify the appearance of the arrows by entering @-modifiers
2737  
2738 \family typewriter
2739 @{
2740 \family default
2741 \SpecialChar ldots
2742
2743 \family typewriter
2744 }
2745 \family default
2746
2747 \family typewriter
2748 @<
2749 \family default
2750 \SpecialChar ldots
2751 >, 
2752 \family typewriter
2753 @(
2754 \family default
2755 \SpecialChar ldots
2756 ,\SpecialChar ldots
2757 ) or 
2758 \family typewriter
2759 @/
2760 \family default
2761 \SpecialChar ldots
2762
2763 \family typewriter
2764 /
2765 \family default
2766 .
2767  The above caveat applies to the first form only.
2768  It must be entered as 
2769 \family typewriter
2770 @
2771 \backslash
2772 {
2773 \family default
2774  with the arrow description entered inside the \SpecialChar LyX
2775 -supplied box.
2776  If this box remains empty, you have specified an empty arrow.
2777  This is a useful construction, too, as you will see in the next section.
2778  
2779 \end_layout
2780
2781 \begin_layout Standard
2782 The other modifiers, 
2783 \family typewriter
2784 @<
2785 \family default
2786 \SpecialChar ldots
2787
2788 \family typewriter
2789 >
2790 \family default
2791
2792 \family typewriter
2793 @(
2794 \family default
2795 \SpecialChar ldots
2796 ,\SpecialChar ldots
2797
2798 \family typewriter
2799
2800 \family default
2801 and 
2802 \family typewriter
2803 @/
2804 \family default
2805 \SpecialChar ldots
2806
2807 \family typewriter
2808
2809 \family default
2810 are typed as shown with the arrow description replacing the ellipsis.
2811  The code for bending arrows, which in 
2812 \family typewriter
2813 xypic
2814 \family default
2815  is 
2816 \family typewriter
2817 @/_
2818 \family default
2819 \emph on
2820 measure
2821 \family typewriter
2822 \emph default
2823
2824 \family default
2825 or 
2826 \family typewriter
2827 @/
2828 \emph on
2829 ^
2830 \family default
2831 measure
2832 \family typewriter
2833 \emph default
2834
2835 \family default
2836 where 
2837 \emph on
2838 measure
2839 \emph default
2840  is any valid \SpecialChar TeX
2841 -measure that should be entered as upper or lower index to
2842  the first slash /.
2843  Make sure that the ending slash does not end up being part of the upper
2844  or lower index.
2845 \end_layout
2846
2847 \begin_layout Subsection
2848 What if something goes wrong
2849 \end_layout
2850
2851 \begin_layout Standard
2852 When constructing a diagram, you should at times check it by just moving
2853  the cursor out of the editing area to see whether instant preview can successfu
2854 lly convert it into graphical output.
2855  If this does not happen, it may either be that instant preview for some
2856  reason is not aware that it should retranslate the graphics.
2857  Moving the cursor into the editing area and out again sometimes wakes up
2858  instant preview.
2859 \end_layout
2860
2861 \begin_layout Standard
2862 A more serious reason could be a syntactical error in your input (in that
2863  case, the math edition area disappears completely).
2864  If necessary, undo the last editing steps, using 
2865 \family sans
2866 Ctrl+Z
2867 \family default
2868 , or try to translate the \SpecialChar LyX
2869 -file into 
2870 \family sans
2871 DVI
2872 \family default
2873  using 
2874 \family sans
2875 Ctrl+D
2876 \family default
2877  or 
2878 \family sans
2879 View\SpecialChar menuseparator
2880 DVI
2881 \family default
2882 .
2883  There should be some error generated, which hopefully gives you a hint
2884  as to the source of the mistake.
2885 \end_layout
2886
2887 \begin_layout Section
2888 Hacks
2889 \end_layout
2890
2891 \begin_layout Standard
2892 Certain things do not work correctly inside \SpecialChar LyX
2893 .
2894  The ones that we (used to) miss most are the horizontal and vertical scaling
2895  of diagrams, and the correct positioning of arrows.
2896  There are some workarounds that we are explaining here.
2897  
2898 \end_layout
2899
2900 \begin_layout Subsection
2901 Horizontal and vertical scaling
2902 \end_layout
2903
2904 \begin_layout Standard
2905 It is often convenient to stretch the horizontal or the vertical dimensions
2906  of an entire diagram by using spacing commands for rows and/or columns.
2907  According to the 
2908 \begin_inset ERT
2909 status collapsed
2910
2911 \begin_layout Plain Layout
2912
2913
2914 \backslash
2915 Xy
2916 \end_layout
2917
2918 \end_inset
2919
2920 -manual, 
2921 \begin_inset CommandInset citation
2922 LatexCommand cite
2923 key "xypic manual"
2924
2925 \end_inset
2926
2927 , for instance, 
2928 \family typewriter
2929
2930 \backslash
2931 xymatrix@R=1pc{
2932 \family default
2933 \SpecialChar ldots
2934
2935 \family typewriter
2936 }
2937 \family default
2938  defines an 
2939 \begin_inset ERT
2940 status collapsed
2941
2942 \begin_layout Plain Layout
2943
2944
2945 \backslash
2946 Xy
2947 \end_layout
2948
2949 \end_inset
2950
2951 -matrix with row spacing of 1
2952 \begin_inset space ~
2953 \end_inset
2954
2955 pica.
2956  Similarly, 
2957 \family typewriter
2958
2959 \backslash
2960 xymatrix@C=
2961 \family default
2962 \SpecialChar ldots
2963
2964 \family typewriter
2965 {
2966 \family default
2967 \SpecialChar ldots
2968
2969 \family typewriter
2970 }
2971 \family default
2972  allows to modify the space between columns.
2973  Unfortunately, one cannot type 
2974 \begin_inset Quotes eld
2975 \end_inset
2976
2977
2978 \family typewriter
2979
2980 \backslash
2981 xymatrix@R=1pc
2982 \family default
2983
2984 \begin_inset Quotes erd
2985 \end_inset
2986
2987  into a formula to get the desired matrix because the @-character is interpreted
2988  by \SpecialChar LyX
2989  as ending the 
2990 \family typewriter
2991
2992 \backslash
2993 xymatrix
2994 \family default
2995  command.
2996  But there are two other ways of getting the desired matrix:
2997 \end_layout
2998
2999 \begin_layout Itemize
3000 One types e.g.
3001 \begin_inset space \space{}
3002 \end_inset
3003
3004
3005 \family typewriter
3006
3007 \backslash
3008 xymatrix@R=1pc
3009 \family default
3010  as normal document text, then either highlight it and press 
3011 \begin_inset Info
3012 type  "shortcut"
3013 arg   "math-mode"
3014 \end_inset
3015
3016  to get a formula, or copy it into an existing formula.
3017  You can now continue as normal.
3018 \begin_inset Newline newline
3019 \end_inset
3020
3021
3022 \begin_inset Note Greyedout
3023 status open
3024
3025 \begin_layout Plain Layout
3026
3027 \series bold
3028 Note:
3029 \series default
3030  This method only works for single spacing settings, so using
3031 \begin_inset Newline newline
3032 \end_inset
3033
3034
3035 \family typewriter
3036
3037 \backslash
3038 xymatrix@M=1pt
3039 \family default
3040  is possible while 
3041 \family typewriter
3042
3043 \backslash
3044 xymatrix@M=1pt@C=1dd
3045 \family default
3046  is not.
3047  The method also don't work if you use '!' to get a fixed grid with a defined
3048  dimension, e.g.
3049 \begin_inset space \space{}
3050 \end_inset
3051
3052
3053 \family typewriter
3054
3055 \backslash
3056 xymatrix@!R=3pt
3057 \family default
3058  fails while
3059 \family typewriter
3060  
3061 \backslash
3062 xymatrix@!R
3063 \family default
3064  works.
3065 \end_layout
3066
3067 \end_inset
3068
3069
3070 \begin_inset Newline newline
3071 \end_inset
3072
3073 For the following matrix, the command 
3074 \family typewriter
3075
3076 \backslash
3077 xymatrix@C=9pc
3078 \family default
3079  was used:
3080 \begin_inset Formula 
3081 \[
3082 \xymatrix@C=9pc{A\ar[r]\ar[d] & B\\
3083 C\ar@{}[ur]|{\text{{horizontal stretch}}}
3084 }
3085 \]
3086
3087 \end_inset
3088
3089
3090 \end_layout
3091
3092 \begin_layout Itemize
3093 \begin_inset ERT
3094 status collapsed
3095
3096 \begin_layout Plain Layout
3097
3098
3099 \backslash
3100 Xy
3101 \end_layout
3102
3103 \end_inset
3104
3105
3106 \begin_inset space ~
3107 \end_inset
3108
3109  stores the values for row-spacing and column-spacing in the variables
3110 \begin_inset Newline newline
3111 \end_inset
3112
3113
3114 \family typewriter
3115
3116 \backslash
3117 xymatrixrowsep@
3118 \family default
3119  and 
3120 \family typewriter
3121
3122 \backslash
3123 xymatrixrowsep@
3124 \family default
3125 .
3126  So one can add the following macro to the preamble (
3127 \family sans
3128 Layout\SpecialChar menuseparator
3129 Document\SpecialChar menuseparator
3130 Preamble
3131 \family default
3132 ):
3133 \end_layout
3134
3135 \begin_deeper
3136 \begin_layout LyX-Code
3137
3138 \backslash
3139 newcommand{
3140 \backslash
3141 xyR}[1]{%
3142 \end_layout
3143
3144 \begin_layout LyX-Code
3145
3146 \backslash
3147 xydef@
3148 \backslash
3149 xymatrixrowsep@{#1}}
3150 \end_layout
3151
3152 \begin_layout Standard
3153 A macro 
3154 \family typewriter
3155
3156 \backslash
3157 xyC
3158 \family default
3159  can be defined correspondingly by replacing 
3160 \family typewriter
3161
3162 \backslash
3163 xymatrixrowsep@
3164 \family default
3165  with 
3166 \family typewriter
3167
3168 \backslash
3169 xymatrixcolsep@
3170 \family default
3171 .
3172  Now, a figure can be scaled by entering 
3173 \backslash
3174 xyR{ into the formula before the 
3175 \begin_inset ERT
3176 status collapsed
3177
3178 \begin_layout Plain Layout
3179
3180
3181 \backslash
3182 Xy
3183 \end_layout
3184
3185 \end_inset
3186
3187 -matrix.
3188  Place the cursor inside the matrix, just before the first entry.
3189  Then enter 
3190 \family typewriter
3191
3192 \backslash
3193 xyR
3194 \backslash
3195 {
3196 \family default
3197  or 
3198 \family typewriter
3199
3200 \backslash
3201 xyC
3202 \backslash
3203 {
3204 \family default
3205  or both.
3206  Don't forget the backslashes and remember, that the closing brace is automatica
3207 lly supplied by \SpecialChar LyX
3208 .
3209  Inside the braces enter the dimensions.
3210 \begin_inset Newline newline
3211 \end_inset
3212
3213
3214 \begin_inset Note Greyedout
3215 status open
3216
3217 \begin_layout Plain Layout
3218
3219 \series bold
3220 Note:
3221 \series default
3222  these commands affect all following 
3223 \begin_inset ERT
3224 status collapsed
3225
3226 \begin_layout Plain Layout
3227
3228
3229 \backslash
3230 Xy
3231 \end_layout
3232
3233 \end_inset
3234
3235 -matrices.
3236  Therefore don't forget to reset the values to default after the usage of
3237  
3238 \family typewriter
3239
3240 \backslash
3241 xyR
3242 \family default
3243  etc..
3244 \end_layout
3245
3246 \end_inset
3247
3248
3249 \begin_inset Newline newline
3250 \end_inset
3251
3252 The default is 
3253 \family typewriter
3254 2pc
3255 \family default
3256 .
3257  Here you see a diagram which is squashed vertically and stretched horizontally
3258  with 
3259 \family typewriter
3260
3261 \backslash
3262 xyR{.5pc}
3263 \backslash
3264 xyC{9pc}
3265 \family default
3266 :
3267 \begin_inset Formula 
3268 \[
3269 \xyR{.5pc}\xyC{9pc}\xymatrix{A\ar[r]\ar[d] & B\\
3270 C\ar@{}[ur]|{\text{{horizontal stretch}}}
3271 }
3272 \]
3273
3274 \end_inset
3275
3276
3277 \begin_inset Formula $\xyR{2pc}\xyC{2pc}$
3278 \end_inset
3279
3280
3281 \begin_inset Note Note
3282 status collapsed
3283
3284 \begin_layout Plain Layout
3285 reset to default
3286 \end_layout
3287
3288 \end_inset
3289
3290
3291 \end_layout
3292
3293 \end_deeper
3294 \begin_layout Subsection
3295 Label positioning
3296 \end_layout
3297
3298 \begin_layout Standard
3299 Another useful 
3300 \begin_inset ERT
3301 status collapsed
3302
3303 \begin_layout Plain Layout
3304
3305
3306 \backslash
3307 Xy
3308 \end_layout
3309
3310 \end_inset
3311
3312 -command allows the correct positioning of labels along the shaft of arrows.
3313  This feature is sometimes necessary, when the default position of a label
3314  would otherwise clutter the picture, or would even coincide with other
3315  items, such as the intersection of the arrows in the figure below.
3316  In order to shift a label position alongside the shaft of an arrow, 
3317 \begin_inset ERT
3318 status collapsed
3319
3320 \begin_layout Plain Layout
3321
3322
3323 \backslash
3324 Xy
3325 \end_layout
3326
3327 \end_inset
3328
3329
3330 \begin_inset space ~
3331 \end_inset
3332
3333  allows to prefix the label by a decimal number in parentheses, specifying
3334  the fraction of distance alongside the arrow where the label is to be placed.
3335  For instance, the code 
3336 \family typewriter
3337
3338 \backslash
3339 ar[r]|(0.3)
3340 \backslash
3341 varphi
3342 \family default
3343 , will place the label on the shaft, but only about one third of the way.
3344  
3345 \end_layout
3346
3347 \begin_layout Standard
3348 Doing the same with labels above or below arrows as 
3349 \family typewriter
3350
3351 \backslash
3352 ar[dr]^(0.3)
3353 \backslash
3354 varphi,
3355 \family default
3356  respectively 
3357 \family typewriter
3358
3359 \backslash
3360 ar[ur]_(0.3)
3361 \backslash
3362 phi
3363 \family default
3364 , does not work from inside \SpecialChar LyX
3365 .
3366  Instead, one has to replace the hat-symbol ^, resp.
3367  the underscore _ , by the macros 
3368 \family typewriter
3369
3370 \backslash
3371 sp
3372 \family default
3373 , resp.
3374  
3375 \family typewriter
3376
3377 \backslash
3378 sb
3379 \family default
3380 , obtaining 
3381 \family typewriter
3382
3383 \backslash
3384 ar[dr]
3385 \backslash
3386 sp(0.3)
3387 \backslash
3388 varphi 
3389 \family default
3390 and
3391 \family typewriter
3392  
3393 \backslash
3394 ar[ur]
3395 \backslash
3396 sb(0.3)
3397 \backslash
3398 phi.
3399  
3400 \family default
3401 It is, in fact, possible to enter several labels this way and those labels
3402  are placed correctly, even if the arrow bends.
3403  In the following figure, the bending arrow with its four labels has been
3404  produced with 
3405 \family typewriter
3406
3407 \backslash
3408 ar@(r,r)[d] 
3409 \backslash
3410 sp(0.2){
3411 \backslash
3412 phi_{1}} 
3413 \backslash
3414 sp(0.4){
3415 \backslash
3416 phi_{2}} 
3417 \backslash
3418 sb(0.6){
3419 \backslash
3420 phi_{3}} 
3421 \backslash
3422 sp(0.8){
3423 \backslash
3424 phi_{4}}.
3425 \end_layout
3426
3427 \begin_layout Standard
3428 \begin_inset Formula 
3429 \[
3430 \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}}\\
3431 \circ\ar[ur]\sb(0.3)\phi & \bullet
3432 }
3433 \]
3434
3435 \end_inset
3436
3437
3438 \end_layout
3439
3440 \begin_layout Subsection
3441 Invisible stretched arrows
3442 \end_layout
3443
3444 \begin_layout Standard
3445 A more general trick uses invisible arrows to place any object almost anywhere
3446  inside a diagram.
3447  Produce an invisible arrow, shorten (or prolong) it past its goal by adding
3448  a decimal stretching ratio, e.
3449 \begin_inset space \thinspace{}
3450 \end_inset
3451
3452 g.
3453 \begin_inset space \space{}
3454 \end_inset
3455
3456
3457 \family typewriter
3458 (0.6)
3459 \family default
3460  or 
3461 \family typewriter
3462 (1.4)
3463 \family default
3464  to its path.
3465  Attach a label to this invisible arrow.
3466  
3467 \end_layout
3468
3469 \begin_layout Standard
3470 Thus, the down pointing arrow with its label 
3471 \begin_inset Formula $\varphi$
3472 \end_inset
3473
3474  at (0.3) of its way along the shaft might as well have been produced by
3475  adding to the regular arrow 
3476 \family typewriter
3477
3478 \backslash
3479 ar[dr] 
3480 \family default
3481 an invisible 
3482 \begin_inset Formula $\varphi$
3483 \end_inset
3484
3485 -labelled arrow 
3486 \family typewriter
3487
3488 \backslash
3489 ar@{}[dr(0.6)]^
3490 \backslash
3491 varphi
3492 \family default
3493 , reaching only 0.6 of the way.
3494  Its label will now appear at 0.3 of the way of the original visible arrow.
3495  
3496 \end_layout
3497
3498 \begin_layout Standard
3499 This workaround has two minor drawbacks: First, it does not work with bending
3500  arrows.
3501  Secondly, prolonging an invisible arrow beyond the normal dimension of
3502  the figure will invisibly extend the figure box, and thereby cause too
3503  much vertical space between the figure and the preceding or the following
3504  paragraph.
3505  
3506 \end_layout
3507
3508 \begin_layout Standard
3509 Nevertheless, invisible arrows are an important tool, since they can, in
3510  principle, be used to place information at any chosen place in a diagram.
3511  In the above figure, for instance, we have used an invisible arrow to carry
3512  the 
3513 \family typewriter
3514
3515 \backslash
3516 vdots
3517 \family default
3518  as label and at the earlier figure we had used an invisible arrow to carry
3519  the text 
3520 \begin_inset Quotes eld
3521 \end_inset
3522
3523
3524 \family typewriter
3525 horizontal stretch
3526 \family default
3527
3528 \begin_inset Quotes erd
3529 \end_inset
3530
3531  into the center of the figure.
3532 \end_layout
3533
3534 \begin_layout Subsection
3535 Further 
3536 \family typewriter
3537 Xy
3538 \family default
3539 -tricks
3540 \end_layout
3541
3542 \begin_layout Standard
3543 Here we have focused only on the 
3544 \family typewriter
3545
3546 \backslash
3547 xymatrix
3548 \family default
3549  command, which is just one of the features available in Kris Rose's amazing
3550 \family typewriter
3551  
3552 \begin_inset ERT
3553 status collapsed
3554
3555 \begin_layout Plain Layout
3556
3557
3558 \backslash
3559 Xy
3560 \end_layout
3561
3562 \end_inset
3563
3564
3565 \family default
3566 -package.
3567  The 
3568 \family typewriter
3569
3570 \begin_inset ERT
3571 status collapsed
3572
3573 \begin_layout Plain Layout
3574
3575
3576 \backslash
3577 Xy
3578 \end_layout
3579
3580 \end_inset
3581
3582
3583 \family default
3584 -pic manual 
3585 \begin_inset CommandInset citation
3586 LatexCommand cite
3587 key "xypic manual"
3588
3589 \end_inset
3590
3591  demonstrates many of the advanced possibilities of that package.
3592  Beware, that its style is rather terse and you will likely need a lot of
3593  experimenting and modifying the many worked examples.
3594  Lauda 
3595 \begin_inset CommandInset citation
3596 LatexCommand cite
3597 key "Lauda"
3598
3599 \end_inset
3600
3601  explains how to use 
3602 \begin_inset ERT
3603 status collapsed
3604
3605 \begin_layout Plain Layout
3606
3607
3608 \backslash
3609 Xy
3610 \end_layout
3611
3612 \end_inset
3613
3614 -pic to make braids, cobordism, string diagrams, and much more.
3615  You might want to look on 
3616 \family typewriter
3617 inset_preview.lyx
3618 \family default
3619  example shipped with \SpecialChar LyX
3620 , which demonstrates how to use more advanced 
3621 \begin_inset ERT
3622 status collapsed
3623
3624 \begin_layout Plain Layout
3625
3626
3627 \backslash
3628 Xy
3629 \end_layout
3630
3631 \end_inset
3632
3633 -commands via 
3634 \family typewriter
3635 \SpecialChar TeX
3636
3637 \begin_inset space ~
3638 \end_inset
3639
3640 Code
3641 \family default
3642  and 
3643 \family typewriter
3644 Instant preview
3645 \family default
3646  insets.
3647 \end_layout
3648
3649 \begin_layout Standard
3650 \begin_inset Newpage newpage
3651 \end_inset
3652
3653
3654 \end_layout
3655
3656 \begin_layout Bibliography
3657 \begin_inset CommandInset bibitem
3658 LatexCommand bibitem
3659 key "xypic manual"
3660
3661 \end_inset
3662
3663 Kristoffer H.
3664  Rose: 
3665 \begin_inset ERT
3666 status collapsed
3667
3668 \begin_layout Plain Layout
3669
3670
3671 \backslash
3672 Xy
3673 \end_layout
3674
3675 \end_inset
3676
3677
3678 \emph on
3679 -pic User's Guide
3680 \emph default
3681 .
3682 \begin_inset Newline newline
3683 \end_inset
3684
3685
3686 \begin_inset Flex URL
3687 status collapsed
3688
3689 \begin_layout Plain Layout
3690
3691 https://www.ctan.org/tex-archive/macros/generic/diagrams/xypic/doc/xyguide.pdf
3692 \end_layout
3693
3694 \end_inset
3695
3696
3697 \end_layout
3698
3699 \begin_layout Bibliography
3700 \begin_inset CommandInset bibitem
3701 LatexCommand bibitem
3702 key "xypic reference"
3703
3704 \end_inset
3705
3706 Kristoffer H.
3707  Rose and Ross Moore: 
3708 \begin_inset ERT
3709 status collapsed
3710
3711 \begin_layout Plain Layout
3712
3713
3714 \backslash
3715 Xy
3716 \end_layout
3717
3718 \end_inset
3719
3720
3721 \emph on
3722 -pic Reference Manual
3723 \emph default
3724 .
3725 \begin_inset Newline newline
3726 \end_inset
3727
3728
3729 \begin_inset Flex URL
3730 status collapsed
3731
3732 \begin_layout Plain Layout
3733
3734 https://www.ctan.org/tex-archive/macros/generic/diagrams/xypic/doc/xyrefer.pdf
3735 \end_layout
3736
3737 \end_inset
3738
3739
3740 \end_layout
3741
3742 \begin_layout Bibliography
3743 \begin_inset CommandInset bibitem
3744 LatexCommand bibitem
3745 key "xypic"
3746
3747 \end_inset
3748
3749 Homepage of the package 
3750 \begin_inset ERT
3751 status collapsed
3752
3753 \begin_layout Plain Layout
3754
3755
3756 \backslash
3757 Xy
3758 \end_layout
3759
3760 \end_inset
3761
3762
3763 \emph on
3764 -pic
3765 \emph default
3766
3767 \begin_inset Flex URL
3768 status collapsed
3769
3770 \begin_layout Plain Layout
3771
3772 http://www.ctan.org/pkg/xypic
3773 \end_layout
3774
3775 \end_inset
3776
3777
3778 \end_layout
3779
3780 \begin_layout Bibliography
3781 \begin_inset CommandInset bibitem
3782 LatexCommand bibitem
3783 key "instant-preview"
3784
3785 \end_inset
3786
3787 Homepage of preview-latex:
3788 \begin_inset Newline newline
3789 \end_inset
3790
3791
3792 \begin_inset Flex URL
3793 status collapsed
3794
3795 \begin_layout Plain Layout
3796
3797 http://www.gnu.org/software/auctex/preview-latex.html
3798 \end_layout
3799
3800 \end_inset
3801
3802
3803 \end_layout
3804
3805 \begin_layout Bibliography
3806 \begin_inset CommandInset bibitem
3807 LatexCommand bibitem
3808 key "AUCTeX"
3809
3810 \end_inset
3811
3812 Homepage of AUC\SpecialChar TeX
3813
3814 \begin_inset Flex URL
3815 status collapsed
3816
3817 \begin_layout Plain Layout
3818
3819 http://www.gnu.org/software/auctex/
3820 \end_layout
3821
3822 \end_inset
3823
3824
3825 \end_layout
3826
3827 \begin_layout Bibliography
3828 \begin_inset CommandInset bibitem
3829 LatexCommand bibitem
3830 key "Lauda"
3831
3832 \end_inset
3833
3834 Aarlon Lauda: 
3835 \begin_inset ERT
3836 status collapsed
3837
3838 \begin_layout Plain Layout
3839
3840
3841 \backslash
3842 Xy
3843 \end_layout
3844
3845 \end_inset
3846
3847
3848 \emph on
3849 -pic
3850 \emph default
3851  
3852 \emph on
3853 tutorial with an archive of examples
3854 \emph default
3855 .
3856 \begin_inset Newline newline
3857 \end_inset
3858
3859
3860 \begin_inset Flex URL
3861 status open
3862
3863 \begin_layout Plain Layout
3864
3865 https://www.ctan.org/tex-archive/macros/generic/diagrams/xypic/doc/xyguide.pdf
3866 \end_layout
3867
3868 \end_inset
3869
3870
3871 \end_layout
3872
3873 \end_body
3874 \end_document