Changes

Jump to navigation Jump to search
m
fix pragma links & typos
MetaFun is ConTeXt ConTeXt’s extension of the [[MetaPost]] language. It provides a tight integration of both 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 a document. This page is a brief overview of some of the commonly used commands.
= Commonly used commands ='''The [[manual:metafun-p.pdf|MetaFun manual]]''', also available in a [[manual:metafun-s.pdf|screen version]].
== \defineMPinstance and \setupMPinstance ==
{{cmd|defineMPinstance}} and {{cmd|setupMPinstance}} can be used to set up MetaPost invocations with particular featuresDon’t miss the illustrations at 100% MetaFun page [https://art-aleatoire. One use case could be to select a sans serif font for all MetaPostlabelscom art-aleatoire].
'''{{cmd|startMPenvironment}} is a DEPRECATED''' environment 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 ==This page is a brief overview of some of the commonly used commands.
Inside {{cmd|startMPinclusions}} one can specify MetaPost files to ''input'', and also define MetaPost functions.= ConTeXt System Overview =
== \startuseMPgraphic and \useMPgraphic ==[[File:ConTeXt-System.png|700px]]
{{cmd|startuseMPgraphic}} defines a piece of graphics code that is processed anew every time the graphic is placed with {{cmd|useMPgraphic}}. =Commonly used commands = \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 ==; {{cmd|defineMPinstance}}, {{cmd|setupMPinstance}}: used to set up MetaPost invocations with particular features. One use case could be to select a sans serif font for all MetaPost labels. : {{cmd|startMPenvironment}} '''is DEPRECATED''' 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.
When reusing a graphic is not important, you can simply use ; {{cmd|startMPcodestartMPinclusions}}: Inside, one can specify MetaPost files to ''input'', and also define MetaPost functions.
== \startMPpage ==; {{cmd|startuseMPgraphic}}, {{cmd|useMPgraphic}}: defines a piece of graphics code that is processed anew every time the graphic is placed with {{cmd|useMPgraphic}}.
; {{cmd|startMPpagestartreusableMPgraphic}} produces a page a containing MetaPost graphic. The page , {{cmd|reuseMPgraphic}}: For graphics that are the same every time, it is just large enough better to contain use {{cmd|startreusableMPgraphic}}: the graphic. The resulting pdf is self-contained (it has all compiled only once, and the fonts embedded) This is useful if you want to send the figure to a coauthor or a journalone resulting picture can be placed at various points with {{cmd|reuseMPgraphic}}.
== \startstaticMPfigure ==; {{cmd|startMPcode}}: When reusing a graphic is not important, you can simply use {{cmd|startMPcode}}.
The ; {{cmd|startuseMPgraphicstartMPpage}} series of commands were designed for using MetaPost for drawing fancy frames and backgrounds and not for using <i>stand-alone</i> graphics for : produces a document. {{cmd|startstaticMPfigure}} creates page a separate pdf file containing MetaPost graphic. The page is just large enough to contain the graphic. This The resulting pdf can be included in is self-contained (it has all the document using {{cmd|usestaticMPfigure}}fonts embedded). ConTeXt This is clever enough useful if you want to recompile send the resulting MetaPost file only if something inside the {{cmd|startstaticMPfigure}} has changedfigure to a coauthor or a journal.
[[Category; {{cmd|startstaticMPfigure}}, {{cmd|usestaticMPfigure}}:Graphics]][[Category:Metapost]]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.
= See also Documentation and links =
* [[manual:metafun-p.pdf|MetaFun manual]] ([[manual:metafun-s.pdf|screen]]) by Pragma
* [[manual:mmakempy.pdf|MakeMPY]]: create MetaPost outlines (by Pragma)
* [[Flow Charts|FlowCharts]]: encapsulated application, demonstration of MetaPost/MetaFun
* [http://www.pragma-ade.comnl/general/sources/mptopdf.pdf MPtoPDF]: create PDF from MetaPost (by Pragma)* [http://www.pragma-ade.comnl/show-gra.pdf a few examples of MetaPost graphics]* [http://www.pragma-ade.comnl/articles/art-puzz.pdf Puzzling graphics in MetaPost] (article)
* [http://www.ntg.nl/maps/25/15.pdf metapost metafun. Hans Hagen at MAPS]
* [[Fill Patterns|FillPatterns]]: Fill pattern examples using MetaPost/MetaFun
----
[[Category:Graphics]]
[[Category:Metapost]]

Navigation menu