Changes

Jump to navigation Jump to search
66 bytes removed ,  21:19, 6 June 2020
m
minor adjustments, nothing new
< [[Math]], [[MetaFun]], [[Graphics]]
 
MetaPost is a graphical programming language, based on Donald Knuth's MetaFont. Normally MP graphics are converted to PostScript and used with dvips, but ConTeXt can use it directly with PDF (see the
[http://www.pragma-ade.com/general/sources/mptopdf.pdf MP to PDF] manual).
MetaPost is ConTeXt's native graphics language. [[MetaFun]] is a MetaPost module by Hans Hagen that adds a lot of extra features; it is enabled by default, so one could say that MetaFun is ConTeXt's default dialect of MetaPost.
== Documentation & Tutorials ==
* [http://www.tug.org/docs/metapost/mpman.pdf A User's Manual for MetaPost] <!-- http://cm.bell-labs.com/who/hobby/cstr_162.pdf has its pages reversed -->
* [http://remote.science.uva.nl/~heck/Courses/mptut.pdf Learning METAPOST by doing] ([http://maps.aanhet.net/maps/pdf/32_14.pdf this] and [http://maps.aanhet.net/maps/pdf/32_15.pdf this link] are not working)
* [http://wiki.contextgarden.net/MetaPost_in_ConTeXt MetaPost in ConTeXt]
== Using MetaPost in ConTeXt ==
With {{cmd|startuseMPgraphic}}, you define a piece of graphics code that is processed anew every time the graphic is placed with {{cmd|useMPgraphic}}. Further commands are described at [[MetaPost in ConTeXt]].
</context>
== Different Packages, Extensions & Applications of Metapost ==
* [http://www.ctan.org/tex-archive/graphics/metaplot/ MetaPlot] - graph drawing
* [http://www.ctan.org/tex-archive/graphics/metapost/contrib/macros/metaobj/ MetaObj] - object-oriented drawing, see also the page about [[MetaObj and Labels]]
* [http://vigna.dsi.unimi.it/metagraph/ METAGRAPH] - drawing (un)directed graphs
=== 3D support ===
* [http://matagalatlante.org/nobre/featpost/doc/featexamples.html FeatPost]
* [http://www.gnu.org/software/3dldf/LDF.html 3DLDF]
{{todo|needs major review}}
== MetaPost relatives ===== Font Creation ===
* [[MetaType1]], see [http://www.ctan.org/tex-archive/fonts/utilities/metatype1/ CTAN]
=== 3D drawing ===
* [http://asymptote.sourceforge.net/ Asymptote] - inspired by MetaPost & fully generalizes MetaPost path construction algorithms to three-dimensions
== Testing plain MetaPost ==
To test whether MetaPost is installed on your system, create a file called {{code|test.mp}}:
* open test.1 with a postscript viewer like Ghostview, Okular, … You should see a circle.
== Testing MetaPost embedded in ConTeXt ==
If MetaPost is installed on your system and working correctly, you can
* open test.pdf with a pdf viewer like Adobe Acrobat, Okular... You should see a circle.
== Text in MetaPost ==
Text that is typeset using `textext` or `btex … etex` adapts to the body font. However, when `label("Foo", pair)` or `"Foo" infont defaultfont` is used, which is not the recommended way, the text is typeset using the font `MetafunDefault`, which can be changed if desired. Example:
The recommended way to typeset text is to use the `textext` macro and change the font using {{cmd |setupMPinstance}}.
== Repetition of a Text Element to Fill a Bar Using textext ==
Imagine you want to create a frame which consists out of one glyph or a combination of different glyphs in order to make a decorative border. For this purpose a series of such elements should be placed on the bar as pictures, evenly spaced. Probably you want to have at the end of the bar a different glyph inserted as a picture too.
Now you get 14 "?" and the "*".
=== A Full Example ===
<context mode="mkiv" source="yes" text="Gives:">
There is one important remark: The MPcalculation and the drawing itself must be inside \starttext ... \stoptext.
== Other Links ==
* Metapost home page: http://tug.org/metapost

Navigation menu