]> git.lyx.org Git - lyx.git/blobdiff - lib/examples/xypic.lyx
Make sweave example working. Patch from Liviu.
[lyx.git] / lib / examples / xypic.lyx
index 57bce5366db6fb71b2337ef6e9707974ee9f00b4..5de1b08fa5a9e3a4b616c01d8efc042ee390cbe1 100644 (file)
@@ -1,24 +1,16 @@
-#LyX 1.6.2svn created this file. For more info see http://www.lyx.org/
-\lyxformat 345
+#LyX 2.0.0svn created this file. For more info see http://www.lyx.org/
+\lyxformat 382
 \begin_document
 \begin_header
 \textclass scrartcl
 \begin_preamble
 \usepackage[all]{xy}
 
-
-\makeatletter
+% define new commands used in sec. 5.1
 \newcommand{\xyR}[1]{
-  \makeatletter
-  \xydef@\xymatrixrowsep@{#1}
-  \makeatother
-}
-\makeatletter
+  \xydef@\xymatrixrowsep@{#1}}
 \newcommand{\xyC}[1]{
-  \makeatletter
-  \xydef@\xymatrixcolsep@{#1}
-  \makeatother
-}
+  \xydef@\xymatrixcolsep@{#1}}
 
 \newdir{|>}{!/4.5pt/@{|}*:(1,-.2)@^{>}*:(1,+.2)@_{>}}
 
 \end_preamble
 \options BCOR7.5mm
 \use_default_options false
+\maintain_unincluded_children false
 \language english
 \inputencoding auto
+\fontencoding global
 \font_roman ae
 \font_sans default
 \font_typewriter default
 \font_default_family default
+\use_xetex false
 \font_sc false
 \font_osf false
 \font_sf_scale 100
 \font_tt_scale 100
 
 \graphics default
+\default_output_format default
+\bibtex_command default
+\index_command default
 \paperfontsize 12
 \spacing single
 \use_hyperref true
 \use_geometry false
 \use_amsmath 1
 \use_esint 0
+\use_mhchem 1
 \cite_engine basic
 \use_bibtopic false
+\use_indices false
 \paperorientation portrait
+\suppress_date false
+\index Index
+\shortcut idx
+\color #008000
+\end_index
 \secnumdepth 3
 \tocdepth 3
 \paragraph_separation indent
-\defskip medskip
+\paragraph_indentation default
 \quotes_language english
 \papercolumns 1
 \papersides 2
 \paperpagestyle default
 \tracking_changes false
 \output_changes false
-\author "" 
-\author "" 
+\html_math_output 0
+\html_be_strict true
 \end_header
 
 \begin_body
@@ -131,7 +136,7 @@ Xy
 
 
 \family default
--Pic can be conveniently used inside LyX.
+-pic can be conveniently used inside LyX.
  Diagrams can be edited and displayed inside the main LyX editing window.
  Here, we shall describe how to use the 
 \family typewriter
@@ -169,7 +174,7 @@ xypic
 -package has long served as a convenient tool for easily constructing graphs
  and diagrams in LaTeX.
  Unfortunately, its use in LyX had long been restricted to the infamous
ERT-boxes, meaning that the LyX editor could only display the LaTeX-source
TeX code boxes, meaning that the LyX editor could only display the LaTeX-source
  and not the finished diagram.
  The new 
 \family typewriter
@@ -200,7 +205,7 @@ xypic
 \align center
 \begin_inset Graphics
        filename xyfigure.png
-       scale 50
+       width 75col%
        BoundingBox 0bp 0bp 580bp 440bp
        clip
 
@@ -232,7 +237,11 @@ Xy
 
 -pic can be used from inside LyX, how diagrams can be created and edited.
  We have tested the following using LyX versions 1.3.7 up to 1.6, running under
- WindowsXP and under Windows Vista.
+ Windows
+\begin_inset space \thinspace{}
+\end_inset
+
+XP and under Windows Vista.
  
 \end_layout
 
@@ -251,7 +260,7 @@ Xy
 
 \end_inset
 
--Pic code inside the LyX-window, select it all and convert it to a graphical
+-pic code inside the LyX-window, select it all and convert it to a graphical
  representation by pressing 
 \family sans
 Ctrl-m
@@ -274,7 +283,7 @@ Xy
 
 \end_inset
 
--Pic more frequently, or if you want to modify your initial figure, you
+-pic more frequently, or if you want to modify your initial figure, you
  will want to assemble and modify your figures using LyX's math editor.
  
 \end_layout
@@ -302,7 +311,7 @@ Xy
 
 \end_inset
 
--Pic features that might be of use for drawing commutative diagrams, graphs
+-pic features that might be of use for drawing commutative diagrams, graphs
  or automata.
  Section 
 \begin_inset CommandInset ref
@@ -324,7 +333,7 @@ Xy
 
 \end_inset
 
--Pic commands inside a math-editing area.
+-pic commands inside a math-editing area.
  
 \end_layout
 
@@ -342,7 +351,7 @@ Xy
 
 \end_inset
 
--Pic, rather our motivation is to give an introduction how the most important
+-pic, rather our motivation is to give an introduction how the most important
  commands work inside LyX, since the keystrokes as explained in the 
 \begin_inset ERT
 status collapsed
@@ -356,7 +365,7 @@ Xy
 
 \end_inset
 
--Pic manual
+-pic manual
 \begin_inset CommandInset citation
 LatexCommand cite
 key "xypic manual"
@@ -399,7 +408,7 @@ key "xypic"
 .
  After freshly installing them, it may be necessary, to run 
 \family sans
-Edit\SpecialChar \menuseparator
+Tools\SpecialChar \menuseparator
 Reconfigure
 \family default
  from the main LyX menu.
@@ -416,17 +425,38 @@ preview
 \begin_layout Enumerate
 Open LyX, choose 
 \family sans
-Edit\SpecialChar \menuseparator
+Tools\SpecialChar \menuseparator
 Preferences\SpecialChar \menuseparator
 Look and Feel\SpecialChar \menuseparator
-Graphics
+Display
 \family default
- and place a check-mark at 
+ and turn 
 \emph on
 Instant Preview
+\emph default
+ on.
+\end_layout
+
+\begin_layout Enumerate
+In 
+\family sans
+Document\SpecialChar \menuseparator
+Settings\SpecialChar \menuseparator
+Math
+\begin_inset space ~
+\end_inset
+
+Options
+\family default
+, uncheck 
+\emph on
+Use AMS Math package automatically
+\emph default
+ and check 
+\emph on
+Use AMS Math package
 \emph default
 .
 \end_layout
 
 \begin_layout Enumerate
@@ -449,7 +479,7 @@ g.
 
 \begin_layout Enumerate
 Move the cursor out of the formula, and watch it change its appearance to
- look just like in the finished dvi- or postscript document.
+ look just like in the finished DVI- or PostScript document.
  
 \end_layout
 
@@ -468,7 +498,7 @@ Xy
 
 \end_inset
 
--Pic
+-pic
 \family typewriter
 :
 \end_layout
@@ -513,10 +543,13 @@ $
 \end_inset
 
 .
- Commutative diagrams
 \end_layout
 
 \end_deeper
+\begin_layout Section
+Commutative diagrams
+\end_layout
+
 \begin_layout Standard
 The following diagram, which is taken from the documentation of 
 \begin_inset ERT
@@ -531,7 +564,7 @@ Xy
 
 \end_inset
 
--Pic
+-pic
 \begin_inset CommandInset citation
 LatexCommand cite
 key "xypic manual"
@@ -621,7 +654,8 @@ xymatrix{
 \begin_layout Standard
 \begin_inset Formula $\xymatrix{U\ar@/_{1pc}/[ddr]_{\psi}\ar@/{}^{1pc}/[drr]^{\varphi}\ar@{.>}[dr]|-{(x,y)}\\
  & X\times_{Z}Y\ar[d]^{q}\ar[r]_{p} & X\ar[d]_{f}\\
- & Y\ar[r]^{g} & Z}
+ & Y\ar[r]^{g} & Z
+}
 $
 \end_inset
 
@@ -831,7 +865,8 @@ ar[r] & Z }
 \begin_layout Standard
 \begin_inset Formula \xymatrix{ U \ar[ddr] \ar[drr] \ar[dr]\\
  &  X \times_{Z} Y \ar[d] \ar[r]  &  X \ar[d]\\
- &  Y \ar[r]  &  Z }
+ &  Y \ar[r]  &  Z 
+}
 
 
 \end_inset
@@ -906,7 +941,7 @@ beta
 \begin_inset Formula $\beta$
 \end_inset
 
- above the arrow, i.
+ above the arrow, e.
 \begin_inset space \thinspace{}
 \end_inset
 
@@ -995,7 +1030,8 @@ ar[r]^g & Z }
 \begin_layout LyX-Code
 \begin_inset Formula \xymatrix{ U \ar[ddr]_{\psi}\ar[drr]^{\varphi}\ar[dr]|-{(x,y)}\\
  &  X \times_{Z} Y \ar[d]^{q} \ar[r]_{p}  &  X \ar[d]_{f}\\
- &  Y \ar[r]^{g}  &  Z }
+ &  Y \ar[r]^{g}  &  Z 
+}
 
 
 \end_inset
