[metapost] inline specials again

laurent at math.toronto.edu laurent at math.toronto.edu
Thu Mar 26 03:53:46 CET 2009




Hi all,

My thanks go to to Hans, Dan, and Taco for introducing me
to MP's newish 'inline special' commands that
indeed seem to have power comparable to TeX's special
command.

Here is what the 2008 MP manual says :

 | 9.5 Local specials
 |
 | If you want to attach a special bit of PostScript code, you can
 | use
 |
 |      withprescripthstring <expression>
 |
 | and
 |
 |      withpostscripthstring <expression>
 |
 | The strings will be written to the output file before and after
 | the current object, each beginning on their own line. You can
 | specify multiple withprescript or withpostscript options if you
 | like. When you specify more than one withprescript or more than
 | one withpostscript option, be wary of the fact that the scripts
 | use a form of nesting: the withprescript items are written to the
 | PostScript file in last in, first out order; whereas the
 | withpostscript items are written in first in, first out order.

The MP manual does not make clear for me what "object" means in
this context. PostScript has an "object" concept that is pretty
clearly explained in the PS manual.  But MP has a different
"object" concept about which the MP manual is a bit coy.  I believe that
the MP concept is intended in the quote above. Any comments
to make the MP concept clearer?

The keywords do suggest that   withprescript <string>   and
withpostscript <string>   can legitimately be typed in parallel to
any other "with" keyword construct such as "withpen ..." or
"withcolor ..."

Now any MP user should with a bit of luck be able to insert into
his MP output

(i)   textual comments

(ii)  any completely autonomous EPS file (say one created by Adobe
Illustrator). It would be nice if just appropriately quoting the
EPS filename would be enough. A minimal example would be welcome.

Cheers

Laurent S.





More information about the metapost mailing list