Subject: categories: Re: graphics

From: Vaughan Pratt <[email-masked]>
Date: Tue, 24 Feb 2004 21:26:08 -0800

>My favorite method is to draw figures in xfig, then export the result as
>LaTeX picture code and edit the text to take advantage of LaTeX's
>text processing capabilities, fonts and special symbols.
>It would be quite suitable for flow chart graphics.
>D. Yetter

Xfig is pretty convenient, but one can get a tad impatient with xfig's
imprecision after a while.  The time it takes to drag a vertex into position
with acceptable precision tends in practice to be several times what it
takes to simply type that position in by hand if you can see right away
which lattice point it has to be.  If you're a Picasso in such things then
starting off with xfig isn't so bad, but if you're more of a Mondrian you
might prefer to work in Latex's picture environment from the get-go.

As with xypic, choosing a scale that makes the coordinates meaningful integers
helps a lot here, e.g. being able to coordinatize the vertices of a diamond
as (1,0), (0,1), (-1,0), (0,-1), or putting the inputs to an AND gate at
(0,1) and (0,3) and the output at (4,2), or putting the vertices of a Hasse
diagram at small lattice points.

The only other widely supported language I know that's expressive enough to
write a complete macro library in 20 lines for capabilities like flowcharts,
digital or analog circuits, and lattice diagrams and that interoperates
smoothly with Latex is PostScript.  That works too, the main downside
compared to programming directly in Latex's picture environment (for
those using pdflatex) is the external file needed in the use of epstopdf
plus includegraphics.  (I'm using both in the paper I'm currently working
on, mainly for fear of running out of Tex's memory with the more complex
figures.  Not that either are great programming languages per se, actually
they kind of suck in that regard, thank you Don, Leslie, John, and Chuck!)
The above comment about picking the right scale applies equally to Latex's
picture environment and PostScript.

When your diagrams are sufficiently like the ones that xypic, diagram.tex,
and diagrams.tex are designed for, those are pretty good too.  But they're
not really conceived of as programming languages, making their usefulness
inversely proportional to the distance between their kind of diagrams
and yours.

Vaughan Pratt

---

From: Robert Seely <[email-masked]>
Date: Fri, 27 Feb 2004 11:44:08 -0500 (EST)

Using picture mode is very convenient when things aren't too complicated,
and editing picture mode code is always (well, almost always) easier than
redoing mouse based drawing.  But the combination of a mouse-based drawing
to generate picture mode code, then editing that for fine-tuning is often
helpful.  For those who are condemned to the Windows framework, let me
recommend TeXCad - originally written by G Horn (it was then part of the
emtex distribution), currently maintained by Gautier de Montmollin
<http://homepage.sunrise.ch/mysunrise/gdm/texcad.htm>.  Like Xfig, it
creates picture mode code from your mouse-based drawing.  The two programs
are not completely similar (I prefer TeXCad, but others may differ!), but if
you're using Windows, give it a try.

-= rags =-

On Tue, 24 Feb 2004, Vaughan Pratt wrote:

> imprecision after a while.

-- 
<[email-masked]>
<www.math.mcgill.ca/rags>

---

From: "Ronald Brown" <[email-masked]>
Date: Sat, 28 Feb 2004 10:15:28 -0000

reply to [email-masked]

Comment: We are redoing the pictures in my old Topology book for reprinting
and find
Overpic (a standard tex package) convenient to superimpose Latex math code
onto postscript pictures produced from a graphics package. An advantage is
the ease in such a package of putting in colour and variable shading.

Sometimes the dvi or postscript output from the file does not work, yet the
dvi to pdf does, and you get a good pdf file. (see comments on overpic on
the web).

Query: I would like to use color in xypic, particularly xymatrix, but the
reference guide is difficult to follow on this point. My dvi viewer (YAP)
has no problem  with color. Can color be used in xymatrix? I would be
grateful for some sample xymatrix or xy code using color for different
arrows in a commutative diagram, such as those in the following file.

Ronnie Brown
http://www.bangor.ac.uk/~mas010

%vktdiagrams.tex  16/02/04 19/02/04

\documentclass[a4paper, 12pt]{article}

\usepackage{amsmath,amssymb,geometry,xypic,epic,eepic,color}
\xyoption{all}  \geometry{textwidth=3D17cm}
\def\io{^{-1}}
\def\red{\textcolor{red}}

\begin{document}

\today

\noindent{\bf van Kampen diagrams}

This is a method of deducing consequences of relations, and indeed
can be used to write an element as a consequence of the relations.

\noindent { \sc Example 1:} The quaternion group of order 8 is
usually presented in the form $$Q_8 =3D gp\langle x,y \mid x^4,
x^2y^{-2}, y^{-1}xyx \rangle.$$ However the following diagram
shows that the relation $x^4=3D1$ is a consequence of the other two
relators. Set $r=3Dx^4, s=3Dx^2y^{-2}, t=3Dy^{-1}xyx$.

