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