23.10.2014 Views

mfpic-doc.pdf.

mfpic-doc.pdf.

mfpic-doc.pdf.

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4.6 FUNCTIONS AND PLOTTING. 47<br />

\mfpdatacomment\〈char〉<br />

Changes 〈char〉 to a comment character and changes the usual TEX comment character % to an<br />

ordinary character while reading a datafile for drawing.<br />

\using{〈in-pattern〉}{〈out-pattern〉}<br />

Used to change the assumptions about the format of the data file. For example, if there are<br />

four numbers on each line separated by commas, to plot the third against the second (in that order)<br />

you can say \using{#1,#2,#3,#4}{(#3,#2)}. This means the following: Everything on a line<br />

up to the first comma is assigned to parameter #1, everything from there up to the second comma<br />

is assigned to parameter #2, etc. Everything from the third comma to the end of line is assigned<br />

to #4. When the line is processed by TEX a METAFONT pair is produced representing a point on<br />

the curve. METAFONT pair expressions can be used in the output portion of \using. For example<br />

\using{#1,#2,#3}{(#2,#1)/10} or even \using{#1 #2 #3}{polar(#1,#2)} if the data are<br />

polar coordinates. The default assumptions of the \datafile command (numbers separated by<br />

spaces, with the first two determining the (x,y) pair) corresponds to the following setting.<br />

\using{#1 #2 #3}{(#1,#2)}<br />

The \using command cannot normally be used in the replacement text of another command. Or<br />

rather, it can be so used, but then each # has to be doubled. If a \using declaration occurs in an<br />

<strong>mfpic</strong> environment it is local to that environment. Otherwise it affects all subsequent ones.<br />

\sequence<br />

As a special case, you can plot any number against its sequence position, with something like<br />

\using{#1 #2}{(\sequence,#1)}. Here, the macro \sequence will take on the values 1, 2, etc.<br />

as lines are read from the file.<br />

\usingpairdefault<br />

\usingnumericdefault<br />

The command \usingpairdefault restores the above described default for pair data. The<br />

command \usingnumericdefault is the equivalent of \using{#1 #2}{#1}, a useful default for<br />

numeric data.<br />

Note that the default value of \using appears to reference three arguments. If there are only two<br />

numbers on a line separated by whitespace, this will still work because of TEX’s argument matching<br />

rules. TEX’s file reading mechanism normally converts the EOL to a space, but there are exceptions<br />

so MFPIC internally adds a space at the end of each line read in to be on the safe side. Then the<br />

default definition of \using reads everything up to the first space as #1 (whitespace is normally<br />

compressed to a single space by TEX’s reading mechanism), then everything to the second space<br />

(the one added at the end of the line, perhaps) is #2, then everything to the EOL is #3. This might<br />

assign an empty argument to #3, but it is discarded anyway.<br />

If the numerical data contain percentages with explicit % signs, then choose another comment<br />

character with \mfpdatacomment. This will change % to an ordinary character in the data file.<br />

However, in your \using command it would still be read as a comment. The following allows one<br />

to overcome this.<br />

\makepercentother<br />

\makepercentcomment<br />

Here is an example or their use:<br />

\makepercentother<br />

\using{#1% #2 #3}{(#1/100,#2)}<br />

\makepercentcomment

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

Saved successfully!

Ooh no, something went wrong!