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