Download XY-pic Reference Manual
Transcript
Nested Polygons
When \xypolygon is specified within either a
~<>{. . . } or ~>>{. . . } switch for another polygon,
then the inner polygon inherits a name which incorporates also the number of the part on which it
occurs, as given by \xypolynode. This name is accessed using \xypolyname. In the following example
the inner polygon is placed using ~<> in order to easily adjust its orientation to the outward direction of
the spokes.
2, 2?
???
89:;
2, 3? ?>=<
2 2, 1
??
?
2, 4
\xypolygon3{~:{/r5.2pc/:}
~>{}~<>{?\xypolygon3"a"{~:{(.5,0):}
~>{}~<>{?\xypolygon3"b"{~:{(.5,0):}
~>{}~<>{?\xypolygon3"c"{~:{(.5,0):}
~>{}~<>{?\xypolygon3"d"{~:{(.5,0):}
~<>{?*!/d.5pt/=0\hbox{\blacktriangle}}
}} }} }} }} }
Note the use of naming in this example; when processing this manual it saves 13,000+ words of main
memory and 10,000+ string characters as well as 122
strings and 319 multi-letter control sequences.
1, 3?
???
?>=<
1, 4? 89:;
1 1, 2
??
?
1, 1
28
Lattice and web feature
Vers. 3.3 by Ross Moore [email protected]
Load as: \xyoption{web}
3, 1?
???
89:;
3, 2? ?>=<
3 3, 4
??
?
3, 3
This feature provides macros to facilitate typesetting
of arrangements of points within a 2-dimensional lattice or “web-like” structure.
Currently the only routines implemented with this
feature are some “quick and dirty” macros for dropping objects at the points of an integer lattice. To
Do: More sophisticated routines will be developed
for later versions of XY-pic, as the need arises.
Mathematically speaking, let ~u and ~v be vectors
pointing in independent directions within the plane.
Then the lattice spanned by ~u and ~v is the infinite
set of points L given by:
L = a ~u + b ~v ; for a, b integers .
4, 4?
???
89:;
4, 1? ?>=<
4 4, 3
??
?
4, 2
\xypolygon4{~:{/r5pc/:}
~<>{*\frm<8pt>{o}\xypolygon4{~:{/-2pc/:}
~*{\xypolyname\xypolynode}}}
[o]=<5pc>{\xypolynode}}
Notice how nested polygons inherit names "1,1",
"1,2", . . . , "4,1", . . . , "4,4" for their vertices. If
a hprefixi is supplied at the outermost level then the
names become: "hprefixii, j". Specifying a hprefixi
for the inner polygon overrides this naming scheme.
The same names may then be repeated for each of
the inner polygons, allowing access afterwards only
to the last—possibly useful as a memory saving feature when the vertices are not required subsequently.
Four levels of nesting gives a quite acceptable
“Sierpinski gasket”. The innermost triangle is provided by \blacktriangle from the AMS symbol font
msam5, at 5-point size. Further levels can be achieved
using the PostScript backend, otherwise line segments become too small to be rendered using XY-fonts.
1
N
1NN1
N N
N
NN
1
N1
N
1NN1 N1NN1
N N N N
N
NN
NN
NN
1
NN1
N
N
1NN1
1N1
N
1NNNNNNN1 NN1NNNNNN1
N
1NNN1 NN1NN1 NN1NN1 NN1NN1
N
1NNNNNNNNNNNNNNNN1
N
N
1NN1
1N1
N
N
1NNNNNNN1
1NNNNNN1
N
N
N1 N
N1
N
N1 N
1
1
1
1N1
N
N
1NNNNNNNNNNNN1
1NNNNNNNNNNNN1
N
N
N
N1
N
N1
N
N1
N
1
1
1
1N1
N
1NNNNNN1 NN1NNNNNN1 NN1NNNNNN1 NN1NNNNNN1
N
N
N1 N
N1 N
N1 N
N1 N
N1 N
N1 N
N1 N
1
1
1
1
1
1
1
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN1NNNN1
N
Within XY-pic the vectors ~u and ~v can be established
as the current coordinate basis vectors. The following
macros typeset a finite subset of an abstract lattice.
\xylattice#1#2#3#4 points in lattice
\croplattice#1#2#3#4#5#6#7#8
. . . in specific rectangle.
The parameters #1 . . . #4 are to be integers amin ,
amax , bmin and bmax , so that the portion of the lattice to be typeset is that collection of vectors in L for
which amin ≤ a ≤ amax and bmin ≤ b ≤ bmax .
s(2)
O
\font\msamv=msam5 at 5pt
\def\blacktriangle{{\msamv\char’116}}
\def\objectstyle{\scriptscriptstyle}
56
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
•a
◦ ◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
◦
/ s(1)