$$\def\labelstyle{\textstyle}\xymatrix@R=3D1pc{A  \ar @{}[dr]  | s \ar =
@{-}[rrr] | \tip ^ x &&& B \ar   @{-}[dddd] | \tip ^ x\\
& E \ar   @{-}[urr] | \tip _ y \save[]+<4.5em,-1.3ex>*{ t}
\restore
 \save[]+<1em,-5ex>*{{s^{-1}} } \restore&& \\
&& F \ar @{-} [ul]  | \tip _x  \ar @{-} [ddr]  | \tip ^y & \\ & G
\save[]+<0.1em,2ex>*{ \bullet} \restore
\ar @{} [drr] |t \ar @{-}[ur] | \tip _ x \ar @{-}[dl] | \tip ^ y && \\
H  \save[]+<-1em,-0.5ex>*{\bullet}\restore\save[]+<0.4em,3.5ex>*{
\bullet} \restore \save[]+<1.3em,0.8ex>*{ \bullet} \restore\ar
@{-}[uuuu] | \tip _ x \ar @{-}[uuur] | \tip _ y && &
\save[]+<-0.3em,3ex>*{ \bullet} \restore K\ar @{-}[lll] | \tip ^ x
}
$$

In this diagram, each cell has to have a base point, represented
in the diagram by a $\bullet$, which is where the reading of the
boundary starts,  and an orientation. Here each label is read
clockwise, and this explains why we have an $s$ and $s^{-1}$,
since the latter is read counterclockwise.

Now we have to show how we can deduce from this diagram the
expression we want.

We take the outside loop  starting from $H$ (which has a base
point for the outside `cell') and then change it to traverse the
boundary of each internal cell, obtaining the rule which you can
easily verify:

$$xxy\io y\io. y x\io x\io y. y\io xyx. x\io. y\io xyx .x =3D x^4.
$$
This can be reread as:
$$s. y x\io x\io y . t. x\io. t.x=3Dx^4.$$
But $y x\io x\io y=3D yx\io x\io .yyx\io x\io . xxy\io =3D (s \io )
^{xxy\io}$. So our final result is that
$$ s.(s \io )^{xxy\io}.t. t^x. r\io  $$is an identity among
relators, or, alternatively, shows in a precise way how $x^4$ is a
consequence of the other relators.

\noindent {\sc Example 2:} To see the start of this process,
consider the diagram: \red{
$$\def\labelstyle{\textstyle}\xymatrix @R=3D3pc {B
\ar @{-}@/^3pc/ [rr] | \tip ^d  \save[]+<3.2em,4ex>*{ t} \restore
 \save[]+<1em,1ex>*{ \bullet} \restore\ar @{-} [rr] |\tip _b && C \ar =
@{-} [dl] |\tip ^c \\
& A \ar @{-} [ul] | \tip  ^a \save[]+<0em,5.5ex>*{s}  \restore
\save[]+<0em,1.5ex>*{\bullet}\restore
\save[]+<-1em,-0.5ex>*{\bullet}\restore & }
$$}
We write $\delta s=3D abc, \; \delta t =3D db\io$. Hence
$$ adc =3D abc. c \io b \io . db\io .bc =3D (\delta s)( \delta (
t^{bc})).$$ Of course $t^{bc}$ makes sense in the context of
crossed modules of groupoids, since $t$ is based at $B$ whereas
$t^{bc}$ is based at $A$.

One context for van Kampen diagrams is clarified by the notion of
{\it shelling} of such a diagram. This is a sequence of
2-dimensional subcomplexes $K_0,K_1, \ldots, K_n$ each of which is
formed from a union of 2-dimensional cells, with $K_0$ consisting
of a chosen basepoint $*$, $K_1$ being a 2-cell $s_1$ with $*$ on
its boundary, and such that for $i=3D2, \ldots, n$, $K_i$ is
obtained from $K_{i-1}$ by adding a 2-cell $s_i$ such that $s_i
\cap K_{i-1}$ is a non empty union of 1-cells which form a
connected and 1-connected set, i.e. a path. Such a shelling will
yield  a formula for the boundary of $K_n$ in terms of the
boundaries of each individual cell, provided each cell is given  a
base point and orientation.

Here is a clear way of getting the formula (explained by Chris
Wensley):

Choose $* =3D K_0$ as base point for all the $K_i$.
The relator for $K_0$ is the trivial word.
If $B_1$ is the base point for $s_1$ and $P_1$ is the anticlockwise path
around $s_1$ from $B_1$ to $*$ and $w_1$ is the word in the generators
read off along $P_1$, then the relator for $K_1$ is =
$\delta({s_1}^{w_1})$.
For $i \geqslant 2$,
let $B_i$ be the base point for $s_i$,
and let $U_i, V_i$ be the first and last vertices in the intersection
$s_i \cap K_{i-1}$ met when traversing the boundary of $K_{i-1}$
in a clockwise direction
(so that the intersection is a path $U_i \ldots V_i$).
Then if $B_i$ lies on $U_i \ldots V_i$ let $P_i$ be the path
$B_i \ldots U_i \ldots *$,   otherwise let $P_i$ be the path
$B_i \ldots V_i \ldots U_i \ldots *$
(traversing the boundary of $s_i$ in an anticlockwise direction
and the boundary of $K_{i-1}$ clockwise).
If $w_i$ is the word in the generators read off along $P_i$ then
$$
(\text{relator  for }  K_i) =3D (\text{relator for }
K_{i-1}).\delta({s_i}^{w_i}).
$$
In Example 2,  $w_2 =3D bc$.

\noindent {\sc Example 3:}

The next example is the non obvious fact that the relators
$$r=3D x^2yxy^3,\;\;  s=3D y^2xyx^3$$
have $x^7$ as a consequence.  This follows from the next picture.
We leave it as an exercise to check that base points and
orientations can be assigned, and, harder, to give $x^7$ as a
consequence of $r,s$. On the other hand, it is not clear what the
use of such a formula would be.

$$\def\labelstyle{\textstyle} \xymatrix@M=3D0.1pc =
@C=3D2.7pc@R=3D1.3pc{&&&&\circ \ar [dr] |y
\ar [ddllll] |x  &&&& \\
&&& \circ \ar [ur] |y && \circ \ar [dr] |y&&& \\
\circ \ar [ddddddd] _x&& \circ\ar [ur] |x\ar @{} [rrrr] |r&&&&
\circ\ar [dr] |x && \circ \ar
[uullll] _x \\
& \circ \ar [ur] |y \ar [dr] |x &&&&&& \circ \ar@{-} [llllll]|(0.7)\tip  =
^x \ar [dddddd] ^y& \\
&&\circ \ar [dr] |y \ar @{} [rrrr] |{s^{-1}} & &&& \circ \ar [ur] |x && =
\\
\ar @{} [r] |{s^{-1}}&&& \circ \ar [dr] |y && \circ \ar [ur] |y &&\ar =
@{}[r] |{s^{-1}}&\\
 &\ar @{} [rrr] |r&&& \circ \ar [dl] |y \ar [ur] |x  &\ar @{} [rr] |r&&& =
\\
&& &\circ \ar [dl] |x && \circ \ar [ul] |x &&& \\
&& \circ \ar [dl]|x \ar @{} [rrrr] |{s^{-1}} &&& &\circ \ar [ul]|y &&\\
 \circ \ar [r] _x & \circ  \ar [uuuuuu] ^y\ar
[rrrrrr] _x &&&&&& \circ \ar [r] _x
 \ar [ul] |y  & \circ\ar [uuuuuuu] _x \\
&&&&&&&& }
$$

These examples are from David Johnson's book on `Combinatorial
group theory'. Other examples on van Kampen diagrams are in that
book, and may also be found by a web search. The geometric and
metric analysis of van Kampen diagrams has proved important in
aspects of combinatorial group theory.

There are in the literature van Kampen diagrams which are not
shellable. The general context for this can be put as follows.

A  {\it complete generalised van Kampen diagram} is a finite
regular $CW$-structure $K$ on a  compact  subset of the sphere
$S^2$.  {\it Regularity} here means that each attaching map $f_s:
(S^1,1) \to (K^1,K^0)$ of a 2-cell $s$ is a homeomorphism into. By
omitting one 2-cell $s_\infty$ from $K$ and using stereographic
projection we can also regard $K\setminus s_\infty$ as a subset of
the plane $\mathbb{R}^2$. The projection of $K\setminus s_\infty$
gives a planar van Kampen diagram.

Whitehead's theorem says essentially that $\Pi(K,K^1,K^0)$ is the
free crossed $\pi_1(K^1,K^0)$-module on the characteristic maps of
the 2-cells of $K$.=20

\end{document}
\setlength{\unitlength}{1mm}
\begin{picture}(50,30)(10,10)
\linethickness{1pt}
 \put(90,0){\circle{20}}
 \put(90,10){\circle*{1}}
\put(100,){\circle*{1}} \put(90,-10){\circle*{1}}
 \spline(90,10)(94,15)(102,8)(104,4)(100,0)

\end{picture}

> Can one formulate the shelling to give a formula? If the cells added =
are
> s_1, ...,s_n then you still need to choose a path from * to the base =
point
> of s_2 after going round s_1, and the idea is to use the intersection =
of s_1
> and s_2. ....

Yes - here is the formula:

Choose * =3D B_1 =3D base point for s_1 as base point for all the K_i.
Then relator for K_1 =3D \delta(s_1). If  B_i  is the base point for
s_i,
    U_i is the first vertex in the intersection met when traversing
        the boundary of K_{i-1} in a clockwise direction,
    V_i is the last (traversing clockwise) vertex in the intersection
       (so that the intersection is a path from U_i to V_i)
then if B_i lies on U_i..V_i let P_i be the path B_i..U_i..*
     otherwise let P_i be the path B_i..V_i..U_i..*
    (traversing the boundary of s_i in an
     anticlockwise direction and the boundary of K_{i-1} clockwise)
and let w_i be the word in the generators read off along P_i. Then
(relator for K_i) =3D (relator for K_{i-1}).\delta(s_i^{w_i}) In
your example 2,  w_2 =3D bc.

Chris