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