next up previous contents
Next: Real world examples Up: Drawing knot pictures using Previous: Contents   Contents

Subsections

Basic training

While reading the XY-pic documentation, one must keep in mind, that XY-pic is written for TEX, so constructs look different here than in the documentation [RM99], which describes the usage with TEX.

Loading the package in a LATEX document

At first you must load XY-pic into your document, the next line loads XY-pic and enables the knot feature:
\usepackage[all,knot]{xy}
In the following I assume, your document contains at least these lines (the poly options is needed later):
\documentclass{article}
  \usepackage[all,knot,poly]{xy}
\begin{document}
  % -- put the examples here ---
\end{document}
The example's code is put somewhere between \begin{document} and \end{document}.

Hello unknot

The first example is the simplest knot, you can think of - the unknot:



\xygraph{
  !{0;/r2.0pc/:}
  !{\vcap-}
  !{\vcap}
}
typesets
\xygraph{
!{0;/r2.0pc/:}
!{\vcap-}
!{\vcap}
}


The line !{0;/r2.0pc/:} scales the picture, use different values instead of 2.0pc to get different sizes.

In the Reference Manual [RM99] there are two tables showing every crossing, uncrossing and join. In the joins-table you can see that \vcap produces a half circle. (I have included copies of these tables, see figure 2 and 3.)

\vcap- is a shorthand for \vcap[-1], which simply rotates the knot piece 180 degrees. Upper and lower half-circle made up the complete circle. If [n] is used with a positive number n the piece is scaled, [-n] scales and rotates.

Notice the use of !{...}, every XY-pic drawing command needs to be enclosed like this.

Moving around

(Hopf-link)

It is important to understand, that XY-pic maintains a current cursor pos. Drawing a knot piece changes this position. The next knot piece is drawn starting at the new position. Sometimes you can draw your knot pieces and the position is perfect for the next piece.

But in general one has to change the current cursor pos manually. The position is controlled by the [u],[d],[l],[r] commands. They change the position up, down, left, and right. Consider the next examples:


  \xygraph{
    !{0;/r1.0pc/:}
    !{\vunder}
    !{\vunder-}
    !{\hcap[2]}
    [l]!{\hcap[-2]}
  }
\xygraph{
!{0;/r1.0pc/:}
!{\vunder}
!{\vunder-}
!{\hcap[2]}
[l]!{\hcap[-2]}
}
  \xygraph{
    !{0;/r1.0pc/:}
    !{\vunder}
    !{\vunder-}
    [uur]!{\hcap[2]}
    [l]!{\hcap[-2]}
  }
\xygraph{
!{0;/r1.0pc/:}
!{\vunder}
!{\vunder-}
[uur]!{\hcap[2]}
[l]!{\hcap[-2]}
}


(Due to the [l] in the first example, it is possible to distinguish the two halfcircles.) The !{\vunder} changes the position in the right way, for the next !{\vunder-}, but the !{\hcap[2]} - the ``)'' shaped piece - is misplaced. In the second example the position is moved up two times and right once ([uur]). The two up movements are required because of the !{\vunder} !{\vunder-} combination. At last, the ``(`` shaped piece is placed after a jump to the left ([l]).

Notice the fact, that !{\hcap[2]}, which is a double sized piece, is exactly as high, as the !{\vunder} !{\vunder-} combination.

The tables in the Reference-Manual provide enough information, so that there is no need guessing where the position moves, while drawing a knot piece. But I don't understand enough of that, so I can't explain it here.

When typesetting a new knot diagram I use this approach (trial and error):

  1. typeset the first two pieces and control their positions
  2. if they are correct, add the others, piece by piece
  3. after adding one piece control the position
  4. only add a new piece, if the picture is correct
If the pictures get more complex and contain more than one piece of the same type, it is hard to distinguish which piece of this type is misplaced, if you add them simultaneously.

You need a fast computer, since the latex-run is time consuming. For typesetting a new knot diagramm, I use a separate empty document. After everything is perfect, I copy the lines in the real document.

Advanced Movements

If you want to move by a real factor, utilize the [c(f)] construct, where f is a real number like 0.5 or 2.3 and c a character $ \in \{\verb*\vert'u'\vert,
\verb*\vert'd'\vert, \verb*\vert'l'\vert, \verb*\vert'r'\vert\}$ . You can move the whole picture, if your first command is a movement command; consider the next examples, featuring the bracket polynomial:


$\bigl<
   \xygraph{
     !{0;/r1.0pc/:}
     !{\xunderv}
   }
 \bigr>$
$ \bigl<
\xygraph{
!{0;/r1.0pc/:}
!{\xunderv}
}\bigr>$
$\bigl<
   \xygraph{
     !{0;/r1.0pc/:}
     [u(0.5)]
     !{\xunderv}
   }
 \bigr>$
$ \bigl<
\xygraph{
!{0;/r1.0pc/:}
[u(0.5)]
!{\xunderv}
}\bigr>$
In the second example, the first command [u(0.5)] moves the current position up a half step. After that the knot piece is drawn.

Drawing a straight line

If you look through the tables in chapter 30 of [RM99], there is no obvious way, for producing a straight line. I am using a \xcaph which is curved, but it is possible to control the curvature. This is shown in the next example:


\xygraph{
  !{0;/r1.0pc/:}
  % straight line:
  !{\xcaph[2]@(0)} [ld]
  % this is curved:
  !{\xcaph[2]}
}
\xygraph{
!{0;/r1.0pc/:}
!{\xcaph[2]@(0)} [ldd]
!{\xcaph[2]}
}

Arrowtips

Figure 1: Placement-strings for arrowtips and labels
\begin{figure}\centering \begin{tabular}[t]{cc}
\begin{tabular}[t]{l\vert l}
S...
... & finish \\
\verb*+\vert+ & middle
\end{tabular} \end{tabular} \end{figure}

Sometimes knots and links are oriented. XY-pic supports orientation with the following notations after a knot piece, consider the next examples and figure 1:

\xygraph{
  !{0;/r1.0pc/:}
  !{\xcaph[2]@(0)=>}
  [dl] !{\xcaph[2]@(0)=<}
  [dl] !{\xcaph[2]@(0)==}
}
\xygraph{
!{0;/r1.0pc/:}
!{\xcaph[2]@(0)=>}
[dl]
!{\xcaph[2]@(0)=<}
[dl]
!{\xcaph[2]@(0)==}
}

Labels

With XY-pic it is possible to label parts of a diagram. Add either >,< or | and the text enclosed with curly braces, after your knot piece. Consider the next example and figure 1:

\xygraph{
  !{0;/r1.0pc/:}
  !{\xcaph[2]@(0)=>>{-1}}
  [dl] !{\xcaph[2]@(0)=<<{2}}
  [dl] !{\xcaph[2]@(0)==|{3}}
  [dl] !{\xcaph[2]@(0)|{4}}
}
\xygraph{
!{0;/r1.0pc/:}
!{\xcaph[2]@(0)=»{-1}}
[dl]
!{\xcaph[2]@(0)=«{2}}
[dl]
!{\xcaph[2]@(0)==\vert{3}}
[dl]
!{\xcaph[2]@(0)\vert{4}}
}


next up previous contents
Next: Real world examples Up: Drawing knot pictures using Previous: Contents   Contents
Lars Fischer 2003-06-15