Difference between revisions of "Command/setupMPinstance"

From Wiki
Jump to navigation Jump to search
(Add additional keys and info about predefined instances)
m (Move info about predefined instances to \defineMPinstance)
Line 43: Line 43:
  
 
This command sets up the default MetaPost instance <code>metafun</code> or a custom MetaPost instance previously defined with {{cmd|defineMPinstance}}.
 
This command sets up the default MetaPost instance <code>metafun</code> or a custom MetaPost instance previously defined with {{cmd|defineMPinstance}}.
 
== Predefined Instances ==
 
 
<texcode>
 
\defineMPinstance [metafun]  [format=metafun, extensions=yes, initializations=yes]
 
\defineMPinstance [metapost] [format=mpost]
 
</texcode>
 
  
 
== Usage ==
 
== Usage ==

Revision as of 19:55, 8 May 2012

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

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: