MetaPost





















































MetaPost
MPlogo.svg
Paradigm
imperative, typesetting
Designed by John D. Hobby
Developer Taco Hoekwater, Luigi Scarso
First appeared 1994 (1994)
Stable release
1.8
/ 17 June 2013; 5 years ago (2013-06-17)
Preview release
2.0rc2
/ 19 February 2018; 11 months ago (2018-02-19)

Typing discipline
duck, dynamic, strong
OS Cross-platform
License LGPL
Website tug.org/metapost
Influenced by
Metafont

MetaPost refers to both a programming language and the interpreter of the MetaPost programming language. Both are derived from Donald Knuth's Metafont language and interpreter. MetaPost produces vector graphic diagrams from a geometric/algebraic description. The language shares Metafont's declarative syntax for manipulating lines, curves, points and geometric transformations. However,




  • Metafont is set up to produce fonts, in the form of image files (in .gf format) with associated font metric files (in .tfm format), whereas MetaPost produces EPS, SVG, or PNG files

  • The output of Metafont consists of the fonts at a fixed resolution in a raster-based format, whereas MetaPost's output is vector-based graphics (lines, Bézier curves)


  • Metafont output is monochrome, whereas MetaPost uses RGB or CMYK colors.

  • The MetaPost language can include text labels on the diagrams, either strings from a specified font, or anything else that can be typeset with TeX.

  • Starting with version 1.8, Metapost allows floating-point arithmetic with 64 bits (default: 32 bit fixed-point arithmetic)


Many of the limitations of MetaPost derive from features of Metafont. For instance, MetaPost does not support all features of PostScript. Most notably, paths can have only one segment (so that regions are simply connected), and regions can be filled only with uniform colours. PostScript level 1 supports tiled patterns and PostScript 3 supports Gouraud shading.




Contents






  • 1 Availability and usage


  • 2 Examples


  • 3 See also


  • 4 References


  • 5 External links





Availability and usage


MetaPost is distributed with many distributions of the TeX and Metafont framework, for example, it is included in the MiKTeX and the TeX Live distributions.


The encapsulated postscript produced by Metapost can be included in LaTeX, ConTeXt, and TeX documents via standard graphics inclusion commands. The encapsulated postscript output can also be used with the PDFTeX engine, thus directly giving PDF. This ability is implemented in ConTeXt and in the LaTeX graphics package, and can be used from plain TeX via the supp-pdf.tex macro file.


ConTeXt and LuaTeX supports the inclusion of MetaPost code within the input file. Inclusion of MetaPost code in LaTeX is also possible by using LaTeX-packages, for example gmp or mpgraphics.



Examples


This is a single file example.mp which when processed by the MetaPost interpreter (via the command mpost on Linux) produces three eps files example.1, example.2, example.3. These are pictured on the right.




example outputs


transform pagecoords;
pagecoords:=identity scaled 10mm shifted (100mm,150mm);
beginfig (1)
fill ((0,0)--(2,0)--(2,1)--(1,1)--(1,2)--(0,2)--cycle)
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 (2)
draw (for i=0 upto 7: dir (135i)-- endfor cycle)
transformed pagecoords;
endfig;
pagecoords:=identity scaled 15mm shifted (100mm,150mm);
beginfig (3);
% declare paths to be used
path p,pt;
% set up points by defining relationships
z1=(0,0); z2=z1+2up;
z3=z1+whatever*dir (60)=z2+whatever*dir (-50);
z4=z3+(-1.5,-.5);
z5=z1+dir (135);
z0=whatever[z1,z2]=whatever[z3,z4];
% set up paths
p0=fullcircle yscaled .5 rotated 45 shifted z0 ;
p1=z2---z4..z0..z3---z1;
p2=p1 cutbefore p0 cutafter p0;
p3=p0 cutbefore p1 cutafter p1;
p4=p2---p3---cycle;
% define transformed versions of paths and points
for i=0 upto 4: p[i]t=p[i] transformed pagecoords; endfor
for i=0 upto 5: z[i]t=z[i] transformed pagecoords; endfor
% do some drawing
fill p4t withcolor (1,1,0.2);
draw z1t---z2t withcolor .5white;
draw z3t---z4t withcolor .5white;
pickup pencircle;
draw p0t dashed withdots scaled .3;
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=0 upto 4:
drawdot z[i]t withpen pencircle scaled 2;
endfor
endfig;
bye

