23.10.2014 Views

mfpic-doc.pdf.

mfpic-doc.pdf.

mfpic-doc.pdf.

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.2 COMMON OBJECTS. 15<br />

after the command \pointdef{A}(1,3), \A expands to (1,3), while \Ax and \Ay expand to 1 and<br />

3, respectively. If mplabels is in effect one can use \A to specify where to place a text label, but if<br />

TEX is placing labels one must use (\Ax,\Ay). In most other cases, one can use \A where a pair or<br />

point is required.<br />

\polyline{〈p 0 〉,〈p 1 〉,...}<br />

\lines{〈p 0 〉,〈p 1 〉,...}<br />

The figure macro \polyline produces connected line segments from 〈p 0 〉 to 〈p 1 〉, and from<br />

there to 〈p 2 〉, etc. The result is an open polygonal path through the specified points, in the specified<br />

order. The macro \lines is an alias for \polyline.<br />

\polygon{〈p 0 〉,〈p 1 〉,...}<br />

\closedpolyline{〈p 0 〉,〈p 1 〉,...}<br />

The figure macro \polygon produces a closed polygon with vertices at the specified points in<br />

the specified order. It works exactly like \polyline except the last point in the list is also joined to<br />

the first. The macro \closedpolyline is an alias for \polygon.<br />

\rect{〈p 0 〉,〈p 1 〉}<br />

This figure macro produces the closed rectangle with horizontal and vertical sides, having the<br />

points 〈p 0 〉 and 〈p 1 〉 as diagonally opposite corners. The same rectangle can be specified in four<br />

different ways: either pair of opposite corners in either order.<br />

It is occasionally helpful to know that connected paths like those produced by \polyline or<br />

\rect have a start and a finish as well as sense (or direction). The path produced by \polyline<br />

starts at the first listed point and ends at last, having the direction determined by the order of the<br />

points. For \rect the sense may be clockwise or anticlockwise depending on the corners used:<br />

it starts by moving horizontally from the first listed point. Several MFPIC macros (such as those<br />

that add arrowheads) treat the beginning and the end of a path differently, or adjust their behavior<br />

according to the sense of the curve.<br />

\regpolygon{〈num〉}{〈name〉}{〈eqn 1 〉}{〈eqn 2 〉}<br />

This figure macro produces a closed regular polygon with 〈num〉 sides. The second argument,<br />

〈name〉 is a symbolic name. It can be used to refer to the vertices later. The last two arguments should<br />

be equations that position two of the vertices or one vertex and the center. The center is referred to<br />

by 〈name〉0 and the vertices by 〈name〉1 〈name〉2, etc., going anticlockwise around the polygon.<br />

The 〈name〉 itself (without a number suffixed) will be a METAFONT variable assigned the value of<br />

〈num〉. For example,<br />

\regpolygon{5}{Kay}{Kay0=(0,1)}{Kay1=(2,0)}<br />

will produce a regular pentagon with its center at (0,1) and its first vertex at (2,0). One could later<br />

draw a star inside it with<br />

\polygon{Kay1,Kay3,Kay5,Kay2,Kay4}<br />

Moreover, Kay will equal 5. The name given becomes a METAFONT variable and care should be<br />

taken to make the name distinctive so as not to redefine some internal variable.<br />

4.2.2 A WORD ABOUT LIST ARGUMENTS<br />

We have seen already four MFPIC macros that take a mandatory argument consisting of an arbitrary<br />

number of coordinate pairs, separated by commas. There are many more, and some that take a<br />

comma-separated list of items of other types. If the lists are long, especially if they are generated by

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!