Difference between revisions of "MetaFun - MetaPost in ConTeXt"
Ramkumarkb (talk | contribs) |
m (fix pragma links & typos) |
||
(4 intermediate revisions by one other user not shown) | |||
Line 2: | Line 2: | ||
− | MetaFun is | + | MetaFun is 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 a document. |
− | ''' | + | '''The [[manual:metafun-p.pdf|MetaFun manual]]''', also available in a [[manual:metafun-s.pdf|screen version]]. |
− | + | Don’t miss the illustrations at 100% MetaFun page [https://art-aleatoire.com art-aleatoire]. | |
This page is a brief overview of some of the commonly used commands. | This page is a brief overview of some of the commonly used commands. | ||
− | = System Overview = | + | = ConTeXt System Overview = |
− | + | [[File:ConTeXt-System.png|700px]] | |
− | [[File:ConTeXt-System.png| | ||
= Commonly used commands = | = Commonly used commands = | ||
Line 38: | Line 37: | ||
* [[manual:mmakempy.pdf|MakeMPY]]: create MetaPost outlines (by Pragma) | * [[manual:mmakempy.pdf|MakeMPY]]: create MetaPost outlines (by Pragma) | ||
* [[Flow Charts|FlowCharts]]: encapsulated application, demonstration of MetaPost/MetaFun | * [[Flow Charts|FlowCharts]]: encapsulated application, demonstration of MetaPost/MetaFun | ||
− | * [http://www.pragma-ade. | + | * [http://www.pragma-ade.nl/general/sources/mptopdf.pdf MPtoPDF]: create PDF from MetaPost (by Pragma) |
− | * [http://www.pragma-ade. | + | * [http://www.pragma-ade.nl/show-gra.pdf a few examples of MetaPost graphics] |
− | * [http://www.pragma-ade. | + | * [http://www.pragma-ade.nl/articles/art-puzz.pdf Puzzling graphics in MetaPost] (article) |
* [http://www.ntg.nl/maps/25/15.pdf metapost metafun. Hans Hagen at MAPS] | * [http://www.ntg.nl/maps/25/15.pdf metapost metafun. Hans Hagen at MAPS] | ||
* [[Fill Patterns|FillPatterns]]: Fill pattern examples using MetaPost/MetaFun | * [[Fill Patterns|FillPatterns]]: Fill pattern examples using MetaPost/MetaFun |
Latest revision as of 08:16, 1 July 2022
MetaFun is 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 a document.
The MetaFun manual, also available in a screen version.
Don’t miss the illustrations at 100% MetaFun page art-aleatoire.
This page is a brief overview of some of the commonly used commands.
ConTeXt System Overview
Commonly used commands
- \defineMPinstance, \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.
- \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 \defineMPinstance and \setupMPinstance, instead.
- \startMPinclusions
- Inside, one can specify MetaPost files to input, and also define MetaPost functions.
- \startuseMPgraphic, \useMPgraphic
- defines a piece of graphics code that is processed anew every time the graphic is placed with \useMPgraphic.
- \startreusableMPgraphic, \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
- 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, \usestaticMPfigure
- 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.
Documentation and links
- MakeMPY: create MetaPost outlines (by Pragma)
- FlowCharts: encapsulated application, demonstration of MetaPost/MetaFun
- MPtoPDF: create PDF from MetaPost (by Pragma)
- a few examples of MetaPost graphics
- Puzzling graphics in MetaPost (article)
- metapost metafun. Hans Hagen at MAPS
- FillPatterns: Fill pattern examples using MetaPost/MetaFun
- \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