MetaPost

MetaPostはプログラミング言語、およびそのインタプリタの両方を意味する。ドナルド・クヌースが作ったMETAFONTに由来す…

MetaPost
MetaPost
作者 John D. Hobby
開発元 Taco Hoekwater
最新版
対応OS マルチプラットフォーム
サポート状況 開発中
種別 Typesetting
ライセンス パブリックドメイン
公式サイト tug.org/metapost
テンプレートを表示

MetaPostプログラミング言語、およびそのインタプリタの両方を意味する。ドナルド・クヌースが作ったMETAFONTに由来する。PostScript内における図形の描写に優れる。METAFONTの優れた宣言構文を共有している。

MetaPostインタプリタ (Linux上でmpostコマンドを経由) にて生成された、example.mpという単一のファイルは、3つのepsファイルexample.1, example.2, example.3を生成する。右のそれらが描画されたものである。

これら3つのepsファイルの結果は以下で使うことが出来る。

  • LaTeX経由のTeXにて\includegraphicsコマンド
  • ConTeXtにて\externalfigure
  • plain TeX\epsfboxコマンド
  • supp-pdf.texからの(Plain pdftexにて)\convertMPtoPDFコマンド
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[],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 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

関連項目

脚注・出典

  • 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/. Repository of the TEX source and hundreds of add-ons and style files.
  • (La)TeX Navigator provides 305 simple MetaPost examples: http://tex.loria.fr/prod-graph/zoonekynd/metapost/metapost.html
  • Taco Hoekwater: MetaPost developments—autumn 2006. TUGboat 27:1 (2006).

外部リンク

  • MetaPost TeX Wiki - TeX Wiki内のMetaPostの解説ページ
  • METAPOST - 鈴木秀幸のページ。松山道夫より引き継いで日本語MetaPostのソース管理・配布を行なっている。

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.