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.12 FOR ADVANCED USERS. 77<br />

separator (because that is usually the way METAPOST names its output), but this can be redefined<br />

if the METAPOST output undergoes further processing or conversion to another format in which the<br />

name is changed. Any redefinition of \setfilename must come before \opengraphsfile because<br />

that command tests for the existence of the first figure. After any redefinition, \setfilename must<br />

be a macro with two arguments that creates the actual filename from the above two parts. It should<br />

also be completely expandable. See the appendices, subsection 5.6.3 for further dicussion.<br />

\setfilenametemplate{〈template〉}<br />

With the metapost option, when you write \opengraphsfile{figs}, a file figs.mp is created.<br />

By default, running METAPOST on it results in files named figs.1, figs.2, etc. Recent META-<br />

POST allows the output filenames to be modified. As of MFPIC version 1.00, you can do this to some<br />

extent from your .tex file. One needs to define a template that tells METAPOST how to construct the<br />

output file name from the ‘jobname’ and the figure number. This is done with the above command.<br />

In 〈template〉 you can put any plain characters, plus the two special tokens: \_ and \#. Each figure’s<br />

filename is constructed by replacing these tokens with the METAPOST jobname and the figure<br />

number, respectively. For example, with the jobname figs,<br />

\setfilenametemplate{my\_-\#.mps}<br />

will cause the figure files to have names myfigs-1.mps, myfigs-2.mps, etc., instead of the defaults.<br />

MFPIC adjusts the definition of \setfilename accordingly, so that the correct filenames are<br />

used.<br />

Do not use this command unless you know your version of METAPOST is recent enough to have<br />

this capability. Under the metafont option, this command is simply ignored, but MFPIC has no way<br />

of checking the METAPOST version on its own.<br />

If you are using LATEX, the \includegraphics command requires that the included figure file<br />

be recognized as METAPOST output. In practice, this usually means its extension must be .mps. As<br />

an exception, it may also be the current figure number (the default if \setfilenametemplate is<br />

not used), because MFPIC has always arranged for that to be recognized. The user may also issue a<br />

\DeclareGraphicsRule command to get other extensions recognized. See the <strong>doc</strong>umentation of<br />

the GRAPHICS package.<br />

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

This command is automatically invoked before \set<strong>mfpic</strong>graphic to make any preparations<br />

needed. The default definition is to do nothing except when the GRAPHICS package is used. That<br />

package provides no clean way to determine the bounding box of the graphic after it is included.<br />

Since MFPIC needs this information, this command redefines an internal command of the GRAPHICS<br />

package to make the data available. If \set<strong>mfpic</strong>graphic is redefined then this may also have to<br />

be redefined.<br />

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

This command is automatically invoked after \set<strong>mfpic</strong>graphic to store the offset of the lower<br />

left corner of the figure in the macros \<strong>mfpic</strong>llx and \<strong>mfpic</strong>lly. If \set<strong>mfpic</strong>graphic is redefined<br />

then this may also have to be redefined.<br />

\ifmfpmpost<br />

Users wishing to write code that adjusts its behavior to the graph file processor can use this<br />

to test which option is in effect. The macro \usemetapost sets it true and \usemetafont sets it<br />

false. There are no commands \mfpmposttrue nor \mfpmpostfalse, since the user should not be

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

Saved successfully!

Ooh no, something went wrong!