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