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