]> git.lyx.org Git - lyx.git/blob - lib/examples/xypic.lyx
French translation of Customization manual : final update
[lyx.git] / lib / examples / xypic.lyx
1 #LyX 2.3 created this file. For more info see http://www.lyx.org/
2 \lyxformat 544
3 \begin_document
4 \begin_header
5 \save_transient_properties true
6 \origin /systemlyxdir/examples/
7 \textclass scrartcl
8 \begin_preamble
9 % DO NOT ALTER THIS PREAMBLE!!!
10 %
11 % This preamble is designed to ensure that the file prints
12 % out as advertised. If you mess with this preamble,
13 % parts of this document may not print out as expected.  If you
14 % have problems LaTeXing this file, please contact 
15 % the documentation team
16 % email: lyx-docs@lists.lyx.org
17
18 \usepackage[all]{xy}
19
20 % define new commands used in sec. 5.1
21 \newcommand{\xyR}[1]{
22   \xydef@\xymatrixrowsep@{#1}}
23 \newcommand{\xyC}[1]{
24   \xydef@\xymatrixcolsep@{#1}}
25
26 \newdir{|>}{!/4.5pt/@{|}*:(1,-.2)@^{>}*:(1,+.2)@_{>}}
27
28 % a pdf-bookmark for the TOC is added
29 \let\myTOC\tableofcontents
30 \renewcommand\tableofcontents{%
31   \pdfbookmark[1]{\contentsname}{}
32   \myTOC }
33
34 % redefine the \LyX macro for PDF bookmarks
35 \def\LyX{\texorpdfstring{%
36   L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}
37   {LyX}}
38
39 % if pdflatex is used
40 \usepackage{ifpdf}
41 \ifpdf
42
43 % set fonts for nicer pdf view
44 \IfFileExists{lmodern.sty}
45  {\usepackage{lmodern}}{}
46
47 \fi % end if pdflatex is used
48 \end_preamble
49 \options BCOR7.5mm
50 \use_default_options false
51 \maintain_unincluded_children false
52 \language english
53 \language_package default
54 \inputencoding auto
55 \fontencoding global
56 \font_roman "default" "default"
57 \font_sans "default" "default"
58 \font_typewriter "default" "default"
59 \font_math "auto" "auto"
60 \font_default_family default
61 \use_non_tex_fonts false
62 \font_sc false
63 \font_osf false
64 \font_sf_scale 100 100
65 \font_tt_scale 100 100
66 \use_microtype false
67 \use_dash_ligatures false
68 \graphics default
69 \default_output_format default
70 \output_sync 0
71 \bibtex_command default
72 \index_command default
73 \paperfontsize 12
74 \spacing single
75 \use_hyperref true
76 \pdf_title "Using XY-pc in LyX"
77 \pdf_author "H. Peter Gumm"
78 \pdf_subject "LyX's XY-pic manual"
79 \pdf_keywords "LyX, documentation"
80 \pdf_bookmarks true
81 \pdf_bookmarksnumbered true
82 \pdf_bookmarksopen true
83 \pdf_bookmarksopenlevel 2
84 \pdf_breaklinks false
85 \pdf_pdfborder false
86 \pdf_colorlinks true
87 \pdf_backref false
88 \pdf_pdfusetitle false
89 \pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue,pdfpagelayout=OneColumn, pdfnewwindow=true,pdfstartview=XYZ, plainpages=false"
90 \papersize a4paper
91 \use_geometry false
92 \use_package amsmath 1
93 \use_package amssymb 1
94 \use_package cancel 1
95 \use_package esint 1
96 \use_package mathdots 1
97 \use_package mathtools 1
98 \use_package mhchem 1
99 \use_package stackrel 1
100 \use_package stmaryrd 1
101 \use_package undertilde 1
102 \cite_engine basic
103 \cite_engine_type default
104 \biblio_style plain
105 \use_bibtopic false
106 \use_indices false
107 \paperorientation portrait
108 \suppress_date true
109 \justification true
110 \use_refstyle 0
111 \use_minted 0
112 \notefontcolor #0000ff
113 \index Index
114 \shortcut idx
115 \color #008000
116 \end_index
117 \secnumdepth 3
118 \tocdepth 3
119 \paragraph_separation indent
120 \paragraph_indentation default
121 \is_math_indent 0
122 \math_numbering_side default
123 \quotes_style english
124 \dynamic_quotes 0
125 \papercolumns 1
126 \papersides 2
127 \paperpagestyle default
128 \tracking_changes false
129 \output_changes false
130 \html_math_output 0
131 \html_css_as_file 0
132 \html_be_strict true
133 \end_header
134
135 \begin_body
136
137 \begin_layout Title
138 Using 
139 \begin_inset ERT
140 status collapsed
141
142 \begin_layout Plain Layout
143
144
145 \backslash
146 Xy
147 \end_layout
148
149 \end_inset
150
151 -pic in \SpecialChar LyX
152
153 \end_layout
154
155 \begin_layout Author
156 H.
157  Peter Gumm
158 \end_layout
159
160 \begin_layout Abstract
161 With the recent versions of \SpecialChar LyX
162  and with the 
163 \family typewriter
164 preview
165 \family default
166 -style installed in the \SpecialChar LaTeX
167 -System, the graph drawing package 
168 \family typewriter
169
170 \begin_inset ERT
171 status collapsed
172
173 \begin_layout Plain Layout
174
175
176 \backslash
177 Xy
178 \end_layout
179
180 \end_inset
181
182
183 \family default
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 \begin_inset Formula $\ldots$
2027 \end_inset
2028
2029 / .
2030  The ellipsis stands for a \SpecialChar TeX
2031 -measure which needs to be entered as a lower
2032  or upper index.
2033  Whereas in 
2034 \family typewriter
2035 xypic
2036 \family default
2037 , we could simply write, e.
2038 \begin_inset space \thinspace{}
2039 \end_inset
2040
2041 g.
2042 \begin_inset space \space{}
2043 \end_inset
2044
2045
2046 \family typewriter
2047
2048 \backslash
2049 ar@/_1pc/
2050 \family default
2051  for an arrow bending 
2052 \family typewriter
2053 1pc
2054 \family default
2055  downwards, this cannot directly be done in \SpecialChar LyX
2056 .
2057  It is necessary, to enclose the measure in a pair of braces, such as e.
2058 \begin_inset space \thinspace{}
2059 \end_inset
2060
2061 g.
2062 \begin_inset space \space{}
2063 \end_inset
2064
2065
2066 \family typewriter
2067
2068 \backslash
2069 ar@/_{1pc}/
2070 \family default
2071 .
2072  As an example, here are two opposing arrows between 
2073 \begin_inset Formula $A$
2074 \end_inset
2075
2076  and 
2077 \begin_inset Formula $B$
2078 \end_inset
2079
2080 , each bending by .5 pica, given by the following source code: 
2081 \end_layout
2082
2083 \begin_layout Standard
2084
2085 \family typewriter
2086
2087 \backslash
2088 xymatrix{A 
2089 \backslash
2090 ar@/_{.5pc}/[r] & B 
2091 \backslash
2092 ar@/_{.5pc}/[l]}
2093 \end_layout
2094
2095 \begin_layout Standard
2096 \begin_inset Formula 
2097 \[
2098 \xymatrix{A\ar@/{}_{.5pc}/[r] & B\ar@/{}_{.5pc}/[l]}
2099 \]
2100
2101 \end_inset
2102
2103
2104 \end_layout
2105
2106 \begin_layout Subsubsection
2107 Specifying exit- and entrance directions
2108 \end_layout
2109
2110 \begin_layout Standard
2111 An alternative for making arrows bend is by specifying their compass direction
2112  as they are leaving their source and their direction from which they enter
2113  their target.
2114  Instead of north, north-east, east, etc., the directions are named 
2115 \family typewriter
2116 u
2117 \family default
2118
2119 \family typewriter
2120 ur
2121 \family default
2122
2123 \family typewriter
2124 r
2125 \family default
2126
2127 \family typewriter
2128 dr
2129 \family default
2130
2131 \family typewriter
2132 d
2133 \family default
2134
2135 \family typewriter
2136 dl
2137 \family default
2138
2139 \family typewriter
2140 l
2141 \family default
2142
2143 \family typewriter
2144 ul
2145 \family default
2146 , standing for up, up-right, right, down-right, etc..
2147  A direction is specified as @(
2148 \emph on
2149 out
2150 \emph default
2151 ,
2152 \emph on
2153 in
2154 \emph default
2155 ) where 
2156 \emph on
2157 out
2158 \emph default
2159  stands for the direction the first object is left and 
2160 \emph on
2161 in
2162 \emph default
2163  stands for the direction from which the target is entered.
2164  As an example, we show some bending arrows and a loop, which arises when
2165  we do not specify a target for an arrow, just its incoming and outgoing
2166  direction:
2167 \end_layout
2168
2169 \begin_layout Standard
2170 \begin_inset Formula 
2171 \[
2172 \xymatrix{A\ar@(dr,dl)[r]\ar@(dr,dl)[rr] & B\ar@(d,r)[dl] & C\\
2173 E\ar@(ul,ur)
2174 }
2175 \]
2176
2177 \end_inset
2178
2179
2180 \end_layout
2181
2182 \begin_layout LyX-Code
2183
2184 \backslash
2185 xymatrix{A 
2186 \backslash
2187 ar@(dr,dl)[r]
2188 \backslash
2189 ar@(dr,dl)[rr] 
2190 \begin_inset Newline newline
2191 \end_inset
2192
2193                     &B
2194 \backslash
2195 ar@(d,r)[dl]  &C 
2196 \backslash
2197
2198 \backslash
2199  
2200 \begin_inset Newline newline
2201 \end_inset
2202
2203             E 
2204 \backslash
2205 ar@(ul,ur)}
2206 \end_layout
2207
2208 \begin_layout Subsection
2209 Modifying vertices
2210 \end_layout
2211
2212 \begin_layout Standard
2213 The above example is reminiscent of an automata diagram, except that in
2214  such a diagram states would be enclosed in small circles, with double circles
2215  denoting final states.
2216  
2217 \end_layout
2218
2219 \begin_layout Subsubsection
2220 Framing objects
2221 \end_layout
2222
2223 \begin_layout Standard
2224 With 
2225 \begin_inset ERT
2226 status collapsed
2227
2228 \begin_layout Plain Layout
2229
2230
2231 \backslash
2232 Xy
2233 \end_layout
2234
2235 \end_inset
2236
2237 -pic, entries can obtain a single or a double frame, such as 
2238 \begin_inset Formula $\xymatrix{*+[F]{A}}
2239 $
2240 \end_inset
2241
2242  or 
2243 \begin_inset Formula $\xymatrix{*+[F=]{B}}
2244 $
2245 \end_inset
2246
2247  by prefixing an entry with 
2248 \family typewriter
2249 *[F-]
2250 \family default
2251  or 
2252 \family typewriter
2253 *[F=]
2254 \family default
2255  and enclosing the portion of the entry to be framed in braces.
2256  Normally, the frame will be very tight so that it must be widened by prefixing
2257  with 
2258 \family typewriter
2259 +
2260 \family default
2261  or with 
2262 \family typewriter
2263 ++
2264 \family default
2265 .
2266  Round frames, such as 
2267 \begin_inset Formula $\xymatrix{*++[o][F]{A}}
2268 $
2269 \end_inset
2270
2271  and 
2272 \begin_inset Formula $\xymatrix{*++[o][F=]{B}}
2273 $
2274 \end_inset
2275
2276  are obtained by specifying the shape as 
2277 \family typewriter
2278 [o].
2279
2280 \family default
2281  So the latter figure was constructed as *++[o][F=]{B}.
2282  This way, the following automaton 
2283 \end_layout
2284
2285 \begin_layout Standard
2286 \begin_inset Formula 
2287 \[
2288 \xymatrix{\txt{start}\ar[r] & *++[o][F]{1}\ar[r] & *++[o][F=]{2}\ar@(ur,dr)\ar@(ur,ul)[l]}
2289 \]
2290
2291 \end_inset
2292
2293
2294 \end_layout
2295
2296 \begin_layout Standard
2297 \noindent
2298 can be typeset as
2299 \end_layout
2300
2301 \begin_layout LyX-Code
2302
2303 \backslash
2304 xymatrix{
2305 \backslash
2306 txt{start}
2307 \backslash
2308 ar[r]
2309 \end_layout
2310
2311 \begin_layout LyX-Code
2312             & *++[o][F]{1}
2313 \backslash
2314 ar[r]
2315 \end_layout
2316
2317 \begin_layout LyX-Code
2318             & *++[o][F=]{2}
2319 \backslash
2320 ar@(ur,dr)
2321 \backslash
2322 ar@(ur,ul)[l]
2323 \end_layout
2324
2325 \begin_layout LyX-Code
2326            }.
2327 \end_layout
2328
2329 \begin_layout Standard
2330 The \SpecialChar LaTeX
2331  command 
2332 \family typewriter
2333
2334 \backslash
2335 entrymodifiers={
2336 \family default
2337 \SpecialChar ldots
2338
2339 \family typewriter
2340 }
2341 \family default
2342  will make a certain entry style the default, that can, of course be overridden
2343  for individual entries.
2344  Thus, after 
2345 \family typewriter
2346
2347 \backslash
2348 entrymodifiers={++[o][F-]}
2349 \family default
2350 , all following entries inside 
2351 \begin_inset ERT
2352 status collapsed
2353
2354 \begin_layout Plain Layout
2355
2356
2357 \backslash
2358 Xy
2359 \end_layout
2360
2361 \end_inset
2362
2363 -matrices would be encircled.
2364 \end_layout
2365
2366 \begin_layout Subsubsection
2367 Framing rectangles
2368 \end_layout
2369
2370 \begin_layout Standard
2371 Framing a whole rectangle inside an xymatrix is done with the macro pair
2372  
2373 \family typewriter
2374
2375 \backslash
2376 save ...
2377  
2378 \backslash
2379 restore
2380 \family default
2381 .
2382  
2383 \family roman
2384 \series medium
2385 \shape up
2386 \size normal
2387 \emph off
2388 \bar no
2389 \noun off
2390 \color none
2391 The dimension of the rectangle is given as a dotted pair 
2392 \begin_inset Formula $P_{0}.P_{1}$
2393 \end_inset
2394
2395  of points denoting the top left and lower right corners of the rectangle.
2396  Each point, in turn,is given as a doubly quoted comma separated pair 
2397 \begin_inset Quotes eld
2398 \end_inset
2399
2400
2401 \begin_inset Formula $x,y$
2402 \end_inset
2403
2404
2405 \begin_inset Quotes erd
2406 \end_inset
2407
2408  specifying row 
2409 \begin_inset Formula $x$
2410 \end_inset
2411
2412  and column 
2413 \begin_inset Formula $y$
2414 \end_inset
2415
2416 .
2417  These are followed by the framing commands, to produce figures such as
2418  the following: 
2419 \begin_inset Formula 
2420 \[
2421 \xymatrix{A & B\ar@(d,r)[dl]\sp(0.2)\phi\sp(0.7)\psi\save"1,1"."2,1"*+[F=]\frm{}\restore\,\\
2422 C & \save"1,1"."1,2"*++[F]\frm{}\restore
2423 }
2424 \]
2425
2426 \end_inset
2427
2428  Here, the code 
2429 \family typewriter
2430 \series default
2431 \shape default
2432 \size default
2433 \emph default
2434 \bar default
2435 \noun default
2436 \color inherit
2437
2438 \backslash
2439 save"1,1"."2,1"*+[F=]
2440 \backslash
2441 frm{}
2442 \backslash
2443 restore
2444 \family roman
2445 \series medium
2446 \shape up
2447 \size normal
2448 \emph off
2449 \bar no
2450 \noun off
2451 \color none
2452  produces the doubly framed rectangle, and the code for the extra wide horizonta
2453 l rectangle is 
2454 \family typewriter
2455 \series default
2456 \shape default
2457 \size default
2458 \emph default
2459 \bar default
2460 \noun default
2461 \color inherit
2462
2463 \backslash
2464 save"1,1"."1,2"*++[F]
2465 \backslash
2466 frm{}
2467 \backslash
2468 restore
2469 \family roman
2470 \series medium
2471 \shape up
2472 \size normal
2473 \emph off
2474 \bar no
2475 \noun off
2476 \color none
2477 .
2478  This code can be placed in arbitrary cells of the xymatrix.
2479  
2480 \end_layout
2481
2482 \begin_layout Section
2483 Using \SpecialChar LyX
2484 's math editor
2485 \begin_inset CommandInset label
2486 LatexCommand label
2487 name "sec:math-editor"
2488
2489 \end_inset
2490
2491
2492 \end_layout
2493
2494 \begin_layout Standard
2495 As an alternative to writing the 
2496 \family typewriter
2497 xypic
2498 \family default
2499  code, then transforming it into a math-editing environment by marking it
2500  and applying 
2501 \family sans
2502 Ctrl-m
2503 \family default
2504 , or 
2505 \family sans
2506 Ctrl-M
2507 \family default
2508 , one may construct and modify the whole xypic-diagram inside \SpecialChar LyX
2509 's math editor.
2510  We describe the editing steps for a figure just like the one above.
2511  
2512 \end_layout
2513
2514 \begin_layout Subsection
2515 Caveat - how to enter braces
2516 \end_layout
2517
2518 \begin_layout Standard
2519 Recall that in \SpecialChar LyX
2520 's math-editor any pair of braces 
2521 \family typewriter
2522 {
2523 \family default
2524  and 
2525 \family typewriter
2526 }
2527 \family default
2528  that are to enclose a macro-parameter must be entered by typing just 
2529 \family typewriter
2530
2531 \backslash
2532 {
2533 \family default
2534  .
2535  The closing brace is automatically supplied and in between a box into which
2536  to the parameter is entered.
2537  In connection with 
2538 \begin_inset ERT
2539 status collapsed
2540
2541 \begin_layout Plain Layout
2542
2543
2544 \backslash
2545 Xy
2546 \end_layout
2547
2548 \end_inset
2549
2550 -diagrams, this applies in particular to arrow modifications that are normally
2551  given in the form 
2552 \family typewriter
2553 @{
2554 \family default
2555  \SpecialChar ldots
2556  
2557 \family typewriter
2558 }
2559 \family default
2560  with the ellipsis standing for the description of end, shaft and tip of
2561  the arrow.
2562  Inside the math-editor, enter just 
2563 \family typewriter
2564 @
2565 \backslash
2566 {
2567 \family default
2568  and let \SpecialChar LyX
2569  provide the closing brace and the box into which to enter the
2570  description of the arrow.
2571 \end_layout
2572
2573 \begin_layout Standard
2574 Braces that are entered without the backslash 
2575 \family typewriter
2576
2577 \backslash
2578
2579 \family default
2580  will just appear as typed, but cannot be used to receive a macro parameter.
2581  They are useful, for instance to denote sets, e.
2582 \begin_inset space \thinspace{}
2583 \end_inset
2584
2585 g.
2586 \begin_inset space \space{}
2587 \end_inset
2588
2589
2590 \family typewriter
2591 {x
2592 \backslash
2593 in X 
2594 \backslash
2595 mid x
2596 \backslash
2597 notin x}
2598 \family default
2599  will display as 
2600 \begin_inset Formula $\{x\in X\mid x\notin x\}$
2601 \end_inset
2602
2603 .
2604 \end_layout
2605
2606 \begin_layout Subsection
2607 Setting up the matrix
2608 \end_layout
2609
2610 \begin_layout Standard
2611 With 
2612 \family sans
2613 Ctrl-m
2614 \family default
2615  or 
2616 \family sans
2617 Ctrl-M
2618 \family default
2619  open a formula environment and enter: 
2620 \family typewriter
2621
2622 \backslash
2623 xymatrix
2624 \family default
2625 .
2626  This produces a 1
2627 \begin_inset Formula $\times$
2628 \end_inset
2629
2630 1- 
2631 \begin_inset ERT
2632 status collapsed
2633
2634 \begin_layout Plain Layout
2635
2636
2637 \backslash
2638 Xy
2639 \end_layout
2640
2641 \end_inset
2642
2643 -matrix.
2644  Add extra rows by typing 
2645 \family sans
2646 Ctrl-Enter
2647 \family default
2648  and add columns by typing 
2649 \family sans
2650 Alt-m c i.
2651  
2652 \end_layout
2653
2654 \begin_layout Standard
2655 At any time, further rows or columns can be entered or deleted using commands
2656  available from 
2657 \family sans
2658 Edit\SpecialChar menuseparator
2659 Math,
2660 \family default
2661  resp.
2662  their shortcuts, beginning with 
2663 \family sans
2664 Alt-m c
2665 \family default
2666  for the column commands or 
2667 \family sans
2668 Alt-m w
2669 \family default
2670  for the row commands.
2671  A more direct way uses the icons in the math toolbar once it has been activated
2672  via 
2673 \family sans
2674 View\SpecialChar menuseparator
2675 Toolbars.
2676 \end_layout
2677
2678 \begin_layout Subsection
2679 Entering nodes, arrows and labels
2680 \end_layout
2681
2682 \begin_layout Standard
2683 Type the nodes into the correct positions of the matrix.
2684  If you move the cursor out of the matrix, you should see a first rendering
2685  of the node layout.
2686  Next, add the arrows at the nodes from where they should emanate by typing
2687  
2688 \family typewriter
2689
2690 \backslash
2691 ar[
2692 \family default
2693 \emph on
2694 p
2695 \family typewriter
2696 \emph default
2697 ]
2698 \family default
2699 , where 
2700 \emph on
2701 p
2702 \emph default
2703  can be any path made up from the characters 
2704 \family typewriter
2705 u
2706 \family default
2707
2708 \family typewriter
2709 d
2710 \family default
2711
2712 \family typewriter
2713 l
2714 \family default
2715
2716 \family typewriter
2717 r
2718 \family default
2719 .
2720  Make sure that the path indeed leads to an existing node within the matrix.
2721  Otherwise, the figure will not display when the cursor leaves the editing
2722  area.
2723 \end_layout
2724
2725 \begin_layout Standard
2726 Next, label the arrows by attaching a label text as upper or lower indices
2727  to the end of the arrow's path.
2728  As always in \SpecialChar LyX
2729 's math editor, an underscore 
2730 \family typewriter
2731 _
2732 \family default
2733  opens a box for a lower index and a 
2734 \family typewriter
2735 ^
2736 \family default
2737  followed by a space opens a box for an upper index.
2738  You can enter any \SpecialChar LaTeX
2739 -code as a label.
2740 \end_layout
2741
2742 \begin_layout Subsection
2743 Modifying arrows
2744 \end_layout
2745
2746 \begin_layout Standard
2747 Finally, you can modify the appearance of the arrows by entering @-modifiers
2748  
2749 \family typewriter
2750 @{
2751 \family default
2752 \SpecialChar ldots
2753
2754 \family typewriter
2755 }
2756 \family default
2757
2758 \family typewriter
2759 @<
2760 \family default
2761 \SpecialChar ldots
2762 >, 
2763 \family typewriter
2764 @(
2765 \family default
2766 \SpecialChar ldots
2767 ,\SpecialChar ldots
2768 ) or 
2769 \family typewriter
2770 @/
2771 \family default
2772 \SpecialChar ldots
2773
2774 \family typewriter
2775 /
2776 \family default
2777 .
2778  The above caveat applies to the first form only.
2779  It must be entered as 
2780 \family typewriter
2781 @
2782 \backslash
2783 {
2784 \family default
2785  with the arrow description entered inside the \SpecialChar LyX
2786 -supplied box.
2787  If this box remains empty, you have specified an empty arrow.
2788  This is a useful construction, too, as you will see in the next section.
2789  
2790 \end_layout
2791
2792 \begin_layout Standard
2793 The other modifiers, 
2794 \family typewriter
2795 @<
2796 \family default
2797 \SpecialChar ldots
2798
2799 \family typewriter
2800 >
2801 \family default
2802
2803 \family typewriter
2804 @(
2805 \family default
2806 \SpecialChar ldots
2807 ,\SpecialChar ldots
2808
2809 \family typewriter
2810
2811 \family default
2812 and 
2813 \family typewriter
2814 @/
2815 \family default
2816 \SpecialChar ldots
2817
2818 \family typewriter
2819
2820 \family default
2821 are typed as shown with the arrow description replacing the ellipsis.
2822  The code for bending arrows, which in 
2823 \family typewriter
2824 xypic
2825 \family default
2826  is 
2827 \family typewriter
2828 @/_
2829 \family default
2830 \emph on
2831 measure
2832 \family typewriter
2833 \emph default
2834
2835 \family default
2836 or 
2837 \family typewriter
2838 @/
2839 \emph on
2840 ^
2841 \family default
2842 measure
2843 \family typewriter
2844 \emph default
2845
2846 \family default
2847 where 
2848 \emph on
2849 measure
2850 \emph default
2851  is any valid \SpecialChar TeX
2852 -measure that should be entered as upper or lower index to
2853  the first slash /.
2854  Make sure that the ending slash does not end up being part of the upper
2855  or lower index.
2856 \end_layout
2857
2858 \begin_layout Subsection
2859 What if something goes wrong
2860 \end_layout
2861
2862 \begin_layout Standard
2863 When constructing a diagram, you should at times check it by just moving
2864  the cursor out of the editing area to see whether instant preview can successfu
2865 lly convert it into graphical output.
2866  If this does not happen, it may either be that instant preview for some
2867  reason is not aware that it should retranslate the graphics.
2868  Moving the cursor into the editing area and out again sometimes wakes up
2869  instant preview.
2870 \end_layout
2871
2872 \begin_layout Standard
2873 A more serious reason could be a syntactical error in your input (in that
2874  case, the math edition area disappears completely).
2875  If necessary, undo the last editing steps, using 
2876 \family sans
2877 Ctrl+Z
2878 \family default
2879 , or try to translate the \SpecialChar LyX
2880 -file into 
2881 \family sans
2882 DVI
2883 \family default
2884  using 
2885 \family sans
2886 Ctrl+D
2887 \family default
2888  or 
2889 \family sans
2890 View\SpecialChar menuseparator
2891 DVI
2892 \family default
2893 .
2894  There should be some error generated, which hopefully gives you a hint
2895  as to the source of the mistake.
2896 \end_layout
2897
2898 \begin_layout Section
2899 Hacks
2900 \end_layout
2901
2902 \begin_layout Standard
2903 Certain things do not work correctly inside \SpecialChar LyX
2904 .
2905  The ones that we (used to) miss most are the horizontal and vertical scaling
2906  of diagrams, and the correct positioning of arrows.
2907  There are some workarounds that we are explaining here.
2908  
2909 \end_layout
2910
2911 \begin_layout Subsection
2912 Horizontal and vertical scaling
2913 \end_layout
2914
2915 \begin_layout Standard
2916 It is often convenient to stretch the horizontal or the vertical dimensions
2917  of an entire diagram by using spacing commands for rows and/or columns.
2918  According to the 
2919 \begin_inset ERT
2920 status collapsed
2921
2922 \begin_layout Plain Layout
2923
2924
2925 \backslash
2926 Xy
2927 \end_layout
2928
2929 \end_inset
2930
2931 -manual, 
2932 \begin_inset CommandInset citation
2933 LatexCommand cite
2934 key "xypic manual"
2935 literal "true"
2936
2937 \end_inset
2938
2939 , for instance, 
2940 \family typewriter
2941
2942 \backslash
2943 xymatrix@R=1pc{
2944 \family default
2945 \SpecialChar ldots
2946
2947 \family typewriter
2948 }
2949 \family default
2950  defines an 
2951 \begin_inset ERT
2952 status collapsed
2953
2954 \begin_layout Plain Layout
2955
2956
2957 \backslash
2958 Xy
2959 \end_layout
2960
2961 \end_inset
2962
2963 -matrix with row spacing of 1
2964 \begin_inset space ~
2965 \end_inset
2966
2967 pica.
2968  Similarly, 
2969 \family typewriter
2970
2971 \backslash
2972 xymatrix@C=
2973 \family default
2974 \SpecialChar ldots
2975
2976 \family typewriter
2977 {
2978 \family default
2979 \SpecialChar ldots
2980
2981 \family typewriter
2982 }
2983 \family default
2984  allows to modify the space between columns.
2985  Unfortunately, one cannot type 
2986 \begin_inset Quotes eld
2987 \end_inset
2988
2989
2990 \family typewriter
2991
2992 \backslash
2993 xymatrix@R=1pc
2994 \family default
2995
2996 \begin_inset Quotes erd
2997 \end_inset
2998
2999  into a formula to get the desired matrix because the @-character is interpreted
3000  by \SpecialChar LyX
3001  as ending the 
3002 \family typewriter
3003
3004 \backslash
3005 xymatrix
3006 \family default
3007  command.
3008  But there are two other ways of getting the desired matrix:
3009 \end_layout
3010
3011 \begin_layout Itemize
3012 One types e.g.
3013 \begin_inset space \space{}
3014 \end_inset
3015
3016
3017 \family typewriter
3018
3019 \backslash
3020 xymatrix@R=1pc
3021 \family default
3022  as normal document text, then either highlight it and press 
3023 \begin_inset Info
3024 type  "shortcut"
3025 arg   "math-mode"
3026 \end_inset
3027
3028  to get a formula, or copy it into an existing formula.
3029  You can now continue as normal.
3030 \begin_inset Newline newline
3031 \end_inset
3032
3033
3034 \begin_inset Note Greyedout
3035 status open
3036
3037 \begin_layout Plain Layout
3038
3039 \series bold
3040 Note:
3041 \series default
3042  This method only works for single spacing settings, so using
3043 \begin_inset Newline newline
3044 \end_inset
3045
3046
3047 \family typewriter
3048
3049 \backslash
3050 xymatrix@M=1pt
3051 \family default
3052  is possible while 
3053 \family typewriter
3054
3055 \backslash
3056 xymatrix@M=1pt@C=1dd
3057 \family default
3058  is not.
3059  The method also don't work if you use '!' to get a fixed grid with a defined
3060  dimension, e.g.
3061 \begin_inset space \space{}
3062 \end_inset
3063
3064
3065 \family typewriter
3066
3067 \backslash
3068 xymatrix@!R=3pt
3069 \family default
3070  fails while
3071 \family typewriter
3072  
3073 \backslash
3074 xymatrix@!R
3075 \family default
3076  works.
3077 \end_layout
3078
3079 \end_inset
3080
3081
3082 \begin_inset Newline newline
3083 \end_inset
3084
3085 For the following matrix, the command 
3086 \family typewriter
3087
3088 \backslash
3089 xymatrix@C=9pc
3090 \family default
3091  was used:
3092 \begin_inset Formula 
3093 \[
3094 \xymatrix@C=9pc{A\ar[r]\ar[d] & B\\
3095 C\ar@{}[ur]|{\text{{horizontal stretch}}}
3096 }
3097 \]
3098
3099 \end_inset
3100
3101
3102 \end_layout
3103
3104 \begin_layout Itemize
3105 \begin_inset ERT
3106 status collapsed
3107
3108 \begin_layout Plain Layout
3109
3110
3111 \backslash
3112 Xy
3113 \end_layout
3114
3115 \end_inset
3116
3117
3118 \begin_inset space ~
3119 \end_inset
3120
3121  stores the values for row-spacing and column-spacing in the variables
3122 \begin_inset Newline newline
3123 \end_inset
3124
3125
3126 \family typewriter
3127
3128 \backslash
3129 xymatrixrowsep@
3130 \family default
3131  and 
3132 \family typewriter
3133
3134 \backslash
3135 xymatrixrowsep@
3136 \family default
3137 .
3138  So one can add the following macro to the preamble (
3139 \family sans
3140 Layout\SpecialChar menuseparator
3141 Document\SpecialChar menuseparator
3142 Preamble
3143 \family default
3144 ):
3145 \end_layout
3146
3147 \begin_deeper
3148 \begin_layout LyX-Code
3149
3150 \backslash
3151 newcommand{
3152 \backslash
3153 xyR}[1]{%
3154 \end_layout
3155
3156 \begin_layout LyX-Code
3157
3158 \backslash
3159 xydef@
3160 \backslash
3161 xymatrixrowsep@{#1}}
3162 \end_layout
3163
3164 \begin_layout Standard
3165 A macro 
3166 \family typewriter
3167
3168 \backslash
3169 xyC
3170 \family default
3171  can be defined correspondingly by replacing 
3172 \family typewriter
3173
3174 \backslash
3175 xymatrixrowsep@
3176 \family default
3177  with 
3178 \family typewriter
3179
3180 \backslash
3181 xymatrixcolsep@
3182 \family default
3183 .
3184  Now, a figure can be scaled by entering 
3185 \backslash
3186 xyR{ into the formula before the 
3187 \begin_inset ERT
3188 status collapsed
3189
3190 \begin_layout Plain Layout
3191
3192
3193 \backslash
3194 Xy
3195 \end_layout
3196
3197 \end_inset
3198
3199 -matrix.
3200  Place the cursor inside the matrix, just before the first entry.
3201  Then enter 
3202 \family typewriter
3203
3204 \backslash
3205 xyR
3206 \backslash
3207 {
3208 \family default
3209  or 
3210 \family typewriter
3211
3212 \backslash
3213 xyC
3214 \backslash
3215 {
3216 \family default
3217  or both.
3218  Don't forget the backslashes and remember, that the closing brace is automatica
3219 lly supplied by \SpecialChar LyX
3220 .
3221  Inside the braces enter the dimensions.
3222 \begin_inset Newline newline
3223 \end_inset
3224
3225
3226 \begin_inset Note Greyedout
3227 status open
3228
3229 \begin_layout Plain Layout
3230
3231 \series bold
3232 Note:
3233 \series default
3234  these commands affect all following 
3235 \begin_inset ERT
3236 status collapsed
3237
3238 \begin_layout Plain Layout
3239
3240
3241 \backslash
3242 Xy
3243 \end_layout
3244
3245 \end_inset
3246
3247 -matrices.
3248  Therefore don't forget to reset the values to default after the usage of
3249  
3250 \family typewriter
3251
3252 \backslash
3253 xyR
3254 \family default
3255  etc..
3256 \end_layout
3257
3258 \end_inset
3259
3260
3261 \begin_inset Newline newline
3262 \end_inset
3263
3264 The default is 
3265 \family typewriter
3266 2pc
3267 \family default
3268 .
3269  Here you see a diagram which is squashed vertically and stretched horizontally
3270  with 
3271 \family typewriter
3272
3273 \backslash
3274 xyR{.5pc}
3275 \backslash
3276 xyC{9pc}
3277 \family default
3278 :
3279 \begin_inset Formula 
3280 \[
3281 \xyR{.5pc}\xyC{9pc}\xymatrix{A\ar[r]\ar[d] & B\\
3282 C\ar@{}[ur]|{\text{{horizontal stretch}}}
3283 }
3284 \]
3285
3286 \end_inset
3287
3288
3289 \begin_inset Formula $\xyR{2pc}\xyC{2pc}$
3290 \end_inset
3291
3292
3293 \begin_inset Note Note
3294 status collapsed
3295
3296 \begin_layout Plain Layout
3297 reset to default
3298 \end_layout
3299
3300 \end_inset
3301
3302
3303 \end_layout
3304
3305 \end_deeper
3306 \begin_layout Subsection
3307 Label positioning
3308 \end_layout
3309
3310 \begin_layout Standard
3311 Another useful 
3312 \begin_inset ERT
3313 status collapsed
3314
3315 \begin_layout Plain Layout
3316
3317
3318 \backslash
3319 Xy
3320 \end_layout
3321
3322 \end_inset
3323
3324 -command allows the correct positioning of labels along the shaft of arrows.
3325  This feature is sometimes necessary, when the default position of a label
3326  would otherwise clutter the picture, or would even coincide with other
3327  items, such as the intersection of the arrows in the figure below.
3328  In order to shift a label position alongside the shaft of an arrow, 
3329 \begin_inset ERT
3330 status collapsed
3331
3332 \begin_layout Plain Layout
3333
3334
3335 \backslash
3336 Xy
3337 \end_layout
3338
3339 \end_inset
3340
3341
3342 \begin_inset space ~
3343 \end_inset
3344
3345  allows to prefix the label by a decimal number in parentheses, specifying
3346  the fraction of distance alongside the arrow where the label is to be placed.
3347  For instance, the code 
3348 \family typewriter
3349
3350 \backslash
3351 ar[r]|(0.3)
3352 \backslash
3353 varphi
3354 \family default
3355 , will place the label on the shaft, but only about one third of the way.
3356  
3357 \end_layout
3358
3359 \begin_layout Standard
3360 Doing the same with labels above or below arrows as 
3361 \family typewriter
3362
3363 \backslash
3364 ar[dr]^(0.3)
3365 \backslash
3366 varphi,
3367 \family default
3368  respectively 
3369 \family typewriter
3370
3371 \backslash
3372 ar[ur]_(0.3)
3373 \backslash
3374 phi
3375 \family default
3376 , does not work from inside \SpecialChar LyX
3377 .
3378  Instead, one has to replace the hat-symbol ^, resp.
3379  the underscore _ , by the macros 
3380 \family typewriter
3381
3382 \backslash
3383 sp
3384 \family default
3385 , resp.
3386  
3387 \family typewriter
3388
3389 \backslash
3390 sb
3391 \family default
3392 , obtaining 
3393 \family typewriter
3394
3395 \backslash
3396 ar[dr]
3397 \backslash
3398 sp(0.3)
3399 \backslash
3400 varphi 
3401 \family default
3402 and
3403 \family typewriter
3404  
3405 \backslash
3406 ar[ur]
3407 \backslash
3408 sb(0.3)
3409 \backslash
3410 phi.
3411  
3412 \family default
3413 It is, in fact, possible to enter several labels this way and those labels
3414  are placed correctly, even if the arrow bends.
3415  In the following figure, the bending arrow with its four labels has been
3416  produced with 
3417 \family typewriter
3418
3419 \backslash
3420 ar@(r,r)[d] 
3421 \backslash
3422 sp(0.2){
3423 \backslash
3424 phi_{1}} 
3425 \backslash
3426 sp(0.4){
3427 \backslash
3428 phi_{2}} 
3429 \backslash
3430 sb(0.6){
3431 \backslash
3432 phi_{3}} 
3433 \backslash
3434 sp(0.8){
3435 \backslash
3436 phi_{4}}.
3437 \end_layout
3438
3439 \begin_layout Standard
3440 \begin_inset Formula 
3441 \[
3442 \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}}\\
3443 \circ\ar[ur]\sb(0.3)\phi & \bullet
3444 }
3445 \]
3446
3447 \end_inset
3448
3449
3450 \end_layout
3451
3452 \begin_layout Subsection
3453 Invisible stretched arrows
3454 \end_layout
3455
3456 \begin_layout Standard
3457 A more general trick uses invisible arrows to place any object almost anywhere
3458  inside a diagram.
3459  Produce an invisible arrow, shorten (or prolong) it past its goal by adding
3460  a decimal stretching ratio, e.
3461 \begin_inset space \thinspace{}
3462 \end_inset
3463
3464 g.
3465 \begin_inset space \space{}
3466 \end_inset
3467
3468
3469 \family typewriter
3470 (0.6)
3471 \family default
3472  or 
3473 \family typewriter
3474 (1.4)
3475 \family default
3476  to its path.
3477  Attach a label to this invisible arrow.
3478  
3479 \end_layout
3480
3481 \begin_layout Standard
3482 Thus, the down pointing arrow with its label 
3483 \begin_inset Formula $\varphi$
3484 \end_inset
3485
3486  at (0.3) of its way along the shaft might as well have been produced by
3487  adding to the regular arrow 
3488 \family typewriter
3489
3490 \backslash
3491 ar[dr] 
3492 \family default
3493 an invisible 
3494 \begin_inset Formula $\varphi$
3495 \end_inset
3496
3497 -labelled arrow 
3498 \family typewriter
3499
3500 \backslash
3501 ar@{}[dr(0.6)]^
3502 \backslash
3503 varphi
3504 \family default
3505 , reaching only 0.6 of the way.
3506  Its label will now appear at 0.3 of the way of the original visible arrow.
3507  
3508 \end_layout
3509
3510 \begin_layout Standard
3511 This workaround has two minor drawbacks: First, it does not work with bending
3512  arrows.
3513  Secondly, prolonging an invisible arrow beyond the normal dimension of
3514  the figure will invisibly extend the figure box, and thereby cause too
3515  much vertical space between the figure and the preceding or the following
3516  paragraph.
3517  
3518 \end_layout
3519
3520 \begin_layout Standard
3521 Nevertheless, invisible arrows are an important tool, since they can, in
3522  principle, be used to place information at any chosen place in a diagram.
3523  In the above figure, for instance, we have used an invisible arrow to carry
3524  the 
3525 \family typewriter
3526
3527 \backslash
3528 vdots
3529 \family default
3530  as label and at the earlier figure we had used an invisible arrow to carry
3531  the text 
3532 \begin_inset Quotes eld
3533 \end_inset
3534
3535
3536 \family typewriter
3537 horizontal stretch
3538 \family default
3539
3540 \begin_inset Quotes erd
3541 \end_inset
3542
3543  into the center of the figure.
3544 \end_layout
3545
3546 \begin_layout Subsection
3547 Further 
3548 \family typewriter
3549 Xy
3550 \family default
3551 -tricks
3552 \end_layout
3553
3554 \begin_layout Standard
3555 Here we have focused only on the 
3556 \family typewriter
3557
3558 \backslash
3559 xymatrix
3560 \family default
3561  command, which is just one of the features available in Kris Rose's amazing
3562 \family typewriter
3563  
3564 \begin_inset ERT
3565 status collapsed
3566
3567 \begin_layout Plain Layout
3568
3569
3570 \backslash
3571 Xy
3572 \end_layout
3573
3574 \end_inset
3575
3576
3577 \family default
3578 -package.
3579  The 
3580 \family typewriter
3581
3582 \begin_inset ERT
3583 status collapsed
3584
3585 \begin_layout Plain Layout
3586
3587
3588 \backslash
3589 Xy
3590 \end_layout
3591
3592 \end_inset
3593
3594
3595 \family default
3596 -pic manual 
3597 \begin_inset CommandInset citation
3598 LatexCommand cite
3599 key "xypic manual"
3600 literal "true"
3601
3602 \end_inset
3603
3604  demonstrates many of the advanced possibilities of that package.
3605  Beware, that its style is rather terse and you will likely need a lot of
3606  experimenting and modifying the many worked examples.
3607  Lauda 
3608 \begin_inset CommandInset citation
3609 LatexCommand cite
3610 key "Lauda"
3611 literal "true"
3612
3613 \end_inset
3614
3615  explains how to use 
3616 \begin_inset ERT
3617 status collapsed
3618
3619 \begin_layout Plain Layout
3620
3621
3622 \backslash
3623 Xy
3624 \end_layout
3625
3626 \end_inset
3627
3628 -pic to make braids, cobordism, string diagrams, and much more.
3629  You might want to look on 
3630 \family typewriter
3631 inset_preview.lyx
3632 \family default
3633  example shipped with \SpecialChar LyX
3634 , which demonstrates how to use more advanced 
3635 \begin_inset ERT
3636 status collapsed
3637
3638 \begin_layout Plain Layout
3639
3640
3641 \backslash
3642 Xy
3643 \end_layout
3644
3645 \end_inset
3646
3647 -commands via 
3648 \family typewriter
3649 \SpecialChar TeX
3650
3651 \begin_inset space ~
3652 \end_inset
3653
3654 Code
3655 \family default
3656  and 
3657 \family typewriter
3658 Instant preview
3659 \family default
3660  insets.
3661 \end_layout
3662
3663 \begin_layout Standard
3664 \begin_inset Newpage newpage
3665 \end_inset
3666
3667
3668 \end_layout
3669
3670 \begin_layout Bibliography
3671 \begin_inset CommandInset bibitem
3672 LatexCommand bibitem
3673 key "xypic manual"
3674 literal "true"
3675
3676 \end_inset
3677
3678 Kristoffer H.
3679  Rose: 
3680 \begin_inset ERT
3681 status collapsed
3682
3683 \begin_layout Plain Layout
3684
3685
3686 \backslash
3687 Xy
3688 \end_layout
3689
3690 \end_inset
3691
3692
3693 \emph on
3694 -pic User's Guide
3695 \emph default
3696 .
3697 \begin_inset Newline newline
3698 \end_inset
3699
3700
3701 \begin_inset Flex URL
3702 status collapsed
3703
3704 \begin_layout Plain Layout
3705
3706 https://www.ctan.org/tex-archive/macros/generic/diagrams/xypic/doc/xyguide.pdf
3707 \end_layout
3708
3709 \end_inset
3710
3711
3712 \end_layout
3713
3714 \begin_layout Bibliography
3715 \begin_inset CommandInset bibitem
3716 LatexCommand bibitem
3717 key "xypic reference"
3718 literal "true"
3719
3720 \end_inset
3721
3722 Kristoffer H.
3723  Rose and Ross Moore: 
3724 \begin_inset ERT
3725 status collapsed
3726
3727 \begin_layout Plain Layout
3728
3729
3730 \backslash
3731 Xy
3732 \end_layout
3733
3734 \end_inset
3735
3736
3737 \emph on
3738 -pic Reference Manual
3739 \emph default
3740 .
3741 \begin_inset Newline newline
3742 \end_inset
3743
3744
3745 \begin_inset Flex URL
3746 status collapsed
3747
3748 \begin_layout Plain Layout
3749
3750 https://www.ctan.org/tex-archive/macros/generic/diagrams/xypic/doc/xyrefer.pdf
3751 \end_layout
3752
3753 \end_inset
3754
3755
3756 \end_layout
3757
3758 \begin_layout Bibliography
3759 \begin_inset CommandInset bibitem
3760 LatexCommand bibitem
3761 key "xypic"
3762 literal "true"
3763
3764 \end_inset
3765
3766 Homepage of the package 
3767 \begin_inset ERT
3768 status collapsed
3769
3770 \begin_layout Plain Layout
3771
3772
3773 \backslash
3774 Xy
3775 \end_layout
3776
3777 \end_inset
3778
3779
3780 \emph on
3781 -pic
3782 \emph default
3783
3784 \begin_inset Flex URL
3785 status collapsed
3786
3787 \begin_layout Plain Layout
3788
3789 http://www.ctan.org/pkg/xypic
3790 \end_layout
3791
3792 \end_inset
3793
3794
3795 \end_layout
3796
3797 \begin_layout Bibliography
3798 \begin_inset CommandInset bibitem
3799 LatexCommand bibitem
3800 key "instant-preview"
3801 literal "true"
3802
3803 \end_inset
3804
3805 Homepage of preview-latex:
3806 \begin_inset Newline newline
3807 \end_inset
3808
3809
3810 \begin_inset Flex URL
3811 status collapsed
3812
3813 \begin_layout Plain Layout
3814
3815 http://www.gnu.org/software/auctex/preview-latex.html
3816 \end_layout
3817
3818 \end_inset
3819
3820
3821 \end_layout
3822
3823 \begin_layout Bibliography
3824 \begin_inset CommandInset bibitem
3825 LatexCommand bibitem
3826 key "AUCTeX"
3827 literal "true"
3828
3829 \end_inset
3830
3831 Homepage of AUC\SpecialChar TeX
3832
3833 \begin_inset Flex URL
3834 status collapsed
3835
3836 \begin_layout Plain Layout
3837
3838 http://www.gnu.org/software/auctex/
3839 \end_layout
3840
3841 \end_inset
3842
3843
3844 \end_layout
3845
3846 \begin_layout Bibliography
3847 \begin_inset CommandInset bibitem
3848 LatexCommand bibitem
3849 key "Lauda"
3850 literal "true"
3851
3852 \end_inset
3853
3854 Aarlon Lauda: 
3855 \begin_inset ERT
3856 status collapsed
3857
3858 \begin_layout Plain Layout
3859
3860
3861 \backslash
3862 Xy
3863 \end_layout
3864
3865 \end_inset
3866
3867
3868 \emph on
3869 -pic
3870 \emph default
3871  
3872 \emph on
3873 tutorial with an archive of examples
3874 \emph default
3875 .
3876 \begin_inset Newline newline
3877 \end_inset
3878
3879
3880 \begin_inset Flex URL
3881 status open
3882
3883 \begin_layout Plain Layout
3884
3885 https://www.ctan.org/tex-archive/macros/generic/diagrams/xypic/doc/xyguide.pdf
3886 \end_layout
3887
3888 \end_inset
3889
3890
3891 \end_layout
3892
3893 \end_body
3894 \end_document