Changes

Jump to navigation Jump to search
Less <cmd>, more {{cmd|...}}
< [[Graphics]]|[[Metafun]]|[[Metapost]]>
ConTeXT provides a tight integration of TeX and [[MetapostMetaPost]]. Metapost MetaPost can used behind the scenes for some graphic trickery. This integration is also helpful for drawing figures in metapost MetaPost and use them in the document. Some of the commonly used commands for this are
==<cmd>\defineMPinstance</cmd> and <cmd>\setupMPinstance</cmd>==
These commands {{cmd|defineMPinstance}} and {{cmd|setupMPinstance}} can be used to set up MetaPost invocations with particularfeatures. One use case could be to select a sans serif font for all MetaPost
labels. Example:
==<cmd>= \startMPenvironment</cmd>==<em>Deprecated,</em> use <cmd>defineMPinstance</cmd> and <cmd>setupMPinstance</cmd> instead.=
This {{cmd|startMPenvironment}} is used a '''deprecated''' evironment in which one could place settings that one only wanted to change apply in the body font for metapost graphics. For exampleMetaPost environment, to get but not in the text in metapost graphics in timesdocument itself. One should use {{cmd|defineMPinstance}} and {{cmd|setupMPinstance}}, useinstead. An example of its usage:
<texcode>
Warning: <b>\sometxt</b> cannot be used in loops. Instead use <b>\textext</b>. [Someone who understands why should expand this statement!]
==<cmd>\startMPinclusions</cmd>==This Inside {{cmd|startMPinclusions}} one can be used for specifying metapost specify MetaPost files to ''input'' , and also to define metapost MetaPost functions.
For example
<texcode>
==<cmd>\startMPpage</cmd>==This {{cmd|startMPpage}} produces a page a containing metapost MetaPost graphic. Thepage is just large enough to contain the graphic. The resulting pdf is self -contained (it has all the fonts embedded) This is useful if you want to send the figure to a coauthor or a journal. For example, one can have
<texcode>
gives a pdf with two pages of graphics.
==<cmd>\startstaticMPfigure</cmd>==<The {{cmd>|startuseMPgraphic</cmd> }} series of commands were designed for using metapost MetaPost for drawing fancy frames and backgrounds and not for using <i>stand-alone</i> graphics for a document. <{{cmd>|startstaticMPfigure</cmd> }} creates a separate pdf file containing the graphic. This pdf can be included in the document using <{{cmd>|usestaticMPfigure</cmd>}}. Context ConTeXt is clever enough to recompile the resulting metapost MetaPost file, only if something inside the start stop staticMPgraphic has changed.
For example,
* '''center''' and '''radius''' above are ''labels'' that are used to access the figure.
* <{{cmd>|usestaticMPfigure</cmd> }} takes the first argument as the ''label'' of the figure to be inserted. The second argument has the same options as the second argument of <{{cmd>|externalfigure</cmd>}}
* To force the figure files to be regenerated, remove all the <code>*.mp.md5</code> files from the current directory.
==Transparent colors in figures==
This all sounds like the 'missing specials' problem that is caused
by conflicting -progname= arguments when using the web2c version
of metapostMetaPost.
Make sure you do not have conflicting memory settings for both

Navigation menu