Command/defineMPinstance

From Wiki
< Command
Revision as of 14:36, 15 November 2019 by Usonianhorizon (talk | contribs)
Jump to navigation Jump to search

\defineMPinstance

Syntax (autogenerated)

\defineMPinstance[...][...][...=...,...]
[...]name
[...]name
...=...,...inherits from \setupMPinstance


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. Custom styles can inherit from the metafun instance, or not.

The MetaPost instance to use is specified as follows:

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

% a graphic that uses a custom instance
% This does not work with the current stable version
\startuseMPgraphic{veryimportant::mygraphic}
  draw textext("some text") ;
\stopuseMPgraphic

\useMPgraphic{veryimportant::mygraphic}

\stoptext

Gives:


See also

Help from ConTeXt-Mailinglist/Forum

All issues with: