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