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