MetaPost

MetaPost
编程范型指令式,排版
設計者John D. Hobby
實作者Taco Hoekwater
型態系統推断类型, 动态类型, 强类型
操作系统跨平台
許可證公有领域
網站Development website
啟發語言
Metafont

MetaPost是一个程序语言和它的编译器的名字,衍生于高德纳的Metafont。MetaPost擅长通过数学描述制作矢量图,生成的图片为PostScript格式。它的语法来自Metafont。

实例

这个文件example.mp通过MetaPost的编译器编译(在Linux系统中使用mpost命令)之后产生了3个EPS文件: example.1, example.2, example.3。这三个文件就是右边的三张图

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 up to 7: dir (135i)-- endfor cycle)
         transformed pagecoords;
 endfig;
 pagecoords:=identity scaled 15mm shifted (100mm,150mm);
 beginfig (3);
     % declare paths to be used
     path p[],p[]t;
     % 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 up to 4: p[i]t=p[i] transformed pagecoords; endfor
     for i=0 up to 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 up to 4:
         drawdot z[i]t withpen pencircle scaled 2;
     endfor
 endfig;
 bye

产生的3个eps文件可以直接用在TeX中(通过LaTeX\includegraphics命令、ConTeXt的\externalfigure命令、Plain TeX的\epsfbox命令,或者Plain pdftex中来自supp-pdf.tex\convertMPtoPDF命令。为了看或者打印这三张图片,这些引用是必须的,因为TeX的字体(Metafont)并不包含在MetaPost产生的eps文件中。

参见

  • 自由软件自由软件主题
  • PGF/TikZ

参考

  • MetaFun (modules for Metapost) by Hans Hagen, [1] (页面存档备份,存于互联网档案馆
  • Donald Knuth: The METAFONTbook, (Computers and Typesetting Volume C) Addison-Wesley 1986. ISBN 0-201-13444-6
  • Comprehensive TEX Archive Network (CTAN): http://www.ctan.org/ Archive.is的存檔,存档日期2012-12-09. Repository of the TEX source and hundreds of add-ons and style files.
  • (La)TeX Navigator provides 305 simple MetaPost examples: https://web.archive.org/web/20130727021112/http://tex.loria.fr/prod-graph/zoonekynd/metapost/metapost.html
  • Taco Hoekwater: MetaPost developments—autumn 2006 (页面存档备份,存于互联网档案馆). TUGboat 27:1 (2006).

外部链接

  • 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 https://web.archive.org/web/20131003040005/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.
矢量图形标记语言以及文件格式
按类型
2D
  • Asymptote
  • CGM
  • DrawingML英语Office Open XML file formats
  • WMF英语WMF
  • Graphics Layout Engine英语Graphics Layout Engine
  • GeoGebra
  • HVIF英语Haiku Vector Icon Format
  • MetaPost
  • PGF/TikZ英语PGF/TikZ
  • PGML英语Precision Graphics Markup Language
  • PSTricks英语PSTricks
  • Remote imaging protocol英语Remote imaging protocol
  • SVG
  • swF
  • 矢量标记语言
  • XAML
  • Xar英语Xar (graphics)
3D
  • .3D
  • 3DF
  • 3DMLW英语3DMLW
  • 3DXML英语3DXML
  • Asymptote
  • COLLADA英语COLLADA
  • DWF英语Design Web Format
  • eDrawings
  • HSF
  • IGES英语IGES
  • IPA
  • JT
  • OpenGEX英语OpenGEX
  • PRC
  • STEP英语ISO 10303
  • STL
  • U3D英语Universal 3D
  • VRML
  • X3D
  • XAML
  • Xgl
  • XVL英语XVL
  • xVRML英语xVRML
另见
软件及库
许可证
操作系统、企业及专业
其他字体
  • Allerta英语Allerta
  • Asana-Math英语Asana-Math
  • Cardo英语Bembo#Digitisations and derivatives
  • Chandas英语Chandas (typeface)
  • Comic Neue英语Comic Neue
  • Cormorant
  • Garamond
  • Gentium
  • Inconsolata英语Inconsolata
  • IM Fell英语History of Western typography#Fell types
  • Jomolhari
  • Junicode
  • Kochi英语Kochi (font)
  • Linux Libertine
  • M+英语M+ FONTS
  • News Cycle英语News Gothic
  • Open Baskerville英语Baskerville
  • OpenDyslexic
  • Railway Sans
  • Squarish Sans CT英语Squarish Sans CT
  • Theano Didot英语Theano Didot
  • XITS英语XITS font project
  • 花園字體
  • 和田研字体
  • 一點明體
工作组和人物
  • 高德纳
  • Font Awesome
  • Greek Font Society英语Greek Font Society
  • Font Library英语Font Library
  • Template:Google字體
  • i/世界少数民族语文研究院
  • 开放源代码Unicode字体英语Open-source Unicode typefaces
  • CJK字体列表
  • 开放源代码字体列表英语:Category:Open-source typefaces
  • 自由Unicode字体列表英语:Category:Free software Unicode typefaces
宏包
  • AMSTeX英语AMSTeX
  • ArabTeX英语ArabTeX
  • CircuiTikZ英语CircuiTikZ
  • ConTeXt英语ConTeXt
  • FarsiTeX英语FarsiTeX
  • Texinfo英语Texinfo
  • LaTeX
  • MusiXTeX英语MusiXTeX
  • Plain TeX
  • PSTricks英语PSTricks
  • TIPA
  • XyMTeX英语XyMTeX
替代TeX引擎
  • eTeX
  • LuaTeX
  • pdfTeX
  • XeTeX
  • New Typesetting System英语New Typesetting System
  • Omega英语Omega (TeX)
发行版
  • TeX Live
  • teTeX
  • fpTeX
  • MiKTeX
  • proTeXt
  • MacTeX英语MacTeX
  • gwTeX
  • OzTeX
  • Latexian
  • AmigaTeX
  • PasTeX
  • TeXPortal
  • W32TeX英语W32TeX
社区
  • CTAN
  • TUGboat英语TUGboat
  • The PracTeX Journal英语The PracTeX Journal
  • Deutschsprachige Anwendervereinigung TeX
相关