@@ -1082,7 +1118,7 @@ psi
 \end_layout
 
 \begin_layout Subsection
-Arrow modification 
+Arrow modification
 \end_layout
 
 \begin_layout Standard
@@ -1107,11 +1143,11 @@ Modification of the design, the form or the positioning of arrows are introduced
 \family default
  indicates, whether we want to modify the design, the or the curvature of
  the arrow.
- Various modifactions can be applied to an arrow at the same time.
+ Various modifications can be applied to an arrow at the same time.
 \end_layout
 
 \begin_layout Subsubsection
-Arrow design 
+Arrow design
 \end_layout
 
 \begin_layout Standard
@@ -1176,7 +1212,7 @@ ar@{^(->}[r].
 \begin_layout Standard
 \begin_inset Tabular
 <lyxtabular version="3" rows="11" columns="2">
-<features islongtable="true">
+<features islongtable="true" longtabularalignment="center">
 <column alignment="center" valignment="top" width="0">
 <column alignment="center" valignment="top" width="0">
 <row>
@@ -1511,7 +1547,7 @@ Following the @-character by either a 2, 3, _,or a ^, we can produce arrows
 \begin_layout Standard
 \begin_inset Tabular
 <lyxtabular version="3" rows="8" columns="2">
-<features islongtable="true">
+<features islongtable="true" longtabularalignment="center">
 <column alignment="center" valignment="top" width="0">
 <column alignment="center" valignment="top" width="0">
 <row>
@@ -1760,7 +1796,7 @@ Within certain limits there is even a way to design your own arrows.
 \backslash
 newdir
 \family default
- command in the preample.
+ command in the preamble.
  For explanations, we refer to the 
 \family typewriter
 
@@ -1891,7 +1927,7 @@ $
 \family sans
 Ctrl-m
 \family default
- for inline appearence or 
+ for inline appearance or 
 \family sans
 Ctrl-M
 \family default
@@ -1905,11 +1941,11 @@ Math
  
 \family sans
 \SpecialChar \menuseparator
-Alignment.
+Change Formula Type.
 \end_layout
 
 \begin_layout Subsection
-Bending arrows 
+Bending arrows
 \end_layout
 
 \begin_layout Standard
@@ -2000,8 +2036,7 @@ ar@/_{.5pc}/[l]}
 \end_layout
 
 \begin_layout Subsubsection
