Command/setupMPinstance

From Wiki
< Command
Revision as of 19:54, 8 May 2012 by Marco (talk | contribs) (Add additional keys and info about predefined instances)
Jump to navigation Jump to search

\setupMPinstance

Syntax

\setupMPinstance[...][...,...=...,...]
[...] name
format metafun mpost
extensions yes no
initializations yes no
textstyle bold sans mono …
textcolor color spec
setups


Description

This command sets up the default MetaPost instance metafun or a custom MetaPost instance previously defined with \defineMPinstance.

Predefined Instances

\defineMPinstance [metafun]  [format=metafun, extensions=yes, initializations=yes]
\defineMPinstance [metapost] [format=mpost]

Usage

To print all MetaPost labels in red:

\setupMPinstance [metafun] [textcolor=red]

\starttext

\startMPcode
  draw textext("some text") ;
\stopMPcode

\stoptext

Another example using the setups key:

\defineMPinstance
  [mpinstanceprefixed]
  [metafun]
  [setups=mp:instanceprefix:one, textcolor=red]

\startsetups mp:instanceprefix:one
   prefix:\space
\stopsetups

\starttext

\startMPcode
  draw textext("normal text") ;
\stopMPcode

\startMPcode{mpinstanceprefixed}
  draw textext("red text") ;
\stopMPcode

\stoptext

The above code prints:

normal text
prefix: red text

“normal text” is printed in black, as well as “prefix:”, only “red text” is printed in red.

See also

\defineMPinstance, Mpgraphic


Help from ConTeXt-Mailinglist/Forum

All issues with: