Difference between revisions of "Command/setupMPinstance"

From Wiki
Jump to navigation Jump to search
(Initial commit)
 
(Add additional keys and info about predefined instances)
Line 12: Line 12:
 
     <td class="cmd">[...]</td>
 
     <td class="cmd">[...]</td>
 
     <td>name </td>
 
     <td>name </td>
 +
  </tr>
 +
  <tr valign="top" class="second">
 +
    <td class="cmd">format</td>
 +
    <td>metafun mpost </td>
 +
  </tr>
 +
  <tr valign="top" class="second">
 +
    <td class="cmd">extensions</td>
 +
    <td>yes no </td>
 +
  </tr>
 +
  <tr valign="top" class="second">
 +
    <td class="cmd">initializations</td>
 +
    <td>yes no </td>
 
   </tr>
 
   </tr>
 
   <tr valign="top" class="second">
 
   <tr valign="top" class="second">
Line 31: 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:54, 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.

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: