Difference between revisions of "MetaFun - MetaPost in ConTeXt"
(Add section about \defineMPinstance and \setupMPinstance) |
m (Adding {{Metapost navbox}}) |
||
(7 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
< [[Graphics]]|[[Metafun]]|[[Metapost]]> | < [[Graphics]]|[[Metafun]]|[[Metapost]]> | ||
− | ConTeXT provides a tight integration of TeX and [[ | + | ConTeXT provides a tight integration of TeX and [[MetaPost]]. MetaPost can used behind the scenes for some graphic trickery. This integration is also helpful for drawing figures in MetaPost and use them in the document. This page is a brief overview of some of the commonly used commands. |
− | == | + | == \defineMPinstance and \setupMPinstance == |
− | + | {{cmd|defineMPinstance}} and {{cmd|setupMPinstance}} can be used to set up MetaPost invocations with particular features. One use case could be to select a sans serif font for all MetaPost | |
− | features. One use case could be to select a sans serif font for all MetaPost | + | labels. |
− | labels. | ||
− | + | === \startMPenvironment === | |
− | \ | ||
− | |||
− | + | {{cmd|startMPenvironment}} is a '''deprecated''' evironment in which one could place settings that one only wanted to apply in the MetaPost environment, but not in the document itself. One should use {{cmd|defineMPinstance}} and {{cmd|setupMPinstance}}, instead. | |
− | |||
− | |||
− | \ | + | == \startMPinclusions == |
− | |||
− | + | Inside {{cmd|startMPinclusions}} one can specify MetaPost files to ''input'', and also define MetaPost functions. | |
− | |||
− | + | == \startuseMPgraphic and \useMPgraphic == | |
− | \ | ||
− | |||
− | |||
− | |||
− | + | {{cmd|startuseMPgraphic}}defines a piece of graphics code that is processed anew every time the graphic is placed with {{cmd|useMPgraphic}}. | |
− | |||
− | |||
− | |||
− | \ | + | == \startreusableMPgraphic and \reuseMPgraphic == |
+ | For graphics that are the same every time, it is better to use {{cmd|startreusableMPgraphic}}: the graphic is compiled only once, and the one resulting picture can be placed at various points with {{cmd|reuseMPgraphic}}. | ||
− | + | == \startMPcode == | |
− | \startMPcode | ||
− | |||
− | |||
− | + | When reusing a graphic is not important, you can simply use {{cmd|startMPcode}}. | |
− | |||
− | |||
− | |||
− | + | == \startMPpage == | |
− | \ | ||
− | |||
− | |||
− | + | {{cmd|startMPpage}} produces a page a containing MetaPost graphic. The page 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. | |
− | |||
+ | == \startstaticMPfigure == | ||
− | + | The {{cmd|startuseMPgraphic}} series of commands were designed for using MetaPost for drawing fancy frames and backgrounds and not for using <i>stand-alone</i> graphics for a document. {{cmd|startstaticMPfigure}} creates a separate pdf file containing the graphic. This pdf can be included in the document using {{cmd|usestaticMPfigure}}. ConTeXt is clever enough to recompile the resulting MetaPost file only if something inside the {{cmd|startstaticMPfigure}} has changed. | |
− | < | ||
− | + | [[Category:Graphics]] | |
− | + | [[Category:Metapost]] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | == See also == | |
− | + | {{MetaPost see also}} | |
+ | * section 3.3 of the [[manual:metafun-s.pdf|MetaFun manual]]. | ||
− | + | {{Metapost navbox}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 18:12, 27 November 2012
ConTeXT provides a tight integration of TeX and MetaPost. MetaPost can used behind the scenes for some graphic trickery. This integration is also helpful for drawing figures in MetaPost and use them in the document. This page is a brief overview of some of the commonly used commands.
Contents
\defineMPinstance and \setupMPinstance
\defineMPinstance and \setupMPinstance can be used to set up MetaPost invocations with particular features. One use case could be to select a sans serif font for all MetaPost labels.
\startMPenvironment
\startMPenvironment is a deprecated evironment in which one could place settings that one only wanted to apply in the MetaPost environment, but not in the document itself. One should use \defineMPinstance and \setupMPinstance, instead.
\startMPinclusions
Inside \startMPinclusions one can specify MetaPost files to input, and also define MetaPost functions.
\startuseMPgraphic and \useMPgraphic
\startuseMPgraphicdefines a piece of graphics code that is processed anew every time the graphic is placed with \useMPgraphic.
\startreusableMPgraphic and \reuseMPgraphic
For graphics that are the same every time, it is better to use \startreusableMPgraphic: the graphic is compiled only once, and the one resulting picture can be placed at various points with \reuseMPgraphic.
\startMPcode
When reusing a graphic is not important, you can simply use \startMPcode.
\startMPpage
\startMPpage produces a page a containing MetaPost graphic. The page 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.
\startstaticMPfigure
The \startuseMPgraphic series of commands were designed for using MetaPost for drawing fancy frames and backgrounds and not for using stand-alone graphics for a document. \startstaticMPfigure creates a separate pdf file containing the graphic. This pdf can be included in the document using \usestaticMPfigure. ConTeXt is clever enough to recompile the resulting MetaPost file only if something inside the \startstaticMPfigure has changed.
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
- section 3.3 of the MetaFun manual.
|