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.1 FILES AND ENVIRONMENTS. 12<br />

\<strong>mfpic</strong>[〈xfactor〉][〈yfactor〉]{〈xmin〉}{〈xmax〉}{〈ymin〉}{〈ymax〉}<br />

...<br />

\end<strong>mfpic</strong><br />

These macros open and close the <strong>mfpic</strong> environment 8 in which the drawing macros make sense.<br />

While many MFPIC commands can be used inside or outside this environment, those that actually<br />

produce visible output are required to be inside. The \<strong>mfpic</strong> macro also sets up the local coordinate<br />

system for the picture. The 〈xfactor〉 and 〈yfactor〉 parameters establish the length of a coordinate<br />

system unit, as a multiple of the TEX dimension \<strong>mfpic</strong>unit. If neither is specified, both are taken<br />

to be 1 and each coordinate system unit is 1 \<strong>mfpic</strong>unit. If only one is specified, then they are<br />

assumed to be equal. Note that some drawing commands require equal scales to work as expected:<br />

if you try to draw a circle with different scales you will get an ellipse.<br />

The 〈xmin〉 and 〈xmax〉 parameters establish the lower and upper bounds for the x-axis coordinates;<br />

similarly, 〈ymin〉 and 〈ymax〉 establish the bounds for the y-axis. These bounds are expressed<br />

in local units—in other words, the actual width of the picture will be (〈xmax〉 − 〈xmin〉) · 〈xfactor〉<br />

times \<strong>mfpic</strong>unit, its height (〈ymax〉 − 〈ymin〉) · 〈yfactor〉 times \<strong>mfpic</strong>unit, and its depth zero.<br />

Most of MFPIC’s drawing macros accept parameters which are coordinate pairs. A coordinate<br />

pair is a pair of numbers (x,y) enclosed in parentheses, with 〈xmin〉 ≤ x ≤ 〈xmax〉 and 〈ymin〉 ≤ y ≤<br />

〈ymax〉. 9 We will call these graph coordinates and refer to the numbers x and y as being in graph<br />

units. Things like the thickness of lines and the lengths of arrowheads are required to be expressed<br />

in actual lengths such as 1pt or 3mm. These will be referred to as absolute units.<br />

One can scale all pictures uniformly by changing \<strong>mfpic</strong>unit, and scale an individual picture<br />

by changing 〈xfactor〉 and 〈yfactor〉. After loading MFPIC, \<strong>mfpic</strong>unit has the value 1pt. One pt<br />

is a printer’s point, which equals 1/72.27 inches or 0.35146 millimeters.<br />

Note: Changing \<strong>mfpic</strong>unit or the optional parameters will scale the coordinate system, but<br />

not the values of parameters that are defined in absolute units. If you wish, you can set these to<br />

multiples of \<strong>mfpic</strong>unit, but it is difficult (and almost certainly unwise) to get the thickness of<br />

lines (for example) to scale along with the scale parameters.<br />

In addition to establishing the coordinate system, these scales and bounds are used to establish<br />

the metric for the METAFONT character or bounding box for the METAPOST figure described within<br />

the environment. If any of these parameters are changed, the .tfm file (METAFONT) or the bounding<br />

box (METAPOST) will be affected, so you will have to be sure to reprocess the TEX file after<br />

processing the .mf or .mp file, even if no other changes are made in the figure.<br />

The value of these 6 parameters to \<strong>mfpic</strong> are available within the environment as macros:<br />

\xfactor, \yfactor, \xmin, \xmax, \ymin and \ymax.<br />

\<strong>mfpic</strong>number{〈num〉}<br />

Normally, \<strong>mfpic</strong> assigns the number 1 to the first <strong>mfpic</strong> environment, after which the number<br />

is increased by one for each new <strong>mfpic</strong> environment. This number is used internally to include the<br />

picture. It is also transmitted to the output file where it is used as the argument to a begin<strong>mfpic</strong><br />

command. In METAFONT this number becomes the position of the character in the font file, while in<br />

METAPOST it is part of the name of the graphic file that is output. The above command tells MFPIC to<br />

ignore this sequence and number the next <strong>mfpic</strong> figure with 〈num〉 (and the one after that 〈num〉+1,<br />

etc.). It is up to the user to make sure no number is repeated, as no checking is done. Numbers greater<br />

than 255 may cause errors, as TEX assumes that characters are represented by numbers no larger than<br />

that. If the first figure is to be numbered something other than 1, then, under the metapost option,<br />

8 We use the term ‘environment’ loosely. However, in LATEX one may use an actual <strong>mfpic</strong> environment. See page 13.<br />

9 These inequalities can be violated, usually causing something to be drawn outside the designated borders of the figure.

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

Saved successfully!

Ooh no, something went wrong!