-Specifying exit- and entrance directions.
+Specifying exit- and entrance directions
 \end_layout
 
 \begin_layout Standard
@@ -2066,7 +2101,8 @@ in
 \begin_layout Standard
 \begin_inset Formula \[
 \xymatrix{A\ar@(dr,dl)[r]\ar@(dr,dl)[rr] & B\ar@(d,r)[dl] & C\\
-E\ar@(ul,ur)}
+E\ar@(ul,ur)
+}
 \]
 
 \end_inset
@@ -2112,7 +2148,7 @@ The above example is reminiscent of an automata diagram, except that in
 \end_layout
 
 \begin_layout Subsubsection
-Framing objects 
+Framing objects
 \end_layout
 
 \begin_layout Standard
@@ -2129,7 +2165,7 @@ Xy
 
 \end_inset
 
--Pic, entries can obtain a single or a double frame, such as 
+-pic, entries can obtain a single or a double frame, such as 
 \begin_inset Formula $\xymatrix{*+[F]{A}}
 $
 \end_inset
@@ -2188,19 +2224,8 @@ $
 \end_layout
 
 \begin_layout Standard
-\begin_inset ERT
-status collapsed
-
-\begin_layout Plain Layout
-
-
-\backslash
-noindent
-\end_layout
-
-\end_inset
-
- can be typeset as
+\noindent
+can be typeset as
 \end_layout
 
 \begin_layout LyX-Code
