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