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 The Macros.<br />

Many of the commands of MFPIC have optional arguments. These are denoted just as in LATEX, with<br />

square brackets. Thus, the command for drawing a circle can be given<br />

\circle{(0,0),1}<br />

having only the mandatory argument, or<br />

\circle[p]{(0,0),1}<br />

Whenever an optional argument is omitted, the behavior is equivalent to some choice of the optional<br />

argument. In this example, the two forms have exactly the same behavior, drawing a circle<br />

centered at (0,0) with radius 1. In this case we will say “[p] is the default”. Another example is<br />

\point{(1,0)} versus \point[3pt]{(1,0)}. They both place a dot at the point (1,0). The second<br />

one explicitly requests that it have diameter 3pt; the first will examine the length command<br />

\pointsize, which the user can change, but it is initialized to 2pt. In this case we will say “the<br />

default is the value of \pointsize, initially 2pt”.<br />

If an MFPIC command that takes an optional argument finds only empty brackets (completely<br />

empty, no spaces), then it will use the default value. This is useful for commands that have two<br />

optional arguments and one wants the default value in the first one and some nondefault value in<br />

the second. An optional argument should normally not contain any spaces. Even when the argument<br />

contains more than one piece of data, spaces should not separate the parts. In some cases this will<br />

cause no harm, but it would be better to avoid doing it altogether, because there are cases where it<br />

will cause wrong results or error messages.<br />

4.1 Files and Environments.<br />

\opengraphsfile{〈file〉}<br />

...<br />

\closegraphsfile<br />

These macros open and close the METAFONT or METAPOST file which will contain the pictures<br />

to be included in this <strong>doc</strong>ument. The name of the file will be 〈file〉.mf (or 〈file〉.mp). Do not specify<br />

the extension, which is added automatically.<br />

Note: This command may cause 〈file〉.mf or 〈file〉.mp to be overwritten if it already exists, so<br />

be sure to consider that when selecting the name. Repeating the running of TEX will overwrite the<br />

file created on previous runs, but that should be harmless. For if no changes are made to <strong>mfpic</strong><br />

environments, the identical file will be recreated, and if changes have been made, then you want the<br />

file to be replaced with the new version.<br />

It is possible (but has not been seriously tested) to close one file and open another, and even to<br />

change between metapost and metafont in between. If anything goes wrong with this, contact the<br />

maintainer and it might be fixed in some later version.<br />

There may be limitations on what can be used as a filename. As of MFPIC version 1.00, we have<br />

tried to permit \jobname as part of 〈file〉. Thus we permit TEX macros, but they should expand<br />

to non-special characters. Permitting macros makes it essentially impossible for the filename to<br />

contain the backslash and brace characters. Also spaces are problematic. However other special TEX<br />

characters (for example: tilde, underscore and percent) can be used, though that is not recommended.<br />

11

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

Saved successfully!

Ooh no, something went wrong!