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.

5 APPENDICES 83<br />

5.6.3 GRAPHIC INCLUSION<br />

It may be impossible to completely cater to all possible methods of graphic inclusions with automatic<br />

tests. The macro that is invoked to include the POSTSCRIPT graphic is \set<strong>mfpic</strong>graphic and the<br />

user may (carefully!) redefine this to suit special circumstances. Actually, MFPIC runs the following<br />

sequence:<br />

\prepare<strong>mfpic</strong>graphic{〈filename〉}<br />

\set<strong>mfpic</strong>graphic{〈filename〉}<br />

\get<strong>mfpic</strong>offset{〈filename〉}<br />

The following are the default definitions for \set<strong>mfpic</strong>graphic:<br />

plain TEX<br />

LATEX209<br />

LATEX<br />

<strong>pdf</strong>LATEX<br />

<strong>pdf</strong>TEX<br />

\def\set<strong>mfpic</strong>graphic#1{\epsfbox{#1}}<br />

(No longer supported, but likely the plain TEX definition will be selected.)<br />

\def\set<strong>mfpic</strong>graphic#1{\includegraphics{#1}}<br />

\def\set<strong>mfpic</strong>graphic#1{\includegraphics{#1}}<br />

\def\set<strong>mfpic</strong>graphic#1{\convertMPtoPDF{#1}{1}{1}}<br />

Moreover, since METAPOST by default writes files with numeric extensions, we add code to each<br />

figure, so that these graphics are correctly recognized as EPS or MPS. For example, to the figure<br />

with extension .1, we add the equivalent of one of the following<br />

\DeclareGraphicsRule{.1}{eps}{.1}{} in LATEX 2ε .<br />

\DeclareGraphicsRule{.1}{mps}{.1}{} in <strong>pdf</strong>LATEX.<br />

After running the command \set<strong>mfpic</strong>graphic, MFPIC runs \get<strong>mfpic</strong>offset to store the<br />

lower left corner of the bounding box of the figure in two macros \<strong>mfpic</strong>llx and \<strong>mfpic</strong>lly.<br />

All the above versions of \set<strong>mfpic</strong>graphic (except \includegraphics) make this information<br />

available; the definition of \get<strong>mfpic</strong>offset merely copies it into these two macros. What<br />

MFPIC does in the case of \includegraphics is to modify (locally) the definition of an internal<br />

command of the GRAPHICS package so that it copies the information to those macros, and<br />

then \get<strong>mfpic</strong>offset does nothing. This internal modification is accomplished by the macro<br />

\prepare<strong>mfpic</strong>graphic. Changes to \set<strong>mfpic</strong>graphic might require changing either or both<br />

of \prepare<strong>mfpic</strong>graphic and \get<strong>mfpic</strong>offset. All three of these commands are fed the<br />

graphic’s file name as the only argument, although only \set<strong>mfpic</strong>graphic currently does anything<br />

with it.<br />

One possible reason for wanting to redefine \set<strong>mfpic</strong>graphic might be to rescale all pictures.<br />

This is definitely not a good idea. A good deal of MFPIC’s figure placemant code assumes that the<br />

size of the figure is consistent with the coordinate system set up by the \<strong>mfpic</strong> command. With<br />

mplabels plus truebbox it might work, but (i) it has not been considered in writing the MFPIC code,<br />

(ii) it will then scale all the text as well as the figure, and (iii) it will scale all line thickness, which<br />

should normally be a design choice independent of the size of a picture. To rescale all pictures, one<br />

need only change \<strong>mfpic</strong>unit and rerun TEX and METAPOST.<br />

A better reason might be to allow the conversion of your METAPOST figures to some other format.<br />

Then redefining \set<strong>mfpic</strong>graphic could enable including the appropriate file in the appropriate<br />

format.<br />

The filename argument mentioned above is actually the result obtained by running the macro<br />

\setfilename. The command \setfilename gets two arguments: the name of the METAPOST<br />

output file (set in the \opengraphsfile command) without extension, and the number of the picture.<br />

The default definition of \setfilename merely inserts a dot between the two arguments. 23<br />

23 Unless modified by \setfilenametemplate, of course. See subsection 4.12.8.

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

Saved successfully!

Ooh no, something went wrong!