The resulting three eps files can be used in TeX via LaTeX's includegraphics command, ConTeXt's externalfigure, Plain TeX's epsfbox command, or (in Plain pdftex) the convertMPtoPDF command from supp-pdf.tex. To view or print the third diagram, this inclusion is necessary, as the TeX fonts (Computer Modern) are not included in the eps files produced by MetaPost by default.



See also




  • PSTricks

  • PGF/TikZ

  • Metafont

  • METATYPE1

  • Asymptote



References


.mw-parser-output .refbegin{font-size:90%;margin-bottom:0.5em}.mw-parser-output .refbegin-hanging-indents>ul{list-style-type:none;margin-left:0}.mw-parser-output .refbegin-hanging-indents>ul>li,.mw-parser-output .refbegin-hanging-indents>dl>dd{margin-left:0;padding-left:3.2em;text-indent:-3.2em;list-style:none}.mw-parser-output .refbegin-100{font-size:100%}



  • Hagen, Hans. "MetaFun" (modules for Metapost)..mw-parser-output cite.citation{font-style:inherit}.mw-parser-output .citation q{quotes:"""""""'""'"}.mw-parser-output .citation .cs1-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/6/65/Lock-green.svg/9px-Lock-green.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output .citation .cs1-lock-limited a,.mw-parser-output .citation .cs1-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/d/d6/Lock-gray-alt-2.svg/9px-Lock-gray-alt-2.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output .citation .cs1-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Lock-red-alt-2.svg/9px-Lock-red-alt-2.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output .cs1-subscription,.mw-parser-output .cs1-registration{color:#555}.mw-parser-output .cs1-subscription span,.mw-parser-output .cs1-registration span{border-bottom:1px dotted;cursor:help}.mw-parser-output .cs1-ws-icon a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/4/4c/Wikisource-logo.svg/12px-Wikisource-logo.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output code.cs1-code{color:inherit;background:inherit;border:inherit;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;font-size:100%}.mw-parser-output .cs1-visible-error{font-size:100%}.mw-parser-output .cs1-maint{display:none;color:#33aa33;margin-left:0.3em}.mw-parser-output .cs1-subscription,.mw-parser-output .cs1-registration,.mw-parser-output .cs1-format{font-size:95%}.mw-parser-output .cs1-kern-left,.mw-parser-output .cs1-kern-wl-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right,.mw-parser-output .cs1-kern-wl-right{padding-right:0.2em}


  • Knuth, Donald (1986). The METAFONTbook. Computers and Typesetting. C. Addison-Wesley. ISBN 0-201-13444-6.


  • "Comprehensive TEX Archive Network" (CTAN). Repository of the TEX source and hundreds of add-ons and style files.


  • "(La)TeX Navigator provides 305 simple MetaPost examples".


  • Hoekwater, Taco (2006). "MetaPost developments—autumn 2006" (PDF). TUGboat. 27 (1).




External links



  • The TeX users group (TUG) http://www.tug.org/ has a page devoted to MetaPost: http://www.tug.org/metapost.html

  • Active development of MetaPost continues at https://web.archive.org/web/20070929092912/http://foundry.supelec.fr/projects/metapost/


  • Functional MetaPost allows MetaPost to be used from the functional programming language Haskell

  • John D. Hobby has a homepage at http://ect.bell-labs.com/who/hobby/index.shtml and some other pages and publications devoted to MetaPost, though these are now a little dated

    • Historic MetaPost homepage: https://web.archive.org/web/20081212090123/http://ect.bell-labs.com/who/hobby/MetaPost.shtml


    • A User's Manual for MetaPost John D. Hobby. Available as a file mpman.ps distributed with MetaPost, or from the Bell Labs web site. Also available in PDF format from CTAN.



  • Troy Henderson's Online MetaPost Previewer










Popular posts from this blog

鏡平學校

ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

Why https connections are so slow when debugging (stepping over) in Java?