@@ -2322,7 +2347,8 @@ The dimension of the rectangle is given as a dotted pair
  the following: 
 \begin_inset Formula \[
 \xymatrix{A & B\ar@(d,r)[dl]\sp(0.2)\phi\sp(0.7)\psi\save"1,1"."2,1"*+[F=]\frm{}\restore\,\\
-C & \save"1,1"."1,2"*++[F]\frm{}\restore}
+C & \save"1,1"."1,2"*++[F]\frm{}\restore
+}
 \]
 
 \end_inset
@@ -2564,7 +2590,11 @@ Alt-m c
 Alt-m w
 \family default
  for the row commands.
+ A more direct way uses the icons in the math toolbar once it has been activated
+ via 
+\family sans
+View\SpecialChar \menuseparator
+Toolbars.
 \end_layout
 
 \begin_layout Subsection
 \family default
  followed by a space opens a box for an upper index.
  You can enter any LaTeX-code as a label.
 \end_layout
 
 \begin_layout Subsection
-Modifying arrows 
+Modifying arrows
 \end_layout
 
 \begin_layout Standard
@@ -2738,21 +2767,8 @@ where
 \emph on
 measure
 \emph default
- is any valid 
-\begin_inset ERT
-status collapsed
-
-\begin_layout Plain Layout
-
-
-\backslash
-TeX
-\end_layout
-
-\end_inset
-
--measure that should be entered as upper or lower index to the first slash
- /.
+ is any valid TeX-measure that should be entered as upper or lower index
+ to the first slash /.
  Make sure that the ending slash does not end up being part of the upper
  or lower index.
 \end_layout
@@ -2772,36 +2788,24 @@ lly convert it into graphical output.
 \end_layout
 
 \begin_layout Standard
-A more serious reason could be a syntactical error in your input.
- If necessary, redo the last editing steps, using 
-\emph on
-Ctrl-z
-\emph default
-, or try to translate the 
-\begin_inset ERT
-status collapsed
-
-\begin_layout Plain Layout
-
-
-\backslash
-LyX
-\end_layout
-
-\end_inset
-
--file into 
-\emph on
-dvi
-\emph default
+A more serious reason could be a syntactical error in your input (in that
+ case, the math edition area disappears completely).
+ If necessary, undo the last editing steps, using 
+\family sans
+Ctrl+Z
+\family default
+, or try to translate the LyX-file into 
+\family sans
+DVI
+\family default
  using 
-\emph on
-Ctrl-d
-\emph default
+\family sans
+Ctrl+D
+\family default
  or 
 \family sans
 View\SpecialChar \menuseparator
-Dvi
+DVI
 \family default
 .
  There should be some error generated, which hopefully gives you a hint
@@ -2813,20 +2817,7 @@ Hacks
 \end_layout
 
 \begin_layout Standard
-Certain things do not work correctly inside 
-\begin_inset ERT
-status collapsed
-
-\begin_layout Plain Layout
-
-
-\backslash
-LyX
-\end_layout
-
-\end_inset
-
-.
+Certain things do not work correctly inside LyX.
  The ones that we (used to) miss most are the horizontal and vertical scaling
  of diagrams, and the correct positioning of arrows.
  There are some workarounds that we are explaining here.
@@ -3030,8 +3021,8 @@ xyC
 {
 \family default
  or both.
- Dont't forget the backslashes and remember, that the closing brace is automatic
-ally supplied by LyX.
+ Don't forget the backslashes and remember, that the closing brace is automatica
+lly supplied by LyX.
  Inside the braces enter the dimensions.
  The default is 
 \family typewriter
@@ -3053,7 +3044,8 @@ xyC{.5pc}
 \begin_layout Standard
 \begin_inset Formula \[
 \xyC{.5pc}\xyC{9pc}\xymatrix{A\ar[r]\ar[d] & B\\
-C\ar@{}[ur]|{\text{{horizontal stretch}}}}
+C\ar@{}[ur]|{\text{{horizontal stretch}}}
+}
 \]
 
 \end_inset
