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