Difference between revisions of "Command/defineMPinstance"

From Wiki
Jump to navigation Jump to search
(Add info about predefined instances)
m
Line 35: Line 35:
  
 
== Example ==
 
== Example ==
<texcode>
+
<context mode="mkiv" source="yes" text="Gives:">
 
\defineMPinstance
 
\defineMPinstance
 
   [important]
 
   [important]
Line 64: Line 64:
  
 
\stoptext
 
\stoptext
</texcode>
+
</context>
  
  

Revision as of 08:56, 10 May 2012

\defineMPinstance

Syntax

\defineMPinstance[...][...][...]
[...] name
[...] name for inheritance (optional)
[...] see \setupMPinstance


Description

This command sets up a custom MetaPost style with particular features that can be selected using the first argument. The instance metafun is the default one and does not need to be created. However, custom styles can inherit from the metafun instance.

Predefined Instances

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

Example

\defineMPinstance
  [important]
  [metafun] % needs to be inherited from the global metafun instance
  [textcolor=red]

\defineMPinstance
  [veryimportant]
  [important]
  [textstyle=bold]

\starttext

% normal black text
\startMPcode
  draw textext("some text") ;
\stopMPcode

% red text
\startMPcode{important}
  draw textext("some text") ;
\stopMPcode

% red bold text
\startMPcode{veryimportant}
  draw textext("some text") ;
\stopMPcode

\stoptext

Gives:


See also

\setupMPinstance, Mpgraphic

Help from ConTeXt-Mailinglist/Forum

All issues with: