|
MetaPost is two the programming language and the lone known interpreter of the MetaPost programming language. Each come from either Donald Knuth's Metafont language and interpreter. MetaPost shine at producing diagrams in the PostScript programming language from a geometric/algebraic description. A language shares Metafont's elegant declarative syntax for manipulating lines, curves, points and geometrical transformations. Notwithstanding,
Metafont is set up to create fonts, inside the form of image files (in .gf format) using associated font metrical files (inside .tfm format), whereas MetaPost green groceries encapsulated PostScript files
A output of Metafont consists of the fonts at the fixed guide inside a raster-depending format, whereas MetaPost's output is vector-depending postscript graphics (lines, Bézier curves)
Metafont output is monochrome, whereas MetaPost uses the elementary RGB colour specification.
the MetaPost language might include text labels on the diagrams, either strings from either a specified font, or even jolly great deal anything that may be typeset using TeX
A Metafont interpreter was written by Donald Knuth under an open source license, allowing John D. Hobby (& late Ulrik Vieth) to adapt a interpreter to their have finishes, rendering america MetaPost.
MetaPost doesn't stand a fancy logotype, & possibly in case it did, it would probably have to rely in TeX to render it.
Availability, usage
MetaPost is distributed by owning numbers of todays distributions of the TeX and Metafont framework. Particularly, these are involved around teTeX distributiin, park on Linux and Unix (including Mac OS X) platforms.
A encapsulated postscript by Metapost is easy involved around TeX, ConTeXt, and LaTeX documents via standard eps-inclusion commands. Particularly utile is the ability to include this output in the PDFTeX dialect of TeX, thus rendering Portable Document Format output from TeX in a single step. This ability is implemented within ConTeXt & in a LaTeX graphics package, and may be utilized from either evidently TeX via the supp-pdf.tex macro file. ConTeXt possibly supports a creation of MetaPost files from either inside a TeX file.
Examples
This occurs as individual file case.mp which after filtered per MetaPost interpreter (via a command mpost in Linux) produces three eps files lesson.Ace, case.Two, lesson.Ternion. Which are actually pictured on the perfect.
transform pagecoords;
pagecoords:=identity scaled 10mm shifted (100mm,150mm);
beginfig(Unity)
fill ((0,0)--(2,0)--(2,1)--(1,1)--(1,2)--(0,2)--period)
transformed pagecoords withcolor green;
draw ((2,0)..(2,1)..(1,1)..(1,2)..(0,2))
transformed pagecoords;
drawarrow ((0,0)--(2,2)) transformed pagecoords;
endfig;
beginfig(Deuce)
draw (for i personally=Cipher upto Septet: dir(135i)-- endfor period)
transformed pagecoords;
endfig;
pagecoords:=identity scaled 15mm shifted (100mm,150mm);
beginfig(Trinity);
% declare paths to exist as used
path p[],p[]t;
% install points by defining relationships
z1=(0,0); z2=z1+2up;
z3=z1+whatever*dir(Sixty)=z2+whatever*dir(-Fifty);
z4=z3+(-I.Quintet,-.Little phoebe);
z5=z1+dir(135);
z0=whatever[z1,z2]=whatever[z3,z4];
% install paths
p0=fullcircle yscaled .Cinque revolved 45 shifted z0 ;
p1=z2--z4..z0..z3---z1;
p2=p1 cutbefore p0 cutafter p0;
p3=p0 cutbefore p1 cutafter p1;
p4=p2--p3--period;
% define transformed versions of paths & points
for i personally=Cypher upto Tetrad: p[i]t=p[i] transformed pagecoords; endfor
for we=Zero upto Pentad: z[i]t=z[i] transformed pagecoords; endfor
% run occasionally drawing
fill p4t withcolor (1,1,0.Two);
draw z1t--z2t withcolor .5white;
draw z3t--z4t withcolor .5white;
pickup pencircle;
draw p0t dashed withdots scaled .Ternion;
draw p1t dashed evenly;
draw p2t withcolor blue;
draw p3t withcolor red;
label.lrt(btex $z_0$ etex, z0t);
label.llft(btex $z_1$ etex, z1t);
label.top(btex $z_2$ etex, z2t);
label.rt(btex $z_3$ etex, z3t);
label.llft(btex $z_4$ etex, z4t);
for i personally=Zero upto Quaternity:
drawdot z[i]t withpen pencircle scaled Deuce;
endfor
endfig;
bye
A ensuant trio eps files may be utilized within TeX via LaTeX's \includegraphics command, ConTeXt's \externalfigure, Plain TeX's \epsfbox command, or (within Plainly pdftex) a \convertMPtoPDF command from either supp-pdf.tex. To review or even print a third diagram, this inclusion is necessary, when a TeX fonts are not involved in the eps files by MetaPost.
|