Difference between revisions of "Command/defineMPinstance"
< Command
Jump to navigation
Jump to search
m (Add link) |
m (remove category "since xxx" and "until", but keep info obviously, too complex for category browsing (not a versioning syst)) |
||
(9 intermediate revisions by 4 users not shown) | |||
Line 3: | Line 3: | ||
|attributes= | |attributes= | ||
}} | }} | ||
+ | |||
+ | == [[Help:Reference|Syntax]] (autogenerated) == | ||
+ | <syntax>defineMPinstance</syntax> | ||
== [[Help:Reference|Syntax]] == | == [[Help:Reference|Syntax]] == | ||
Line 25: | Line 28: | ||
== Description == | == Description == | ||
− | This command sets up a custom MetaPost style with particular features that can be selected using the first argument. The instance <code>metafun</code> is the default one and does not need to be created. | + | This command sets up a custom MetaPost style with particular features that can be selected using the first argument. The instance <code>metafun</code> is the default one and does not need to be created. Custom styles can inherit from the <code>metafun</code> instance, or not. |
+ | |||
+ | The MetaPost instance to use is specified as follows: | ||
+ | * {{cmd|startMPcode}}. | ||
+ | * {{cmd|useMPgraphic|{instancename::graphicname}|}} | ||
+ | * {{cmd|startuseMPgraphic|{instancename::graphicname|}} since nov 2012. | ||
+ | * {{cmd|startuseMPgraphic|{graphicname}|}} until nov 2012. | ||
+ | |||
+ | == Predefined Instances == | ||
+ | |||
+ | <texcode> | ||
+ | \defineMPinstance [metafun] [format=metafun, extensions=yes, initializations=yes] | ||
+ | \defineMPinstance [metapost] [format=mpost] | ||
+ | </texcode> | ||
== Example == | == Example == | ||
− | < | + | <context mode="mkiv" source="yes" text="Gives:"> |
\defineMPinstance | \defineMPinstance | ||
[important] | [important] | ||
Line 55: | Line 71: | ||
draw textext("some text") ; | draw textext("some text") ; | ||
\stopMPcode | \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 | \stoptext | ||
− | </ | + | </context> |
== See also == | == See also == | ||
− | + | {{MetaPost see also}} | |
− | |||
− | |||
== Help from ConTeXt-Mailinglist/Forum == | == Help from ConTeXt-Mailinglist/Forum == | ||
Line 69: | Line 91: | ||
{{Forum|{{SUBPAGENAME}}}} | {{Forum|{{SUBPAGENAME}}}} | ||
− | [[Category: | + | [[Category:Command/MetaPost|definestartstop]] |
Latest revision as of 13:29, 8 June 2020
\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:
- \startMPcode.
- \useMPgraphic{instancename::graphicname}
- \startuseMPgraphic{instancename::graphicname since nov 2012.
- \startuseMPgraphic{graphicname} until nov 2012.
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
- \defineMPinstance
- \setupMPinstance
- \startMPinclusions
- \startMPenvironment — deprecated
- \startMPcode
- \startuseMPgraphic — dynamic graphics that are recompiled at every use
- \useMPgraphic — use a dynamic graphic
- \startuniqueMPgraphic — dynamic graphics that are recompiled when parameters (width, height, depth, background color, line color) change
- \uniqueMPgraphic — use a dynamic graphic
- \startreusableMPgraphic — static graphics that are compiled once
- \reuseMPgraphic — use a static graphic
- \startstaticMPfigure — standalone graphics
- \usestaticMPfigure — use a standalone graphic
- \startMPpage — a page just large enough to fit its MetaPost contents
- MetaFun - MetaPost in ConTeXt
Help from ConTeXt-Mailinglist/Forum
All issues with: