[metapost] inline specials again

Dan Luecking luecking at uark.edu
Thu Mar 26 18:52:25 CET 2009


At 09:53 PM 3/25/2009, laurent at math.toronto.edu wrote:

>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?

See the syntax of the addto command, which is the MP primative
used by the draw, fill, and label commands. This is on page 46
of the manual (mpman.pdf). [My manual is dated May 13, 2008, and
documents MP version 1.005.]

All with* operators are ultimately used at the end of an addto
command. This syntax diagram should make it clear that the
"objects" are pictures and paths, and paths are either
"doublepath"s (stroked) or "contour"s (filled).

A string becomes a picture if followed by infont, while btex...etex
outputs a picture. So text is entered as a picture expression and
therefore counts as an object.

>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 ..."

The explanation on page 46 explicitly shows this: An addto command
ends with <options> and the list of options includes all these
with-operators.

>(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.

There appears to be a package that sort of addresses this: epsincl.
It seems to just place the filename (along with other information)
in a comment. A provided awk script postprocesses the mpost output
file to perform the actual inclusion.


Dan

Daniel H. Luecking
Department of Mathematical Sciences
University of Arkansas
"Dubito ergo cogito, cogito ergo sum" --Descartes



More information about the metapost mailing list