@@ -3079,7 +3071,7 @@ Xy
 
 \end_inset
 
--vcommand allows the correct positioning of labels along the shaft of arrows.
+-command allows the correct positioning of labels along the shaft of arrows.
  This feature is sometimes necessary, when the default position of a label
  would otherwise clutter the picture, or would even coincide with other
  items, such as the intersection of the arrows in the figure below.
@@ -3196,7 +3188,8 @@ phi_{4}}.
 \begin_layout Standard
 \begin_inset Formula \[
 \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}}\\
-\circ\ar[ur]\sb(0.3)\phi & \bullet}
+\circ\ar[ur]\sb(0.3)\phi & \bullet
+}
 \]
 
 \end_inset
@@ -3358,7 +3351,7 @@ Xy
 
 
 \family default
--Pic manual 
+-pic manual 
 \begin_inset CommandInset citation
 LatexCommand cite
 key "xypic manual"
@@ -3389,6 +3382,32 @@ Xy
 \end_inset
 
 -pic to make braids, cobordism, string diagrams, and much more.
+ You might want to look on 
+\family typewriter
+inset_preview.lyx
+\family default
+ example shipped with LyX, which demonstrates how to use more advanced 
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+
+\backslash
+Xy
+\end_layout
+
+\end_inset
+
+-commands via 
+\family typewriter
+ERT
+\family default
+ and 
+\family typewriter
+Instant preview
+\family default
+ insets.
  A good and rather systematic introduction to 
 \family typewriter
 
@@ -3420,6 +3439,7 @@ key "Ouvaton"
 \end_layout
 
 \begin_layout Bibliography
+\labelwidthstring References
 \begin_inset CommandInset bibitem
 LatexCommand bibitem
 label "1"
@@ -3443,7 +3463,7 @@ Xy
 
 
 \emph on
--Pic User's Guide
+-pic User's Guide
 \emph default
 .
  Version 3.7, Feb.
@@ -3457,6 +3477,7 @@ xypic
 \end_layout
 
 \begin_layout Bibliography
+\labelwidthstring References
 \begin_inset CommandInset bibitem
 LatexCommand bibitem
 label "2"
@@ -3479,6 +3500,7 @@ http://www.tug.org/tex-archive/help/Catalogue/entries/preview-latex.html
 \end_layout
 
 \begin_layout Bibliography
+\labelwidthstring References
 \begin_inset CommandInset bibitem
 LatexCommand bibitem
 label "3"
@@ -3501,6 +3523,7 @@ http://www.tug.org/tex-archive/help/Catalogue/entries/xypic.html
 \end_layout
 
 \begin_layout Bibliography
+\labelwidthstring References
 \begin_inset CommandInset bibitem
 LatexCommand bibitem
 label "4"
@@ -3523,6 +3546,7 @@ http://www.gnu.org/software/auctex/
 \end_layout
 
 \begin_layout Bibliography
+\labelwidthstring References
 \begin_inset CommandInset bibitem
 LatexCommand bibitem
 label "5"
@@ -3545,7 +3569,7 @@ Xy
 
 
 \emph on
--Pic
+-pic
 \emph default
  
 \emph on
@@ -3557,7 +3581,7 @@ status collapsed
 
 \begin_layout Plain Layout
 
-http://www.dpmms.cam.ac.uk/~al366/xytutorial.html
+http://www.math.columbia.edu/~lauda/xy/
 \end_layout
 
 \end_inset
@@ -3566,6 +3590,7 @@ http://www.dpmms.cam.ac.uk/~al366/xytutorial.html
 \end_layout
 
 \begin_layout Bibliography
+\labelwidthstring References
 \begin_inset CommandInset bibitem
 LatexCommand bibitem
 label "6"
@@ -3588,7 +3613,7 @@ Xy
 
 
 \emph on
--Pic
+-pic
 \emph default
 : 
 \emph on