From bab36d6f2c37fccd253fe8141b59c0032fd627dc Mon Sep 17 00:00:00 2001 From: Taco Hoekwater Date: Thu, 1 Apr 2010 09:49:45 +0000 Subject: the manuals for metapost 1.211 git-svn-id: svn://tug.org/texlive/trunk@17650 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/metapost/base/mpboxes.pdf | Bin 365222 -> 371620 bytes Master/texmf-dist/doc/metapost/base/mpgraph.pdf | Bin 460975 -> 467533 bytes Master/texmf-dist/doc/metapost/base/mpintro.pdf | Bin 230080 -> 234860 bytes Master/texmf-dist/doc/metapost/base/mpman.pdf | Bin 844769 -> 858284 bytes .../doc/metapost/base/source-manual/examples.mp | 251 ------ .../doc/metapost/base/source-manual/manfig.mp | 825 -------------------- .../doc/metapost/base/source-manual/mpintro.bib | 50 -- .../doc/metapost/base/source-manual/mpintro.tex | 859 --------------------- .../base/source-manual/mpman-app-refman.tex | 6 +- .../metapost/base/source-manual/mpman-optab.tex | 147 ---- .../doc/metapost/base/source-manual/mpman.tex | 6 +- .../doc/metapost/base/source-tutorial/mpintro.ltx | 1 + 12 files changed, 7 insertions(+), 2138 deletions(-) delete mode 100644 Master/texmf-dist/doc/metapost/base/source-manual/examples.mp delete mode 100644 Master/texmf-dist/doc/metapost/base/source-manual/manfig.mp delete mode 100644 Master/texmf-dist/doc/metapost/base/source-manual/mpintro.bib delete mode 100644 Master/texmf-dist/doc/metapost/base/source-manual/mpintro.tex delete mode 100644 Master/texmf-dist/doc/metapost/base/source-manual/mpman-optab.tex (limited to 'Master/texmf-dist/doc/metapost/base') diff --git a/Master/texmf-dist/doc/metapost/base/mpboxes.pdf b/Master/texmf-dist/doc/metapost/base/mpboxes.pdf index cf523b3996e..3a0182c4e20 100644 Binary files a/Master/texmf-dist/doc/metapost/base/mpboxes.pdf and b/Master/texmf-dist/doc/metapost/base/mpboxes.pdf differ diff --git a/Master/texmf-dist/doc/metapost/base/mpgraph.pdf b/Master/texmf-dist/doc/metapost/base/mpgraph.pdf index 406c2925a21..d49c39a1dcd 100644 Binary files a/Master/texmf-dist/doc/metapost/base/mpgraph.pdf and b/Master/texmf-dist/doc/metapost/base/mpgraph.pdf differ diff --git a/Master/texmf-dist/doc/metapost/base/mpintro.pdf b/Master/texmf-dist/doc/metapost/base/mpintro.pdf index b1d8ae3cd4f..e845c115287 100644 Binary files a/Master/texmf-dist/doc/metapost/base/mpintro.pdf and b/Master/texmf-dist/doc/metapost/base/mpintro.pdf differ diff --git a/Master/texmf-dist/doc/metapost/base/mpman.pdf b/Master/texmf-dist/doc/metapost/base/mpman.pdf index 899055a7170..1e2e4bef1e6 100644 Binary files a/Master/texmf-dist/doc/metapost/base/mpman.pdf and b/Master/texmf-dist/doc/metapost/base/mpman.pdf differ diff --git a/Master/texmf-dist/doc/metapost/base/source-manual/examples.mp b/Master/texmf-dist/doc/metapost/base/source-manual/examples.mp deleted file mode 100644 index 2f58ad0f9c4..00000000000 --- a/Master/texmf-dist/doc/metapost/base/source-manual/examples.mp +++ /dev/null @@ -1,251 +0,0 @@ -% Examples for MetaPost doc, by John Hobby. Public domain. - -filenametemplate "%j-%c.mps"; - -beginfig(1); -a=.7in; b=0.5in; -z0=(0,0); z1=(a,0); z2=(0,b); -z0=.5[z1,z3]=.5[z2,z4]; -draw z1..z2..z3..z4..cycle; -drawarrow z0..z1; -drawarrow z0..z2; -label.top(btex $a$ etex, .5[z0,z1]); -label.lft(btex $b$ etex, .5[z0,z2]); -endfig; - - - - -beginfig(2); - -h=2in; w=2.7in; -path p[], q[], pp; -for i=1.5,2,4: - ii := i**2; - p[i] = (w/ii,h){1/ii,-1}...(w/i,h/i)...(w,h/ii){1,-1/ii}; -endfor -for i=.5,1.5: - q[i] = origin..(w,i*h) cutafter p1.5; -endfor - -pp = buildcycle(q0.5, p2, q1.5, p4); - -fill pp withcolor .8white; -z0=center pp; -picture lab; lab=thelabel(btex $f>0$ etex, z0); -unfill bbox lab; draw lab; -draw q0.5; draw p2; draw q1.5; draw p4; -makelabel.top(btex $P$ etex, p2 intersectionpoint q0.5); -makelabel.rt(btex $Q$ etex, p2 intersectionpoint q1.5); -endfig; - - - - -beginfig(3); - -3.2scf = 2.4in; -path fun; -# = .1; % Keep the function single-valued -fun = ((0,-1#)..(1,.5#){right}..(1.9,.2#){right}..{curl .1}(3.2,2#)) - scaled scf yscaled(1/#); - -vardef vertline primary x = (x,-infinity)..(x,infinity) enddef; -primarydef f atx x = (f intersectionpoint vertline x) enddef; -primarydef f whenx x = xpart(f intersectiontimes vertline x) enddef; - -z1a = (2.5scf,0); -z1 = fun atx x1a; -y2a=0; z1-z2a=whatever*direction fun whenx x1 of fun; -z2 = fun atx x2a; -y3a=0; z2-z3a=whatever*direction fun whenx x2 of fun; - -draw fun withpen pencircle scaled 1pt; -drawarrow (0,0)..(3.2scf,0); - -label.bot(btex $x_1$ etex, z1a); -draw z1a..z1 dashed evenly; -makelabel(nullpicture, z1); -draw z1..z2a withpen pencircle scaled .3; -label.bot(btex $x_2$ etex, z2a); -draw z2a..z2 dashed evenly; -makelabel(nullpicture, z2); -draw z2..z3a withpen pencircle scaled .3; -label.bot(btex $x_3$ etex, z3a); -endfig; - - - -beginfig(4); -for i=0 upto 2: - z[i]=(0,40i); z[i+3]-z[i]=(100,30); -endfor -pickup pencircle scaled 18; -def gray = withcolor .8white enddef; -draw z0..z3 gray; -linecap:=butt; draw z1..z4 gray; -linecap:=squared; draw z2..z5 gray; -dotlabels.top(0,1,2,3,4,5); -endfig; linecap:=rounded; - - - -beginfig(5); -for i=0 upto 2: - z[i]=(0,50i); z[i+3]-z[i]=(60,40); - z[i+6]-z[i]=(120,0); -endfor -pickup pencircle scaled 24; -def gray = withcolor .8white enddef; -draw z0--z3--z6 gray; -linejoin:=mitered; draw z1..z4--z7 gray; -linejoin:=beveled; draw z2..z5--z8 gray; -dotlabels.bot(0,1,2,3,4,5,6,7,8); -endfig; linejoin:=rounded; - - - -input boxes - - -\beginfig(6); -fill unitsquare xscaled 1.1in yscaled .7in withcolor .9white; -boxit(currentpicture); -dx = dy = .25in; -clearit; drawboxed(); -forsuffixes $=n,c: makelabel.top(str $, $); endfor -makelabel.bot("s",s); -forsuffixes $=ne,e,se: makelabel.rt(str $, $); endfor -forsuffixes $=nw,w,sw: makelabel.lft(str $, $); endfor -pickup pencircle scaled .3bp; -vardef larrow@#(expr a, da, s) = - drawdblarrow a..a+da; label@#(s,a+.5da); enddef; -larrow.rt(n, (0,-dy), "dy"); -larrow.rt(s, (0,dy), "dy"); -larrow.top(e, (-dx,0), "dx"); -larrow.top(w, (dx,0), "dx"); -endfig; - - - -beginfig(7); -boxjoin(a.se=b.sw; a.ne=b.nw ); -boxit.a(btex $\cdots$ etex); -boxit.ni(btex $n_i$ etex); -boxit.di(btex $d_i$ etex); -boxit.nii(btex $n_{i+1}$ etex); -boxit.dii(btex $d_{i+1}$ etex); -boxit.aa(pic_.a); -boxit.nk(btex $n_k$ etex); -boxit.dk(btex $d_k$ etex); - -di.dy = 2; -drawboxed(a,ni,di,nii,dii,aa,nk,dk); -label.lft("ndtable:", a.w); - -boxjoin(a.sw=b.nw; a.se=b.ne); -interim defaultdy:=7; -boxit.ba(); -boxit.bb(); -boxit.bc(); -boxit.bd(btex $\vdots$ etex); -boxit.be(); -boxit.bf(); -bd.dx = 8; -ba.ne = a.sw - (15,10); - -drawboxed(ba,bb,bc,bd,be,bf); -label.lft("hashtab:", ba.w); - -def ndblock suffix $ = - boxjoin(a.sw=b.nw; a.se=b.ne); - forsuffixes $$=$a,$b,$c: - boxit$$(); ($$dx,$$dy)=(5.5,4); - endfor; -enddef; - -ndblock nda; -ndblock ndb; -ndblock ndc; -nda.a.c - bb.c = ndb.a.c - nda.c.c = (whatever,0); -xpart ndb.c.se = xpart ndc.a.ne = xpart di.c; -ndc.a.c - be.c = (whatever,0); - -drawboxes(nda.a,nda.b,nda.c, ndb.a,ndb.b,ndb.c, ndc.a,ndc.b,ndc.c); - -drawarrow bb.c .. nda.a.w; -drawarrow be.c .. ndc.a.w; -drawarrow nda.c.c .. ndb.a.w; -drawarrow nda.a.c{right}..{curl0}ni.c cutafter bpath ni; -drawarrow nda.b.c{right}..{curl0}di.c cutafter bpath di; -drawarrow ndc.a.c{right}..{curl0}nii.c cutafter bpath nii; -drawarrow ndc.b.c{right}..{curl0}dii.c cutafter bpath dii; -drawarrow ndb.a.c{right}..nk.c cutafter bpath nk; -drawarrow ndb.b.c{right}..dk.c cutafter bpath dk; - -x.ptr = xpart aa.c; -y.ptr = ypart ndc.a.ne; -drawarrow subpath (0,.7) of (z.ptr..{left}ndc.c.c) dashed evenly; -label.rt(btex ndblock etex, z.ptr); -endfig; - - - - -beginfig(8) -interim circmargin := .07in; -fill unitsquare xscaled 1.1in yscaled .7in withcolor .9white; -circleit(currentpicture); -dx = dy; -clearit; drawboxed(); -forsuffixes $=n,c: makelabel.top(str $, $); endfor -makelabel.bot("s",s); -makelabel.rt("e", e); -makelabel.lft("w", w); -pickup pencircle scaled .3bp; -vardef larrow@#(expr a, da, s) = - drawdblarrow a..a+da; label@#(s,a+.5da); enddef; -larrow.rt(n, (0,-dy), "dy"); -larrow.rt(s, (0,dy), "dy"); -larrow.top(e, (-dx,0), "dx"); -larrow.top(w, (dx,0), "dx"); -endfig; - - - - -beginfig(9); -vardef cuta(suffix a,b) expr p = - drawarrow p cutbefore bpath.a cutafter bpath.b; - point .5*length p of p -enddef; - -vardef self@# expr p = - cuta(@#,@#) @#.c{curl0}..@#.c+p..{curl0}@#.c enddef; - -verbatimtex \def\stk#1#2{$\displaystyle{\matrix{#1\cr#2\cr}}$} etex -circleit.aa("Start"); aa.dx=aa.dy; -circleit.bb(btex \stk B{(a|b)^*a} etex); -circleit.cc(btex \stk C{b^*} etex); -circleit.dd(btex \stk D{(a|b)^*ab} etex); -circleit.ee("Stop"); ee.dx=ee.dy; - -numeric hsep; -bb.c-aa.c = dd.c-bb.c = ee.c-dd.c = (hsep,0); -cc.c-bb.c = (0,.8hsep); -xpart(ee.e - aa.w) = 3.8in; -drawboxed(aa,bb,cc,dd,ee); - -label.ulft(btex$b$etex, cuta(aa,cc) aa.c{dir50}..cc.c); -label.top(btex$b$etex, self.cc(0,30pt)); -label.rt(btex$a$etex, cuta(cc,bb) cc.c..bb.c); -label.top(btex$a$etex, cuta(aa,bb) aa.c..bb.c); -label.llft(btex$a$etex, self.bb(-20pt,-35pt)); -label.top(btex$b$etex, cuta(bb,dd) bb.c..dd.c); -label.top(btex$b$etex, cuta(dd,ee) dd.c..ee.c); -label.lrt(btex$a$etex, cuta(dd,bb) dd.c..{dir140}bb.c); -label.bot(btex$a$etex, cuta(ee,bb) ee.c..tension1.3 ..{dir115}bb.c); -label.urt(btex$b$etex, cuta(ee,cc) ee.c{(cc.c-ee.c)rotated-15}..cc.c); -endfig; - -end diff --git a/Master/texmf-dist/doc/metapost/base/source-manual/manfig.mp b/Master/texmf-dist/doc/metapost/base/source-manual/manfig.mp deleted file mode 100644 index f9665370b0d..00000000000 --- a/Master/texmf-dist/doc/metapost/base/source-manual/manfig.mp +++ /dev/null @@ -1,825 +0,0 @@ -% Figures for MetaPost manual, by John Hobby. Public domain. - -filenametemplate "%j-%c.mps"; - -%%% This redefinition of dotlabel draws dots as a closed path -%%% which are rendered more smoothly in Adobe Reader. -vardef dotlabel@#(expr s,z) text t_ = - label@#(s,z) t_; - addto currentpicture - contour (makepath pencircle scaled dotlabeldiam) shifted z t_; -enddef; - - -%%% TeX macro \place is only used in figure 0. -verbatimtex -\input texnames.sty -\def\place#1{\vphantom{FiMP}\smash{#1}} -etex - -%%% The boxes package is only used in figure 0. -input boxes - -beginfig(0); -ba.dy = bb.dy = d.dy = 12bp; -d.dx = 100bp; -boxit.aa(btex \place{Figures in MetaPost} etex); -boxit.ab(btex \place{\TeX\ Document} etex); -boxit.ba(btex \hbox to 75bp {\hfil\place{MetaPost}\hfil} etex); -boxit.bb.(btex \hbox to 75bp {\hfil\place{\TeX\ or \LaTeX}\hfil} etex); -boxit.ca(btex \place{Figures in PostScript} etex); -boxit.cb(btex \place{{\tt dvi} file} etex); -boxit.d(btex \place{\tt dvips} etex); -boxit.e(btex PostScript etex); -boxit.f(btex \vbox{ - \hbox to 50bp {\hfil\hbox{bounding}\hfil} - \hbox to 50bp {\hfil\hbox{box}\hfil} - } etex scaled .8); -ba.n - aa.s = ca.n - ba.s -= bb.n - ab.s = cb.n - bb.s -= e.n - d.s = down * 25bp; -ypart cb.s - ypart d.n = 25bp; -e.s = origin; -ypart ca.s = ypart cb.s; -xpart aa.n = xpart 0.1[d.nw,d.ne]; -xpart ab.n = xpart 0.9[d.nw,d.ne]; -drawunboxed(aa,ab,ca,cb,e); -drawboxed(ba,bb,d); -drawarrow aa.s -- top ba.n; drawarrow ab.s -- top bb.n; -drawarrow ba.s -- top ca.n; drawarrow bb.s -- top cb.n; -drawarrow ca.s -- top 0.1[d.nw,d.ne]; -drawarrow cb.s -- top 0.9[d.nw,d.ne]; -drawarrow d.s -- top e.n; -path p; -p = ca.e{right} .. {right}bb.w; -f.c = point .5 of p; -drawunboxed(f); -draw p cutafter bpath f dashed evenly; -drawarrow p cutbefore subpath (1,3) of bpath f dashed evenly; -endfig; - - -beginfig(1); -draw (20,20)--(0,0)--(0,30)--(30,0)--(0,0); -endfig; - - -beginfig(2); numeric u; -u=1cm; -draw (2u,2u)--(0,0)--(0,3u)--(3u,0)--(0,0); -pickup pencircle scaled 4pt; -for i=0 upto 2: - for j=0 upto 2: - drawdot (i*u,j*u); - endfor -endfor -endfig; - - -beginfig(3); -z0 = (0,0); z1 = (60,40); -z2 = (40,90); z3 = (10,70); -z4 = (30,50); -draw z0..z1..z2..z3..z4; -dotlabels.top(0,2,4); -dotlabels.lft(3); -dotlabels.lrt(1); -endfig; - - -beginfig(104); -z0 = (0,0); z1 = (60,40); -z2 = (40,90); z3 = (10,70); -z4 = (30,50); -draw z0..z1..z2..z3..z4..cycle; -dotlabels.top(2,4); -dotlabels.lft(0,3); -dotlabels.lrt(1); -endfig; - - -beginfig(204); -z0 = (0,0); z1 = (60,40); -z2 = (40,90); z3 = (10,70); -z4 = (30,50); -draw z0..z1..z2..z3--z4--cycle; -dotlabels.top(2,4); -dotlabels.lft(0,3); -dotlabels.lrt(1); -endfig; - - -beginfig(5); -z0 = (0,0); z1 = (60,40); -z2 = (40,90); z3 = (10,70); -z4 = (30,50); -path p; p = z0..z1..z2..z3..z4; -draw p; -for t=0 upto 3: - draw point t of p--postcontrol t of p - --precontrol t+1 of p--point t+1 of p - dashed (evenly scaled .5); -endfor -dotlabels.top(0,2,4); -dotlabels.lft(3); -dotlabels.lrt(1); -endfig; - - -beginfig(6); -z0 = (0,0); z1 = (60,40); -z2 = (40,90); z3 = (10,70); -z4 = (30,50); -draw z0..z1{up}..z2{left}..z3..z4; -dotlabels.top(0,2,4); -dotlabels.lft(3); -dotlabels.lrt(1); -endfig; - - -beginfig(7) -for a=0 upto 9: - draw (0,0){dir 45}..{dir -10a}(6cm,0); -endfor -endfig; - -beginfig(8) -for a=0 upto 7: - draw (0,0){dir 45}..{dir 10a}(6cm,0); -endfor -endfig; - - -beginfig(109); -z2=-z0=(1in,0); z1=(0,.2in); -draw z0{up}..z1{right}..z2{down}; -dotlabels.bot(0,1,2); -endfig; - - -beginfig(209); -z2=-z0=(1in,0); z1=(0,.2in); -draw z0{up}...z1{right}...z2{down}; -dotlabels.bot(0,1,2); -endfig; - - -beginfig(110); -numeric u; 10u=1.5in; --z0=z3=(5u,0); -(-x1,y1)=z2=(3u,2u); -draw z0..z1..z2..z3; -dotlabels.bot(0,1,2,3); -endfig; - - -beginfig(210); -numeric u; 10u=1.5in; --z0=z3=(5u,0); -(-x1,y1)=z2=(3u,2u); -draw z0..z1..tension 1.3..z2..z3; -dotlabels.bot(0,1,2,3); -endfig; - - -beginfig(310); -numeric u; 10u=1.5in; --z0=z3=(5u,0); -(-x1,y1)=z2=(3u,2u); -draw z0..z1..tension 1.5 and 1..z2..z3; -dotlabels.bot(0,1,2,3); -endfig; - - -beginfig(111); -numeric u, c; 10u=1.4in; c=0; -z1=(0,0); (x0,-y0)=z2=(2u,5u); -draw z0{curl c}..z1..{curl c}z2; -dotlabels.rt(0,1,2); -endfig; - - -beginfig(211); -numeric u, c; 10u=1.4in; c=1; -z1=(0,0); (x0,-y0)=z2=(2u,5u); -draw z0{curl c}..z1..{curl c}z2; -dotlabels.rt(0,1,2); -endfig; - - -beginfig(311); -numeric u, c; 10u=1.4in; c=2; -z1=(0,0); (x0,-y0)=z2=(2u,5u); -draw z0{curl c}..z1..{curl c}z2; -dotlabels.rt(0,1,2); -endfig; - - -beginfig(411); -numeric u, c; 10u=1.4in; c=infinity; -z1=(0,0); (x0,-y0)=z2=(2u,5u); -draw z0{curl c}..z1..{curl c}z2; -dotlabels.rt(0,1,2); -endfig; - - -beginfig(13); -z1=-z2=(.2in,0); -x3=-x6=.3in; -x3+y3=x6+y6=1.1in; -z4=1/3[z3,z6]; -z5=2/3[z3,z6]; -z20=whatever[z1,z3]=whatever[z2,z4]; -z30=whatever[z1,z4]=whatever[z2,z5]; -z40=whatever[z1,z5]=whatever[z2,z6]; -draw z1--z20--z2--z30--z1--z40--z2; -pickup pencircle scaled 1pt; -draw z1--z2; -draw z3--z6; -% -dotlabels.bot(1,2); -dotlabels.rt(3); -dotlabels.lft(6); -dotlabels.top(20,30,40); -endfig; - - -vardef llet(expr c) = - c infont defaultfont scaled magstep3 -enddef; - -primarydef p centered h = - (p shifted (h - xpart .5[llcorner p,lrcorner p], 0)) -enddef; - -beginfig(14); -string s; s = "abcde"; -numeric u,n, ytop, ybot; -n = 5; -ytop = 3bp + ypart urcorner llet(s); -ybot = -3bp + ypart llcorner llet(s); -ytop - ybot = u; -draw (n*u,ybot)--(0,ybot)--(0,ytop)--(n*u,ytop); -for i=1 upto n: - draw (i*u,ybot)..(i*u,ytop); - draw llet(substring (i-1,i) of s) centered ((i-.5)*u); - label.bot(decimal i, (i*u,ybot)); -endfor -picture llab; llab = btex \llap{$x={}$}0 etex; -z0 = urcorner llab; -draw llab shifted (-.5*x0, ybot-labeloffset-y0); -endfig; - - -beginfig(17); -a=.7in; b=.5in; -z0=(0,0); -z1=-z3=(a,0); -z2=-z4=(0,b); -draw z1..z2..z3..z4..cycle; -draw z1--z0--z2; -label.top("a", .5[z0,z1]); -label.lft("b", .5[z0,z2]); -dotlabel.bot("(0,0)", z0); -endfig; - - -beginfig(18); -numeric u; -u = 1cm; -draw (0,2u)--(0,0)--(4u,0); -pickup pencircle scaled 1pt; -draw (0,0){up} - for i=1 upto 8: ..(i/2,sqrt(i/2))*u endfor; -label.lrt(btex $\sqrt x$ etex, (3,sqrt 3)*u); -label.bot(btex $x$ etex, (2u,0)); -label.lft(btex $y$ etex, (0,u)); -endfig; - - -beginfig(19); -numeric ux, uy; -120ux=1.2in; 4uy=2.4in; -draw (0,4uy)--(0,0)--(120ux,0); -pickup pencircle scaled 1pt; -draw (0,uy){right} - for ix=1 upto 8: - ..(15ix*ux, uy*2/(1+cosd 15ix)) - endfor; -label.bot(btex $x$ axis etex, (60ux,0)); -label.lft(btex $y$ axis etex rotated 90, - (0,2uy)); -label.lft( - btex $\displaystyle y={2\over1+\cos x}$ etex, - (120ux, 4uy)); -endfig; - - -beginfig(20); -picture p; -p = "testing" infont "ptmr8r" scaled 7; -draw p; -draw llcorner p--lrcorner p--urcorner p--ulcorner p--cycle; -dotlabel.lft(btex \tt llcorner etex, llcorner p); -dotlabel.rt(btex \tt lrcorner etex, lrcorner p); -dotlabel.lft(btex \tt ulcorner etex, ulcorner p); -dotlabel.rt(btex \tt urcorner etex, urcorner p); -endfig; - - -beginfig(21); -path p; -p = (-1cm,0)..(0,-1cm)..(1cm,0); -fill p{up}..(0,0){-1,-2}..{up}cycle; -draw p..(0,1cm)..cycle; -endfig; - - -beginfig(22); -path a, b, aa, ab; -a = fullcircle scaled 2cm; -b = a shifted (0,1cm); -aa = halfcircle scaled 2cm; -ab = buildcycle(aa, b); -picture pa, pb; -pa = thelabel(btex $A$ etex, (0,-.5cm)); -pb = thelabel(btex $B$ etex, (0,1.5cm)); -fill a withcolor .7white; -fill b withcolor .7white; -fill ab withcolor .4white; -unfill bbox pa; -draw pa; -unfill bbox pb; -draw pb; -label.lft(btex $U$ etex, (-1cm,.5cm)); -draw bbox currentpicture; -endfig; - - -beginfig(123); -path aa, b; -b = a shifted (0,1cm); -aa = halfcircle scaled 2cm; -draw aa; -draw b dashed evenly; -z1 = aa intersectionpoint reverse b; -z2 = reverse aa intersectionpoint b; -dotlabel.rt(btex 1 etex, z1); -dotlabel.lft(btex 2 etex, z2); -label.bot(btex \tt aa etex, point 0 of aa); -label.bot(btex \tt b etex, point 2 of b); -endfig; - -beginfig(223); -path aa, b; -b = a shifted (0,1cm); -aa = halfcircle scaled 2cm; -numeric t[], tt[]; -(t1,8-tt1) = aa intersectiontimes reverse b; -(4-t2,tt2) = reverse aa intersectiontimes b; -pickup(pencircle scaled .3); -draw aa; -draw b; -pickup(pencircle scaled .8); -draw subpath (t1,t2) of aa; -draw subpath (tt2,tt1) of b; -dotlabel.rt(btex 1 etex, point t1 of aa); -dotlabel.lft(btex 2 etex, point t2 of aa); -label.bot(btex \tt aa etex, point 0 of aa); -label.bot(btex \tt b etex, point 2 of b); -endfig; - - -beginfig(24); -h=2in; w=2.7in; -path p[], q[], pp; -for i=2 upto 4: ii:=i**2; - p[i] = (w/ii,h){1,-ii}...(w/i,h/i)...(w,h/ii){ii,-1}; -endfor -q0.5 = (0,0)--(w,0.5h); -q1.5 = (0,0)--(w/1.5,h); -pp = buildcycle(q0.5, p2, q1.5, p4); -fill pp withcolor .7white; -z0=center pp; -picture lab; lab=thelabel(btex $f>0$ etex, z0); -unfill bbox lab; draw lab; -draw q0.5; draw p2; draw q1.5; draw p4; -dotlabel.top(btex $P$ etex, p2 intersectionpoint q0.5); -dotlabel.rt(btex $Q$ etex, p2 intersectionpoint q1.5); -dotlabel.lft(btex $R$ etex, p4 intersectionpoint q1.5); -dotlabel.bot(btex $S$ etex, p4 intersectionpoint q0.5); -endfig; - - -beginfig(25); -numeric u; -u = .2in; -path a, b; -a = (0,0){up}..(4u,0)..(8u,0)..(8u,4u); -b = (10u,3u)..(5u,u)..(-u,u); -numeric t; t=0; -forsuffixes $=bot, llft, lrt, lft: - dotlabel$(decimal t, point t of a); - t:=t+1; -endfor -for i=0 upto 2: - dotlabel.top(decimal i, point i of b); -endfor -pickup(pencircle scaled .3); -draw a; -pickup(pencircle scaled .8); -draw b; -% intersections (atime, btime): -% (0.2501,1.77225) -% (2.58316,0.23619) -% (0.75288,1.40094) -endfig; - - -beginfig(26); -numeric scf, #, t[]; -3.2scf = 2.4in; -path fun; -# = .1; % Keep the function single-valued -fun = ((0,-1#)..(1,.5#){right}..(1.9,.2#){right}..{curl .1}(3.2,2#)) - yscaled(1/#) scaled scf; -x1 = 2.5scf; -for i=1 upto 2: - (t[i],whatever) = - fun intersectiontimes ((x[i],-infinity)--(x[i],infinity)); - z[i] = point t[i] of fun; - z[i]-(x[i+1],0) = whatever*direction t[i] of fun; - draw (x[i],0)--z[i]--(x[i+1],0); - fill fullcircle scaled 3bp shifted z[i]; -endfor -label.bot(btex $x_1$ etex, (x1,0)); -label.bot(btex $x_2$ etex, (x2,0)); -label.bot(btex $x_3$ etex, (x3,0)); -draw (0,0)--(3.2scf,0); -pickup pencircle scaled 1pt; -draw fun; -endfig; - - -beginfig(28); -path p[]; -p1 = fullcircle scaled .6in; -z1=(.75in,0)=-z3; -z2=directionpoint left of p1=-z4; -p2 = z1..z2..{curl1}z3..z4..{curl 1}cycle; -fill p2 withcolor .4[white,black]; -unfill p1; -draw p1; -transform T; -z1 transformed T = z2; -z3 transformed T = z4; -xxpart T=yypart T; yxpart T=-xypart T; -picture pic; -pic = currentpicture; -for i=1 upto 2: - pic:=pic transformed T; - draw pic; -endfor -dotlabels.top(1,2,3); dotlabels.bot(4); -endfig; - - -beginfig(29); -if unknown withdots: % So this works w/o MetaPost version 0.5 - picture withdots; withdots=dashpattern(off 2.5 on 0 off 2.5); -fi -z0 = (0,0); -z1 = (2in-2bp,0); -for i=1 upto 4: - z[2i]-z[2i-2] = z[2i+1]-z[2i-1] = (0,14pt); -endfor -draw z0..z1 dashed evenly; -label.rt(btex \tt dashed evenly etex, z1); -draw z2..z3 dashed evenly scaled 2; -label.rt(btex \tt dashed evenly scaled 2 etex, z3); -draw z4..z5 dashed evenly scaled 4; -label.rt(btex \tt dashed evenly scaled 4 etex, z5); -draw z6..z7 dashed withdots; -label.rt(btex \tt dashed withdots etex, z7); -draw z8..z9 dashed withdots scaled 2; -label.rt(btex \tt dashed withdots scaled 2 etex, z9); -endfig; - - -beginfig(30); -picture e[]; e4=evenly scaled 4; -z0 = (0,0); -z1 = (2in,0); -for i=1 upto 3: - z[2i]-z[2i-2] = z[2i+1]-z[2i-1] = (0,14pt); -endfor -dotlabels.lft(0,2,4,6); -draw z0..z1 dashed e4; -dotlabel.rt(btex 1 \tt\ draw z0..z1 dashed e4 etex, z1); -draw z2..z3 dashed e4 shifted (6bp,0); -dotlabel.rt(btex 3 \tt\ draw z2..z3 dashed e4 shifted (6bp,0) etex, z3); -draw z4..z5 dashed e4 shifted (12bp,0); -dotlabel.rt(btex 5 \tt\ draw z4..z5 dashed e4 shifted (12bp,0) etex, z5); -draw z6..z7 dashed e4 shifted (18bp,0); -dotlabel.rt(btex 7 \tt\ draw z6..z7 dashed e4 shifted (18bp,0) etex, z7); -endfig; - - -beginfig(31); -picture d; d = dashpattern(on 6bp off 12bp on 6bp); -draw d; -endfig; - - -beginfig(32); -draw dashpattern(on 15bp off 15bp) dashed evenly; -picture p; -p=currentpicture; -currentpicture:=nullpicture; -draw fullcircle scaled 1cm xscaled 3 dashed p; -endfig; - - -beginfig(33); -for i=0 upto 2: - z[i]=(0,-40i); z[i+3]-z[i]=(100,30); -endfor -pickup pencircle scaled 18; -draw z0..z3 withcolor .8white; -linecap:=butt; -draw z1..z4 withcolor .8white; -linecap:=squared; -draw z2..z5 withcolor .8white; -dotlabels.top(0,1,2,3,4,5); -endfig; linecap:=rounded; - - -beginfig(34); -for i=0 upto 2: - z[i]=(0,-50i); z[i+3]-z[i]=(60,40); - z[i+6]-z[i]=(120,0); -endfor -pickup pencircle scaled 24; -draw z0--z3--z6 withcolor .8white; -linejoin:=mitered; -draw z1..z4--z7 withcolor .8white; -linejoin:=beveled; -draw z2..z5--z8 withcolor .8white; -dotlabels.bot(0,1,2,3,4,5,6,7,8); -endfig; linejoin:=rounded; - - -beginfig(35); -z2a=(0,0); -(-x1a,y1a) = -z3a = .5in*unitvector(6,1); -z1b - z1a = .75*z1a rotated -90; -z2b - z1b = whatever*(z2a-z1a); -z3b - z2b = whatever*(z3a-z2a); -y2b = 0; -z3b - z3a = whatever*(z3a rotated 90); -z0b-z1b = z0a-z1a = z1a; -x4a=x2a; x4b=x2b; -y4a = y4b = 1.3*y3b; -fill z1a--z2a--z3a--z3b--z2b--z1b--cycle withcolor .8 white; -for p= z2a--z4a, z2b--z4b, z0a--z1a, z0b--z1b: - draw p dashed evenly; -endfor -drawdblarrow z4a--z4b; -drawdblarrow z0a--z0b; -label.bot(btex miter length etex, .5[z4a,z4b]); -label.ulft(btex line width etex, .5[z0a,z0b]); -endfig; - - -beginfig(36); -z[-1]=(0,0); z0=(1in,0); -for i=1 upto 6: - z[i]-z[i-2] = (0,-15pt); - if x[i]=0: label.lft(decimal i, z[i]); - fi -endfor -drawarrow z1..z2; -drawarrow reverse(z3..z4); -drawdblarrow z5..z6; -label.rt(btex 2 \tt\ drawarrow z1..z2 etex, z2); -label.rt(btex 4 \tt\ drawarrow reverse(z3..z4) etex, z4); -label.rt(btex 6 \tt\ drawdblarrow z5..z6 etex, z6); -endfig; - - -beginfig(37); -path p, q, r; -ahlength := 1.5cm; -pickup pencircle scaled .2cm; -p = (0,0)..{right}(2.5cm,2cm); -q = counterclockwise arrowhead p; -z0 = directionpoint up of q; -z.a = directionpoint right of q; -z.b = directionpoint (-1,-1) of q; -drawarrow p withcolor .4white; -pickup defaultpen; -undraw p; -undraw q; -ahlength:=4bp; -z.a1-z0 = .3cm*unitvector(z.a-z0) rotated 90; -z.a1-z.a2 = z0-z.a; -z.b1-z0 = .3cm*unitvector(z.b-z0) rotated -90; -z.b1-z.b2 = z0-z.b; -z.ab = whatever[z.a1,z.a2] = whatever[z.b1,z.b2]; -z.a0-z.ab = .4cm*unitvector(z.a1-z.a2); -z.b0-z.ab = .4cm*unitvector(z.b1-z.b2); -drawdblarrow z.a1..z.a2; -label.lrt(btex \tt ahlength etex, .9[z.a1,z.a2]); -draw z.a1..z.a0 dashed evenly; -drawdblarrow z.b1..z.b2; -label.urt(btex \tt ahlength etex, .9[z.b1,z.b2]); -draw z.b1..z.b0 dashed evenly; -r = z.a0{(z.a2-z.a0) rotated 90}..{(z.b2-z.b0)rotated 90}z.b0; -draw r; -label.rt(btex \tt ahangle etex, point .5 of r); -endfig; - - -beginfig(38); -pickup pencircle scaled .2in yscaled .08 rotated 30; -x0=x3=x4; -z1-z0 = .45in*dir 30; -z2-z3 = whatever*(z1-z0); -z6-z5 = whatever*(z1-z0); -z1-z6 = 1.2*(z3-z0); -rt x3 = lft x2; -x5 = .55[x4,x6]; -y4 = y6; -lft x3 = bot y5 = 0; -top y2 = .9in; -draw z0--z1--z2--z3--z4--z5--z6 withcolor .7white; -dotlabels.top(0,1,2,3,4,5,6); -endfig; - - -beginfig(40); -path p[]; -p1 = (0,0){curl 0}..(5pt,-3pt)..{curl 0}(10pt,0); -p2 = p1..(p1 yscaled-1 shifted(10pt,0)); -p0 = p2; -for i=1 upto 3: p0:=p0.. p2 shifted (i*20pt,0); - endfor -for j=0 upto 8: draw p0 shifted (0,j*10pt); - endfor -p3 = fullcircle shifted (.5,.5) scaled 72pt; -clip currentpicture to p3; -draw p3; -endfig; - - -marksize=4pt; -angle_radius=8pt; - -def draw_mark(expr p, a) = - begingroup - save t, dm; pair dm; - t = arctime a of p; - dm = marksize*unitvector direction t of p - rotated 90; - draw (-.5dm.. .5dm) shifted point t of p; - endgroup -enddef; - -def draw_marked(expr p, n) = - begingroup - save amid; - amid = .5*arclength p; - for i=-(n-1)/2 upto (n-1)/2: - draw_mark(p, amid+.6marksize*i); - endfor - draw p; - endgroup -enddef; - -def mark_angle(expr a, b, c, n) = - begingroup - save s, p; path p; - p = unitvector(a-b){(a-b)rotated 90}..unitvector(c-b); - s = .9marksize/length(point 1 of p - point 0 of p); - if s\z@ \def\logo{\logosl}\fi - {\logo META}\-{\logo FONT}}} -\makeatother - -\def\descr#1{{\langle\hbox{#1}\rangle}} -\def\lit#1{{\hbox{\textt#1}}} -\def\okbreak{\vfil\penalty2000 \vfilneg} - -{\obeylines\obeyspaces\gdef\startverbatim{% -\vcenter\bgroup\textt\catcode`\$=12\catcode`\}=12\catcode`\{=12\catcode`\_=12% -\catcode`\\=12\catcode`\#=12\catcode`\^=12\catcode`\%=0% -\obeyspaces\let =\ \obeylines\let^^M=\cr\halign\bgroup##\hfil}} -\def\stopverbatim{\egroup\egroup} - -\begin{document} -\maketitle - -\begin{abstract} -The MetaPost system implements a picture-drawing language very much like Knuth's -\MF\ except that it outputs PostScript commands instead of run-length-encoded -bitmaps. MetaPost is a powerful language for producing figures for documents -to be printed on PostScript printers. It provides easy access to all the -features of PostScript and it includes facilities for integrating text and -graphics. - -This document describes the system and its implementation. It also includes -basic user documentation to be used in conjunction with {\it The \MF book}. -Much of the source code was copied from the \MF\ sources by permission from -the author. -\end{abstract} - - -\section{Overview} -The MetaPost system is based on Knuth's \MF\footnote{\MF\ is a trademark -of Addison Wesley Publishing company.}~\cite{kn:c} and much of the source -code is copied with permission from the \MF\ sources. MetaPost is a graphics -language like \MF, but with new primitives for integrating text and graphics and -for accessing special features of PostScript\footnote{PostScript is a -trademark of Adobe Systems Inc.} such as clipping, shading, and -dashed lines. The language has the main features of \MF\ including first-class -objects for curves, pictures, affine transformations, and pen shapes. -Another feature borrowed from \MF\ is the ability to solve linear equations -that are given implicitly, thus allowing many programs to be written in a -largely declarative style. - -While MetaPost could be used as a tool for generating PostScript fonts, -the intended application is to generate figures for \TeX\footnote{\TeX\ is a -trademark of the American Mathematical Society.} and {\it troff\/} documents. -The figures can be integrated into a \TeX\ document via a freely available -program called {\tt dvips} as shown in Figure~1.\footnote{The C source for -{\tt dvips} comes with the web2c \TeX\ distribution. Similar programs are -available from other sources.} A similar procedure works with troff: the -{\tt grops} output processor includes PostScript figures when they are -requested via troff's {\tt \char`\\X} command. - -\begin{figure}[htp] -\centering -\includegraphics{manfig-0} -\caption{A diagram of the processing for a \TeX\ document with figures done in -Meta\-Post} -\end{figure} - -Other than the new commands for integrating text and accessing features of -PostScript, the main difference between the \MF\ and MetaPost languages is -that the latter deals with continuous pictures rather than discrete ones. -This affects the coordinate system and some of the subtler aspects of the -language as outlined in the next two sections. - -Sections \ref{basic} and \ref{advanced} give a short summary of the language -with numerous examples. Then Section~\ref{impsec} describes the implementation. -A preliminary description of the language has already appeared~\cite{ho:mp1}. - -\section{Introduction to MetaPost} -\label{basic} -MetaPost is a lot like Knuth's \MF\ -except that it outputs PostScript programs instead -of bitmaps. Knuth describes the \MF\ language in {\sl The \MF book\/}.~\cite{kn:d} - -This document introduces MetaPost via examples and references to key parts of -{\sl The \MF book}. It is a good idea to start by reading chapters 2~and 3 -in {\sl The \MF book}. The introductory material in these chapters applies -to MetaPost except that coordinates are in units of -PostScript points by default (72 units per inch). - -To see MetaPost in action, consider a file \lit{fig.mp} containing the -following text:\vadjust{\okbreak} -$$ \startverbatim -beginfig(1); -a=.7in; b=0.5in; -z0=(0,0); z1=(a,0); z2=(0,b); -z0=.5[z1,z3]=.5[z2,z4]; -draw z1..z2..z3..z4..cycle; -drawarrow z0..z1; -drawarrow z0..z2; -label.top(btex $a$ etex, .5[z0,z1]); -label.lft(btex $b$ etex, .5[z0,z2]); -endfig; -end -%stopverbatim$$ -Then the command \lit{mp} \lit{fig} produces an output file \lit{fig.1} -that can be included in a -\TeX\ document.\footnote{For importing MetaPost graphics into -\LaTeX\ documents please refer to section \emph{Using MetaPost graphics -in \TeX, \LaTeX, pdf\LaTeX, pdf\TeX, Con\TeX{}t and troff} in the -MetaPost manual.} -After \lit{\string\input} \lit{epsf} the \TeX\ commands -\lit{\$\$\string\epsfbox\char`\{fig.1\char`\}\$\$} produce -$$ \includegraphics{examples-1.mps} $$ -The \lit{beginfig(1)} line means that everything up to the next -\lit{endfig} is to be used to create \lit{fig.1}. If there -were more than one figure in \lit{fig.mp}, there would be additional -\lit{beginfig} $\ldots$ \lit{endfig} blocks. - -The \lit{drawarrow} macro has been specially developed for MetaPost. -There is also a command called \lit{drawdblarrow} that draws the -following path with arrowheads on both ends. The line beginning with -\lit{label.top} is a call to a standard macro for positioning text just -above a given point. In this case, the point \lit{.5[z0,z1]} is the -midpoint of the segment from \lit{z0} to \lit{z1} and the text is -generated by the \TeX\ commands \lit{\$a\$}. In addition to \lit{label.top} -and \lit{label.lft}, there is also \lit{label.bot}, \lit{label.rt}, -and four other versions \lit{label.ulft} for upper-left etc. Just -plain \lit{label} without any suffix centers the -label on the given point. - -The discussion of pens in Chapter~4 of {\sl The \MF book\/} applies -to MetaPost as well, but simple figures often do not need to refer to -pens explicitly because they can just use the default pen which is a -circle $0.5{\it bp}$ in diameter.\footnote{The letters ``{\it bp}'' -stand for ``big point'' ($1\over72$ inch). This is one of the standard -units of measure in \TeX\ and \MF\ and it is the default unit for -MetaPost. A complete listing of predefined units is given on page~92 of -{\sl The \MF book}.} This produces lines of uniform thickness -$0.5{\it bp}$ regardless of the direction of the line. - -Chapter 5 of {\sl The \MF book\/} does not apply to MetaPost. -In particular, there is no \lit{mode\_setup} macro or ``sharped units'' -and \lit{mp} does not output \lit{gf} files. MetaPost does have -a set of preloaded macros but they are not the same as \MF's plain base. -If there were an -analogous chapter about running MetaPost, it would probably mention that -\lit{mp} skips over \lit{btex} $\ldots$ \lit{etex} blocks -and depends on a preprocessor to translate them into low level MetaPost -commands. If the main file is \lit{fig.mp}, the translated \TeX\ -material is placed in a file named \lit{fig.mpx}. This is normally -done silently without any user intervention but it could fail if one of -the \lit{btex} $\ldots$ \lit{etex} blocks contains an erroneous -\TeX\ command. If this happens, the erroneous \TeX\ input is saved in -the file \lit{mpxerr.tex} and the error messages appear in -\lit{mpxerr.log}. - -If there is a need for \TeX\ macro definitions or any other auxiliary -\TeX\ commands, they can be enclosed in a -\lit{verbatimtex} $\ldots$ \lit{etex} block. The difference between -\lit{btex} and \lit{verbatimtex} is that the former generates a picture -expression while the latter does not. - -On Unix systems, an environment variable can be used to specify that -\lit{btex} $\ldots$ \lit{etex} and \lit{verbatimtex} $\ldots$ \lit{etex} -blocks are in {\it troff\/} instead of \TeX. When using this option, -it is a good idea to give the MetaPost command \lit{prologues:=1}. -This tells \lit{mp} to output structured PostScript and assume that -text comes from built-in PostScript fonts. - -Chapters 6--10 of {\sl The \MF book\/} cover important aspects of \MF\ -that are almost identical in MetaPost. The only change to the tokenization -process described in Chapter~6 is that \TeX\ material can contain -percent signs and unmatched double quote characters so these are -treated like spaces when skipping \TeX\ material. The preprocessor gives -\TeX\ everything between \lit{btex} and \lit{etex} except for leading -and trailing spaces. - -Chapters 7--10 discuss the types of variables and expressions that \MF\ -understands. MetaPost has an additional type ``\lit{color}'' that is -a lot like \lit{pair} except that it has three components instead of -two. The operations allowed on colors are addition, subtraction, scalar -multiplication, and scalar division. MetaPost also understands mediation -expressions involving colors since -\lit{.3[w,b]} is equivalent to \lit{w+.3(b-w)} which is allowed -even when \lit{w} and \lit{b} are colors. Colors can be specified -in terms of the predefined constants \lit{black}, \lit{white}, -\lit{red}, \lit{green}, \lit{blue}, or the red, green, and blue -components can be given explicitly. Black is \lit{(0,0,0)} and white -is \lit{(1,1,1)}. There is no restriction against colors ``blacker -than black'' or ``whiter than white'' except all components are snapped -back to the $[0,1]$ range when a color is given in an output file. -MetaPost solves linear equations involving colors the same way it does -so for pairs. (This is explained in Chapter~9). - -Let's consider another example that uses some of the ideas discussed above. -The MetaPost program\vadjust{\okbreak} -$$ \startverbatim -beginfig(2); -h=2in; w=2.7in; -path p[], q[], pp; -for i=1.5,2,4: ii:=i**2; - p[i] = (w/ii,h){1/ii,-1}...(w/i,h/i)...(w,h/ii){1,-1/ii}; -endfor -for i=.5,1.5: q[i] = origin..(w,i*h) cutafter p1.5; endfor -pp = buildcycle(q0.5, p2, q1.5, p4); -fill pp withcolor .8white; -z0=center pp; -picture lab; lab=thelabel(btex $f>0$ etex, z0); -unfill bbox lab; draw lab; -draw q0.5; draw p2; draw q1.5; draw p4; -makelabel.top(btex $P$ etex, p2 intersectionpoint q0.5); -makelabel.rt(btex $Q$ etex, p2 intersectionpoint q1.5); -endfig; -%stopverbatim$$ -produces the following figure:\vadjust{\okbreak} -$$ \includegraphics{examples-2} $$ - -The third line declares arrays of paths \lit{p} and \lit{q} as explained -in Chapter~7. Note that \lit{q1.5} is the same as \lit{q[i]} when -$\lit{i}=1.5$. The \lit{for} loops make each \lit{p[i]} -an approximation to an arc of the hyperbola -$$xy={wh\over i^2} $$ -and each \lit{q[i]} a segment of slope $ih/w$. (Loops are discussed in -Chapter~19 of {\sl The \MF book\/}). - -The \lit{cutafter} operator is used to cut off the part of \lit{q[i]} after -the intersection with \lit{p1.5}. (There is no ``\lit{draw} \lit{p1.5}'' in -the input for the above figure so this hyperbola is invisible). There is also a -\lit{cutbefore} operator defined to make -$$ a \lit{ cutbefore } b $$ -what's left of path~$a$ when everything before its intersection with~$b$ is -removed. In case of multiple intersections \lit{cutbefore} and \lit{cutafter} -try to cut off as little as possible. - -The shaded region in the above figure is due to the line -$$ \lit{fill pp withcolor .8white} $$ -The boundary of this region is the path \lit{pp} that the \lit{buildcycle} -macro creates by piecing together the four paths given as arguments. In other -words, \lit{pp} is constructed by going along \lit{q0.5} until it -intersects \lit{p2}, then going along \lit{p2} until hitting -\lit{q1.5}, etc. It turns out that this requires going backwards along -\lit{p2} and \lit{q1.5}. The \lit{buildcycle} macro tries to avoid -going backwards if it has a choice as to which intersection points to choose, -but in this example each pair of consecutive path arguments has a unique -intersection point. It is generally a good idea to avoid multiple intersections -because they can lead to unpleasant surprises. - -The \lit{fill} and \lit{unfill} macros in plain MetaPost are similar to -the corresponding macros discussed in Chapter~13 of {\sl The \MF book\/} -but MetaPost assigns colors to regions rather than assigning weights to pixels. -There is no \lit{cull} command or \lit{withweight} option in MetaPost. -The \lit{unfill} macro used to erase the rectangle containing the label -``$f>0$'' in the above figure works by specifying ``\lit{withcolor} -\lit{background}'' -where \lit{background}'' is usually equal to \lit{white}. The complete -syntax for primitive drawing commands in MetaPost is as follows: -$$\tabskip=0.0pt plus 1000.0pt minus 1000.0pt - \halign to\hsize{$#$\hfil\cr - \descr{picture command} \rightarrow - \descr{addto command} \mid \descr{clip command} \cr - \descr{addto command} \rightarrow {} \cr - \qquad \lit{addto }\descr{picture variable} \lit{ also } - \descr{picture expression} \descr{with list} \cr - \qquad {}\mid \lit{addto } \descr{picture variable} \lit{ contour } - \descr{path expression} \descr{with list} \cr - \qquad {}\mid \lit{addto } \descr{picture variable} \lit{ doublepath } - \descr{path expression} \descr{with list} \cr - \descr{with list} \rightarrow \descr{empty} \mid - \descr{with clause} \descr{with list} \cr - \descr{with clause} \rightarrow \lit{withcolor } \descr{color expression}\cr - \qquad {} \mid \lit{withpen } \descr{pen expression} - \mid \lit{dashed } \descr{picture expression}\cr - \descr{clip command} \rightarrow \lit{clip } - \descr{picture variable} \lit{ to } \descr{path expression} \cr} -$$ -If $P$ stands for \lit{currentpicture}, $q$ stands for -\lit{currentpen}, and $b$ stands for \lit{background}, the standard -drawing macros have roughly the following meanings: -$$ \tabskip=0.0pt plus 1000.0pt minus 1000.0pt - \halign to\hsize{$#$\hfil&\quad means\quad $#$\hfil\cr - \lit{draw }p& \lit{addto }P\lit{ doublepath }p\lit{ withpen }q\cr - \lit{fill }c& \lit{addto }P\lit{ contour }c\cr - \lit{filldraw }c& \lit{addto }P\lit{ contour }c\lit{ withpen }q\cr - \lit{undraw }p& \lit{addto }P\lit{ doublepath }p\lit{ withpen }q - \lit{ withcolor }b\cr - \lit{unfill }c& \lit{addto }P\lit{ contour }c\lit{ withcolor }b\cr - \lit{unfilldraw }c& \lit{addto }P\lit{ contour }c\lit{ withpen }q - \lit{ withcolor }b\cr} -$$ -The expressions denoted by $c$ in the table must be cyclic paths, while path -expressions $p$ need not be cyclic. It is also possible to use \lit{draw} -and \lit{undraw} when the argument is a picture~$r$: -$$ \tabskip=0.0pt plus 1000.0pt minus 1000.0pt - \halign to\hsize{$#$\hfil&\quad means\quad $#$\hfil\cr - \lit{draw }r& \lit{addto }P\lit{ also }r\cr - \lit{undraw }r& \lit{addto }P\lit{ also }r\lit{ withcolor }b\cr} -$$ - -The argument to \lit{unfill} in the last example is \lit{bbox lab}. -This is a call to a standard macro that gives the bounding box of a picture -as a rectangular path. The \lit{center} macro used two lines previously -makes \lit{z0} the center of the bounding box for path \lit{pp}. (This -works for paths and pictures). The expression -$$ \lit{thelabel(btex \$f>0\$ etex, z0)} $$ -computes a picture containing the text ``$f>0$'' centered on the point -\lit{z0}. - -Here is the complete syntax for labeling commands: -$$\tabskip=0.0pt plus 1000.0pt minus 1000.0pt - \halign to\hsize{$#$\hfil\cr - \descr{label command} \rightarrow - \descr{command name} \descr{position suffix} - (\descr{label text},\ \descr{label loc}) \cr - \qquad {}\mid \lit{labels} \descr{position suffix} (\descr{suffix list}) \cr - \descr{command name} \rightarrow \lit{label} - \mid \lit{thelabel} \mid \lit{makelabel} \cr - \descr{position suffix} \rightarrow - \descr{empty} \mid \lit{.lft} \mid \lit{.rt} \mid \lit{.top} - \mid \lit{.bot} \cr - \qquad {}\mid \lit{.ulft} \mid \lit{.urt} \mid \lit{.llft} - \mid \lit{.lrt}\cr - \descr{label text} \rightarrow \descr{picture expression} - \mid \descr{string expression} \cr - \descr{label loc} \rightarrow \descr{pair expression} \cr - \descr{suffix list} \rightarrow \descr{suffix} - \mid \descr{suffix}, \descr{suffix list} \cr} -$$ -The \lit{label} command adds text to \lit{currentpicture} near the -position $\descr{label loc}$ as determined by the $\descr{position suffix}$. -An empty suffix centers the label and the other options offset it slightly so -that it does not overlap the $\descr{label loc}$. Using \lit{thelabel} just -creates a picture expression rather than actually adding it to -\lit{currentpicture}. Using \lit{makelabel} instead of \lit{label} adds a dot -at the location being labeled. Finally, the \lit{labels} -command does -$$ \lit{makelabel} \descr{position suffix} - (\lit{str}\,\descr{suffix},\,\lit{z}\descr{suffix}) -$$ -for each $\descr{suffix}$ in the $\descr{suffix list}$, using the \lit{str} -operator to convert the suffix to a string. Thus \lit{labels.top(1,2a)} places -labels ``\lit{1}'' and ``\lit{2a}'' just above \lit{z1} and \lit{z2a}. - -The examples given so far have all used $\descr{label text}$ of the form -$$ \lit{btex}\ \descr{\TeX\ commands}\ \lit{etex}. -$$ -This gets converted into a picture expression. If the label is simple enough, -it can be given directly as a string expression in which case it is typeset -in \lit{defaultfont} at \lit{defaultscale} times its design size. -Normally, -$$ \lit{defaultfont="cmr10"} - \quad{\rm and}\quad \lit{defaultscale=1}, -$$ -but these can be reset if desired. Using \lit{cmtex10} instead of -\lit{cmr10} would allow the label to contain spaces and special characters. -If there is any doubt about what the design size is, use the \lit{fontsize} -operator to find it as follows: -$$ \lit{defaultfont:="Times";} - \qquad \lit{defaultscale:=10/fontsize "Times"} -$$ - -Notice that a $\descr{with clause}$ can be -``\lit{dashed} $\descr{picture expression}$.'' The picture -gives a template that tells how the line being drawn is to be dashed. There -is a standard template called \lit{evenly} that makes dashes $3bp$ long -separated by gaps of length $3bp$. It is possible to scale the template in -order to get a finer or coarser pattern. Thus -$$ \lit{draw z1..z2 dashed evenly scaled 2} $$ -draws a line with dashes $6bp$ long with gaps of $6bp$. - -The following MetaPost input illustrates the use of dashed -lines:\vadjust{\okbreak} -$$ \startverbatim -beginfig(3); -3.2scf = 2.4in; -path fun; -# = .1; -fun = ((0,-1#)..(1,.5#){right}..(1.9,.2#){right} - ..{curl .1}(3.2,2#)) scaled scf yscaled(1/#); -vardef vertline primary x = (x,-infinity)..(x,infinity) enddef; -primarydef f atx x = (f intersectionpoint vertline x) enddef; -primarydef f whenx x = xpart(f intersectiontimes vertline x) - enddef; -z1a = (2.5scf,0); -z1 = fun atx x1a; -y2a=0; z1-z2a=whatever*direction fun whenx x1 of fun; -z2 = fun atx x2a; -y3a=0; z2-z3a=whatever*direction fun whenx x2 of fun; -draw fun withpen pencircle scaled 1pt; -drawarrow (0,0)..(3.2scf,0); -label.bot(btex $x_1$ etex, z1a); -draw z1a..z1 dashed evenly; -makelabel(nullpicture, z1); -draw z1..z2a withpen pencircle scaled .3; -label.bot(btex $x_2$ etex, z2a); -draw z2a..z2 dashed evenly; -makelabel(nullpicture, z2); -draw z2..z3a withpen pencircle scaled .3; -label.bot(btex $x_3$ etex, z3a); -endfig; -%stopverbatim$$ -This produces the following figure:\vadjust{\okbreak} -$$ \includegraphics{examples-3} $$ - -The above figure uses some of the more advanced properties of paths discussed -in Chapter~14 of {\sl The \MF book}. All of this material applies to -MetaPost as well as \MF\ except for the explanation of ``strange paths'' which -fortunately cannot occur in MetaPost. The parts most relevant to this figure -are the explanation of ``curl'' specifications and the \lit{direction}, -\lit{intersectiontimes}, and \lit{intersectionpoint} operators. -In order to ensure that the path \lit{fun} makes $y$ a unique function -of~$x$, the path is first constructed with the $y$-coordinates compressed -by a factor of ten. The final ``\lit{yscaled(1/\char`\#)}'' restores -the original aspect ratio after MetaPost has chosen a cubic spline that -interpolates the given points. - -The \lit{yscaled} operator is an example of a very important class of -operators that apply affine transformations to pairs, paths, pens, pictures, -and other transforms. The discussion in Chapter~15 is relevant and -important. The only differences are that MetaPost has no -{\it currenttransform} and there is no restriction on the type of -transformations that can be applied to pictures. - -\section{More Advanced Topics} -\label{advanced} -MetaPost does have pens like those in \MF\ but they aren't very important -to the casual user except occasionally to specify changes in line widths -as in the preceding figure. Anyone reading the description in Chapter~16 of -{\sl The \MF book} should beware that there is no such thing as a -``future pen'' in MetaPost and elliptical pens are never converted into -polygons. Furthermore, there is no need for \lit{cutoff} and -\lit{cutdraw} because the same effect can be achieved by setting the -internal parameter \lit{linecap:=butt}.\vadjust{\okbreak} -$$\startverbatim -beginfig(4); -for i=0 upto 2: - z[i]=(0,40i); z[i+3]-z[i]=(100,30); -endfor -pickup pencircle scaled 18; -def gray = withcolor .8white enddef; -draw z0..z3 gray; -linecap:=butt; draw z1..z4 gray; -linecap:=squared; draw z2..z5 gray; -dotlabels.top(0,1,2,3,4,5); -endfig; linecap:=rounded; -%stopverbatim -\qquad -\vcenter{\includegraphics{examples-4}} -$$ - -There is also a \lit{linejoin} parameter as illustrated below. -The default values of \lit{linecap} and \lit{linejoin} are both -\lit{rounded}.\vadjust{\okbreak} -$$ \startverbatim -beginfig(5); -for i=0 upto 2: - z[i]=(0,50i); z[i+3]-z[i]=(60,40); - z[i+6]-z[i]=(120,0); -endfor -pickup pencircle scaled 24; -def gray = withcolor .8white enddef; -draw z0--z3--z6 gray; -linejoin:=mitered; draw z1..z4--z7 gray; -linejoin:=beveled; draw z2..z5--z8 gray; -dotlabels.bot(0,1,2,3,4,5,6,7,8); -endfig; linejoin:=rounded; -%stopverbatim -\qquad -\vcenter{\includegraphics{examples-5}} -\mskip-54mu % allow it to hang into the margin -$$ - -Another way to adjust the behavior of drawing commands is by giving the -declaration -$$ \lit{drawoptions}(\descr{with list}) $$ -For instance, -$$ \lit{drawoptions(withcolor blue)} $$ -gives subsequent drawing commands the default color blue. This can still -be overridden by giving another \lit{withcolor} clause as in -$$ \lit{draw p withcolor red} $$ -The options apply only to relevant drawing commands: -$$ \lit{drawoptions(dashed dd)} $$ -will affect \lit{draw} commands but not fill commands. - -Chapters 17--20 of {\sl The \MF book} describe the programming constructs -necessary to customize the language to a particular problem. These features -work the same way in MetaPost but a few additional comments are needed. -These chapters mention certain macros from plain \MF\ that are not in the -plain macro package for MetaPost. Generally if it sounds as though it's -for making fonts, MetaPost doesn't have it. Remember that \lit{beginfig} -and \lit{endfig} play the role of \MF's \lit{beginchar} and \lit{endchar}. -Look in the file \lit{plain.mp} in the standard macro area if there is any -doubt about what macros are predefined. This file is also a good source of -examples. - -Chapter 17 explains how the \lit{interim} statement makes temporary changes -to internal quantities. This works the same way in MetaPost except that -the example involving {\it autorounding} is inappropriate because MetaPost -doesn't have that particular quantity. Here is a complete list of the -internal quantities found in \MF\ but not MetaPost: -$$\vcenter{\hsize=.8\hsize \raggedright \multiply\rightskip by3 \textt\noindent - \lit{autorounding}, \lit{fillin}, \lit{granularity}, \lit{hppp}, - \lit{proofing}, \lit{smoothing}, \lit{tracingedges}, - \lit{tracingpens}, \lit{turningcheck}, \lit{vppp}, \lit{xoffset}, - \lit{yoffset}} -$$ -The following additional quantities are defined in plain \MF\ but not in -plain MetaPost: -$$\vcenter{\hsize=.8\hsize \raggedright \multiply\rightskip by3 \textt\noindent - \lit{pixels\_per\_inch}, \lit{blacker}, \lit{o\_correction}, - \lit{displaying}, \lit{screen\_rows}, \lit{screen\_cols}, - \lit{currentwindow}} -$$ - -There are also some internal quantities that are unique to MetaPost. -The \lit{linecap} and \lit{linejoin} parameters have already been mentioned. -There is also a \lit{miterlimit} parameter that behaves like the similarly -named parameter in PostScript. Another parameter, \lit{tracing\_lost\_chars} -suppresses error messages about attempts to typeset missing characters. -This is probably only relevant when using string parameters in the labeling -macros since expressions generated by \lit{btex} $\ldots$ \lit{etex} -blocks are not likely to use missing characters. - -The \lit{prologues} parameter was referred to earlier when we recommended -setting it to one when including MetaPost output in a {\it troff\/} document. -Any positivie value causes the output files to be ``conforming PostScript'' -that assumes only standard Adobe fonts are used. This makes the output -more portable but on most implementations, it precludes the use of the use -of \TeX\ fonts such as \lit{cmr10}. Software for sending \TeX\ output to -PostScript printers generally downloads such fonts one character at a time -and does not make them available in included PostScript figures. - -Plain MetaPost also has -internals \lit{bboxmargin}, \lit{labeloffset} and \lit{ahangle} -as well as \lit{defaultscale} which controls the size of the default label -font as explained above. The \lit{bboxmargin} parameter is the amount of -extra space that the \lit{bbox} operator leaves; \lit{labeloffset} gives the -distance by which labels are offset from the point being labeled; -\lit{ahangle} is the angle of the pointed ends of arrowheads -($45^\circ$ by default). There is also a path \lit{ahcirc} that controls -the size of the arrowheads. The statement -$$ \lit{ahcirc := fullcircle scaled d} $$ -changes the arrowhead length to $\lit{d}/2$. - -The only relevant new material in {\sl The \MF book\/} not mentioned so far -is in Chapters 21--22 and Appendix~D. Chapters 23 and~24 do not apply to -MetaPost at all. The grammar given in Chapters 25 and~26 isn't exactly a -grammar of MetaPost, but most of the differences have been mentioned above. -There are \lit{redpart}, \lit{bluepart}, and \lit{greenpart} operators for -colors and there is no \lit{totalweight} operator. The new primitive for -label text in pictures is -$$ \descr{picture secondary} \rightarrow - \descr{picture secondary} \lit{ infont } \descr{string primary} -$$ -Bounding box information can be obtained via the operators -\begin{eqnarray*} - \descr{pair primary} &\rightarrow& \descr{corner selector} - \descr{picture primary}\\ - \descr{corner selector} &\rightarrow& \lit{llcorner} \mid \lit{urcorner} - \mid \lit{lrcorner} \mid \lit{urcorner} -\end{eqnarray*} -The main reason for having these in the MetaPost language is for measuring -text but they work for pictures containing any mixture of text and graphics. - -The command -$$ \lit{special }\descr{string expression} $$ -adds a line of text at the beginning of the next output file. For instance, -the following commands add PostScript definitions that allow MetaPost output -to use the built-in font \lit{Times-Roman}. -$$ \startverbatim -special "/Times-Roman /Times-Roman def"; -special "/fshow {exch findfont exch scalefont setfont show}"; -special " bind def"; -%stopverbatim -$$ -A similar definition is generated automatically when you set \lit{prologues:=1}. -With \lit{prologues=0}, it is assumed that the program that translates \TeX\ -output and includes PostScript figures will add the necessary definition.% -\footnote{A full description of how to avoid including your -output in a \TeX\ document is beyond the scope of this documentation. -MetaPost output generated with \lit{prologues:=1} can be sent directly to a -PostScript printer if it uses only built-in fonts like \lit{Helvetica}.} - -Another new feature of MetaPost that needs further explanation is the idea of -a dash pattern. It is easiest if you can just get by with the dash pattern -called \lit{evenly} that is defined in plain MetaPost, but it seems necessary -to give the exact rules just in case they are needed. - -A dash pattern is a picture containing one or more horizontal -line segments. It doesn't matter what pen is used to draw the line segments. -MetaPost behaves as though the dash pattern is replicated to form an -infinitely long horizontal dashed line to be used as a template for dashed -lines. For example, the following commands create a dash pattern~\lit{dd}: -$$\startverbatim -draw (1,0)..(3.0); draw (5,0)..(6,0); -picture dd; dd=currentpicture; clearit; -%stopverbatim -$$ -Lining up an infinite number of copies of \lit{dd} produces a set of line -segments -$$ \{\,(5i,0)\ldots(5i+3,0) \mid \hbox{for all integer $i$}\,\}. $$ -This template is used by starting from the $y$-axis and going to the right, -producing dashes $3bp$ long separated by gaps of length $2bp$. - -In this example, successive copies of \lit{dd} are offset by $5bp$ because -the range of $x$ coordinates covered by the line segments in \lit{dd} is -$6-1$ or $5bp$. The offset can be increased by shifting the dash pattern -vertically so that it lies at a $y$-coordinate greater that $5bp$ in -absolute value. The rule is that the horizontal offset between copies of -the dash pattern is the maximum of $|y|$ and the range of $x$-coordinates. - -\bigbreak -\centerline{\bf Making Boxes} -\nobreak\medskip -There are auxiliary macros not included in plain MetaPost that make it -convenient to do things that {\it pic} is good at. What follows -is a description of how to use the macros contained in the file \lit{boxes.mp}. -This may be of some interest to users who don't need these macros but want to -see additional examples of what can be done in MetaPost. - -The main idea is that one should say -$$ \lit{boxit} \descr{suffix}(\descr{picture expression}) $$ -in order to create pair variables $\descr{suffix}\lit{.c}$, -$\descr{suffix}\lit{.n}$, $\descr{suffix}\lit{.e}$, etc. These can then be -used for positioning the picture before drawing it with a separate command such -as -$$ \lit{drawboxed}(\descr{suffix}) $$ -The command \lit{boxit.bb(pic)} makes \lit{bb.c} the position where the center -of picture \lit{pic} is to be placed and defines \lit{bb.sw}, \lit{bb.se}, -\lit{bb.ne}, and \lit{bb.nw} to be the corners of a rectangular path that will -surround the resulting picture. Variables \lit{bb.dx} and \lit{bb.dy} give -the spacing between the shifted version of \lit{pic} and the surrounding -rectangle and \lit{bb.off} is the amount by which \lit{pic} has to be shifted -to achieve all this. - -The \lit{boxit} macro gives linear equations that force \lit{bb.sw}, -\lit{bb.se}, $\ldots$ to be the corners of a rectangle aligned on the $x$ and -$y$ axes with the picture \lit{pic} centered inside. The values of \lit{bb.dx}, -\lit{bb.dy}, and \lit{bb.c} are left unspecified so that the user can give -equations for positioning the boxes. If no such equations are given, macros -such as \lit{drawbox} can detect this and give default values.\vadjust{\okbreak} -$$ \includegraphics{examples-6} $$ - -\okbreak - -The following example shows how this works in practice. -$$ \startverbatim -input boxes -beginfig(7); boxjoin(a.se=b.sw; a.ne=b.nw); -boxit.a(btex $\cdots$ etex); boxit.ni(btex $n_i$ etex); -boxit.di(btex $d_i$ etex); boxit.nii(btex $n_{i+1}$ etex); -boxit.dii(btex $d_{i+1}$ etex); boxit.aa(pic_.a); -boxit.nk(btex $n_k$ etex); boxit.dk(btex $d_k$ etex); -di.dy = 2; -drawboxed(a,ni,di,nii,dii,aa,nk,dk); label.lft("ndtable:", a.w); -boxjoin(a.sw=b.nw; a.se=b.ne); -interim defaultdy:=7; -boxit.ba(); boxit.bb(); boxit.bc(); -boxit.bd(btex $\vdots$ etex); boxit.be(); boxit.bf(); -bd.dx=8; ba.ne=a.sw-(15,10); -drawboxed(ba,bb,bc,bd,be,bf); label.lft("hashtab:",ba.w); -def ndblock suffix $ = - boxjoin(a.sw=b.nw; a.se=b.ne); - forsuffixes $$=$a,$b,$c: boxit$$(); ($$dx,$$dy)=(5.5,4); - endfor; enddef; -ndblock nda; ndblock ndb; ndblock ndc; -nda.a.c-bb.c = ndb.a.c-nda.c.c = (whatever,0); -xpart ndb.c.se = xpart ndc.a.ne = xpart di.c; -ndc.a.c - be.c = (whatever,0); -drawboxes(nda.a,nda.b,nda.c,ndb.a,ndb.b,ndb.c,ndc.a,ndc.b,ndc.c); -drawarrow bb.c .. nda.a.w; -drawarrow be.c .. ndc.a.w; -drawarrow nda.c.c .. ndb.a.w; -drawarrow nda.a.c{right}..{curl0}ni.c cutafter bpath ni; -drawarrow nda.b.c{right}..{curl0}di.c cutafter bpath di; -drawarrow ndc.a.c{right}..{curl0}nii.c cutafter bpath nii; -drawarrow ndc.b.c{right}..{curl0}dii.c cutafter bpath dii; -drawarrow ndb.a.c{right}..nk.c cutafter bpath nk; -drawarrow ndb.b.c{right}..dk.c cutafter bpath dk; -x.ptr=xpart aa.c; y.ptr=ypart ndc.a.ne; -drawarrow subpath (0,.7) of (z.ptr..{left}ndc.c.c); -label.rt(btex ndblock etex, z.ptr); endfig; -%stopverbatim -$$ -It is instructive to compare the MetaPost output below with the similar figure -in the {\it pic} manual \cite{ke:pic}.\vadjust{\okbreak} -$$ \includegraphics{examples-7} $$ - -The second line of input for the above figure contains -$$ \lit{boxjoin(a.se=b.sw; a.ne=b.nw)} $$ -This causes boxes to line up horizontally by giving additional equations that -are invoked each time some box \lit{a} is followed by some other box~\lit{b}. -These equations are first invoked on the next line when box~\lit{a} is followed -by box~\lit{ni}. This yields -$$ \lit{a.se=ni.sw; a.ne=ni.nw} $$ -The next pair of boxes is box~\lit{ni} and box~\lit{di}. This time the -implicitly generated equations are -$$ \lit{ni.se=di.sw; ni.ne=di.nw} $$ -This process continues until a new \lit{boxjoin} is given. In this case the -new declaration is -$$ \lit{boxjoin(a.sw=b.nw; a.se=b.ne)} $$ -which causes boxes to be stacked below each other. - -After calling \lit{boxit} for the first eight boxes \lit{a} through \lit{dk}, -the example gives the single equation $\lit{di.dy}=2$ followed by a call to -\lit{drawboxed} that draws the eight boxes with the given text inside of them. -The equation forces there to be $2bp$ of space above and below the contents -of box~\lit{di} (the label ``$d_i$''). Since this doesn't fully specify the -sizes and positions of the boxes, the \lit{drawboxed} macro starts by -selecting default values, setting \lit{a.dx} through \lit{dk.dx} equal to -the default value of $3bp$. - -The argument to boxit can be omitted as in \lit{boxit.ba()} -or \lit{boxit.bb()}. This is like calling \lit{boxit} with an empty picture. -Alternatively the argument can be a string expression instead of a picture -expression in which case the string is typeset in the default font. - -In addition to the corner points \lit{a.sw}, \lit{a.se}, $\ldots$, a command -like \lit{boxit.a} defines points \lit{a.w}, \lit{a.s}, \lit{a.e} and -\lit{a.n} at the midpoints of the outer rectangle. -If this bounding rectangle is needed for something other than just being drawn -by the \lit{drawboxed} macro, it can be referred to as \lit{bpath.a} or in -general -$$ \lit{bpath} \descr{box name} $$ - -The \lit{bpath} macro is used in the arguments to \lit{drawarrow} in the -previous example. For instance -$$ \lit{nda.a.c\char`\{right\char`\}..\char`\{curl0\char`\}ni.c} $$ -is a path from the center of box \lit{nda.a} to the center of box \lit{ni}. -Following this with ``\lit{cutafter} \lit{bpath.ni}'' makes the arrow -go towards the center of the box but stop when it hits the outer rectangle. - -The next example also uses this technique of cutting connecting arrows when -they hit a bounding path, but in this case the bounding paths are circles -and ovals instead of rectangles. The circles and ovals are created by using -\lit{circleit} in place of \lit{boxit}. Saying \lit{circleit.a(pic)} -defines points \lit{a.c}, \lit{a.s}, \lit{a.e}, \lit{a.n}, \lit{a.w} -and distances \lit{a.dx} and \lit{a.dy}. These variables describe how the -picture is centered in an oval as can be seen from the following -diagram:\vadjust{\okbreak} -$$ \includegraphics{examples-8} $$ - -\okbreak - -Here is the input for the figure that uses \lit{circleit}: -$$\startverbatim -beginfig(9); -vardef cuta(suffix a,b) expr p = - drawarrow p cutbefore bpath.a cutafter bpath.b; - point .5*length p of p -enddef; -vardef self@# expr p = - cuta(@#,@#) @#.c{curl0}..@#.c+p..{curl0}@#.c enddef; -verbatimtex - \def\stk#1#2{$\displaystyle{\matrix{#1\cr#2\cr}}$} etex -circleit.aa("Start"); aa.dx=aa.dy; -circleit.bb(btex \stk B{(a|b)^*a} etex); -circleit.cc(btex \stk C{b^*} etex); -circleit.dd(btex \stk D{(a|b)^*ab} etex); -circleit.ee("Stop"); ee.dx=ee.dy; -numeric hsep; -bb.c-aa.c = dd.c-bb.c = ee.c-dd.c = (hsep,0); -cc.c-bb.c = (0,.8hsep); -xpart(ee.e - aa.w) = 3.8in; -drawboxed(aa,bb,cc,dd,ee); -label.ulft(btex$b$etex, cuta(aa,cc) aa.c{dir50}..cc.c); -label.top(btex$b$etex, self.cc(0,30pt)); -label.rt(btex$a$etex, cuta(cc,bb) cc.c..bb.c); -label.top(btex$a$etex, cuta(aa,bb) aa.c..bb.c); -label.llft(btex$a$etex, self.bb(-20pt,-35pt)); -label.top(btex$b$etex, cuta(bb,dd) bb.c..dd.c); -label.top(btex$b$etex, cuta(dd,ee) dd.c..ee.c); -label.lrt(btex$a$etex, cuta(dd,bb) dd.c..{dir140}bb.c); -label.bot(btex$a$etex, - cuta(ee,bb) ee.c..tension1.3 ..{dir115}bb.c); -label.urt(btex$b$etex, - cuta(ee,cc) ee.c{(cc.c-ee.c)rotated-15}..cc.c); -endfig; -%stopverbatim -$$ -The ``boxes'' produced when using \lit{circleit} come out circular unless -something forces a different aspect ratio.\vadjust{\okbreak} -$$ \includegraphics{examples-9} $$ - -In the above figure, the equations \lit{aa.dx=aa.dy} and \lit{ee.dx=ee.dy} after -$$ \lit{circleit.aa("Start")} - \quad{\rm and}\quad \lit{circleit.ee("Stop")} -$$ -make the start and stop nodes non-circular. - -The general rule is that $\lit{bpath.}c$ comes out circular if -$c\lit{.dx}$, $c\lit{.dy}$, and $c\lit{.dx}-c\lit{.dy}$ are all unspecified. -Otherwise the macros select an oval just big enough to contain the given -picture. (The margin of safety is given by the internal parameter -\lit{circmargin}). - -There is also a \lit{pic} macro that makes $\lit{pic.}c$ the picture that -goes inside $\lit{bpath.}c$ In addition to the \lit{drawboxed} macro -that draws the picture and the surrounding rectangle or oval, there are -\lit{drawunboxed} and \lit{drawboxes} macros that draw the pictures and -the surrounding paths separately. - -\section{Implementation} -\label{impsec} - -The MetaPost interpreter is written in Knuth's {\tt WEB} language which -can be thought of as PASCAL with macros. This choice allows the -sharing of code with the \MF\ interpreter.~\cite{kn:d} Indeed, about -three fourths of the code in the main source file {\tt mp.web} is copied -from this source by permission from the author. - -In accordance with the standard methodology for {\tt WEB} programs, -parts of the program that are specific to the UNIX\footnote{UNIX is a -registered trademark of UNIX System Laboratories.} system are given in a -separate file {\tt mp.ch} that -the {\tt tangle} processor merges with {\tt mp.web} to form a PASCAL -program. (It is then automatically translated into C using a -special-purpose translator that is included with the UNIX version -of \TeX.) The only other code required by the MetaPost interpreter -is a short external C program {\tt mpext.c} and a small include file -{\tt mp.h} to tie it all together. - -In addition to the main interpreter, there are some programs that control -the translation of typesetting commands in \lit{btex} $\ldots$ \lit{etex} -blocks. When the interpreter encounters \lit{btex} in some input file -\lit{foo.mp}, it needs to start reading from an auxiliary file \lit{foo.mpx}. -This file should contain translations of the \lit{btex} $\ldots$ \lit{etex} -blocks in \lit{foo.mp} into low-level MetaPost commands. If \lit{foo.mpx} is -out of date or does not exist, the MetaPost interpreter invokes a shell script -that generates the file. - -The generation of an auxiliary file \lit{foo.mpx} from an input file -\lit{foo.mp} is a three step process: a C~program called \lit{mptotex} -strips out the \TeX\ commands; then \TeX\ produces a binary file that -gives low-level typesetting instructions; and finally, a {\tt WEB} program -\lit{dvitomp} writes equivalent MetaPost commands in the \lit{foo.mpx} -file. When using troff, C~programs \lit{mptotr} and \lit{dmp} replace -\lit{mptotex} and \lit{dvitomp}. - - - -\bibliographystyle{plain} -\bibliography{mpintro} - - -\end{document} diff --git a/Master/texmf-dist/doc/metapost/base/source-manual/mpman-app-refman.tex b/Master/texmf-dist/doc/metapost/base/source-manual/mpman-app-refman.tex index 4974fdb597f..aefa619a46b 100644 --- a/Master/texmf-dist/doc/metapost/base/source-manual/mpman-app-refman.tex +++ b/Master/texmf-dist/doc/metapost/base/source-manual/mpman-app-refman.tex @@ -1,4 +1,4 @@ -\svnInfo $Id: mpman-app-refman.tex 1072 2009-06-01 16:18:44Z stephanhennig $ +\svnInfo $Id: mpman-app-refman.tex 1128 2009-12-22 08:52:28Z taco $ \section{Reference Manual} \label{refman} @@ -864,7 +864,7 @@ Here's a summary of the command-line switches understood by \texttt{$\descr{jobname}$.fls}\index{fls file?{\tt fls} file}\index{files!fls?{\tt fls}}. (This functionality is provided by \textit{kpathsea}.)\\ - \cmdindex{-s}$\descr{key}$=$\descr{value}$ \textrm{or}\newline + \cmdindex{-s}=$\descr{key}$=$\descr{value}$ \textrm{or}\newline -s $\descr{key}$=$\descr{value}$ & Set internal variable $\descr{key}$ to $\descr{value}$. The assignment is applied just before the input file is read-in. This @@ -872,7 +872,7 @@ Here's a summary of the command-line switches understood by $\descr{value}$ can be an integer between -16383 and 16383 or a string in double quotes. For strings, double quotes are stripped, but no other processing takes place.\newline - Example: \verb|-soutputformat="svg" -sprologues=3|\newline + Example: \verb|-s=outputformat="svg" -s=prologues=3|\newline Use SVG backend converting font shapes to paths.\\ \cmdindex{-tex}=$\descr{texprogram}$ & Load format $\descr{texprogram}$ for rendering \TeX\ material.\\ diff --git a/Master/texmf-dist/doc/metapost/base/source-manual/mpman-optab.tex b/Master/texmf-dist/doc/metapost/base/source-manual/mpman-optab.tex deleted file mode 100644 index bd0a2868ea5..00000000000 --- a/Master/texmf-dist/doc/metapost/base/source-manual/mpman-optab.tex +++ /dev/null @@ -1,147 +0,0 @@ -%%% Two notes on column specification: -%%% (i) Column widths are manually chosen as small as possible to allow -%%% for a wider last X column. -%%% (ii) In the first column \linepenalty=100 prefers shorter paragraphs -%%% (less lines), where plain \raggedright were indifferent and -%%% sometimes caused a dangling line, e.g., for 'directionpoint of' -%%% or 'directiontime of'. -\begin{longtable}{|>{\raggedright\linepenalty=100\ttfamily}p{.793in}*{3}{|>{\raggedright}p{.715in}}|>{\raggedleft}p{1.5em}|>{\raggedright\arraybackslash}X|} -\caption{\strut Operators}\label{optab}\\ -\hline -Name& \multicolumn3{c|}{Argument/result types}& \makebox[.2in][c]{Page}& Explanation\\\cline{2-4} -& \multicolumn1{c|}{Left}& \multicolumn1{c|}{Right}& \multicolumn1{c|}{Result}& & \\ -\hline -\hline -\endfirsthead -\caption[]{\strut Operators \emph{(continued)}}\\ -\hline -Name& \multicolumn3{c|}{Argument/result types}& \makebox[.2in][c]{Page}& Explanation\\\cline{2-4} -& \multicolumn1{c|}{Left}& \multicolumn1{c|}{Right}& \multicolumn1{c|}{Result}& & \\ -\hline -\hline -\endhead -\&\index{&?\texttt{\&}}& string\par path& string\par path & string\par path& \pageref{Damp}& Concatenation---works for paths $l\hbox{\tt\&}r$ if $r$ starts exactly where the $l$ ends\\\hline -*\index{*?\texttt{*}}& numeric& (cmyk)color\par numeric\par pair& (cmyk)color\par numeric\par pair& \pageref{Dmldiv}& Multiplication\\\hline -*\index{*?\texttt{*}}& (cmyk)color\par numeric\par pair& numeric& (cmyk)color\par numeric\par pair& \pageref{Dmldiv}& Multiplication\\\hline -**\index{**?\texttt{**}}& numeric& numeric& numeric& \pageref{Dpow}& Exponentiation\\\hline -+\index{+?\texttt{+}}& (cmyk)color\par numeric\par pair& (cmyk)color\par numeric\par pair& (cmyk)color\par numeric\par pair& \pageref{Dadd}& Addition\\\hline -++\index{++?\texttt{++}}& numeric& numeric& numeric& \pageref{Dpyadd}& Pythagorean addition $\sqrt{l^2+r^2}$\\\hline -+-+\index{+-+?\texttt{+-+}}& numeric& numeric& numeric& \pageref{Dpysub}& Pythagorean subtraction $\sqrt{l^2-r^2}$\\\hline --\index{-?\texttt{-}}& (cmyk)color\par numeric\par pair& (cmyk)color\par numeric\par pair& (cmyk)color\par numeric\par pair& \pageref{Dadd}& Subtraction\\\hline --\index{-?\texttt{-}}& --& (cmyk)color\par numeric\par pair& (cmyk)color\par numeric\par pair& \pageref{Dneg}& Negation\\\hline -/\index{/?\texttt{/}}& (cmyk)color\par numeric\par pair& numeric& (cmyk)color\par numeric\par pair& \pageref{Dmldiv}& Division\\\hline -<\index{\index{>?\texttt{>}}\par <=\index{<=?\texttt{<=}} >=\index{>=?\texttt{>=}}\par <>\index{<>?\texttt{<>}}& string\par numeric\par pair\par (cmyk)color\par transform& string\par numeric\par pair\par (cmyk)color\par transform& boolean& \pageref{Dcmpar}& Comparison operators\\\hline -\pl abs\index{abs?\texttt{abs}}& --& numeric\par pair& numeric& \pageref{Dabs}& Absolute value\par Euclidean length $\sqrt{(\mbox{\ttfamily xpart\ } r)^2+(\mbox{\ttfamily ypart\ } r)^2}$\\\hline -and\index{and?\texttt{and}}& boolean& boolean& boolean& \pageref{Dand}& Logical and\\\hline -angle\index{angle?\texttt{angle}}& --& pair& numeric& \pageref{Dangle}& 2$-$argument arctangent (in degrees)\\\hline -arclength\index{arclength?\texttt{arclength}}& --& path& numeric& \pageref{Darclng}& Arc length of a path\\\hline -arctime of\index{arctime of?\texttt{arctime of}}& numeric& path& numeric& \pageref{Darctim}& Time on a path where arc length from the start reaches a given value\\\hline -ASCII\index{ASCII?\texttt{ASCII}}& --& string& numeric& --& ASCII value of first character in string\\\hline -\pl bbox\index{bbox?\texttt{bbox}}& --& picture\par path\par pen& path& \pageref{Dbbox}& A rectangular path for the bounding box\\\hline -blackpart\index{blackpart?\texttt{blackpart}}& --& cmykcolor& numeric& \pageref{Dcmykprt}& Extract the fourth component\\\hline -bluepart\index{bluepart?\texttt{bluepart}}& --& color& numeric& \pageref{Drgbprt}& Extract the third component\\\hline -boolean\index{boolean?\texttt{boolean}}& --& any& boolean& \pageref{Dboolop}& Is the expression of type boolean?\\\hline -\pl bot\index{bot?\texttt{bot}}& --& numeric\par pair& numeric\par pair& \pageref{Dbot}& Bottom of current pen when centered at the given coordinate(s)\\\hline -bounded\index{bounded?\texttt{bounded}}& --& any& boolean& \pageref{Dbounded}& Is argument a picture with a bounding box?\\\hline -\pl ceiling\index{ceiling?\texttt{ceiling}}& --& numeric& numeric& \pageref{Dceil}& Least integer greater than or equal to\\\hline -\pl center\index{center?\texttt{center}}& --& picture\par path\par pen& pair& \pageref{Dcenter}& Center of the bounding box\\\hline -char\index{char?\texttt{char}}& --& numeric& string& \pageref{Dchar}& Character with a given ASCII code\\\hline -clipped\index{clipped?\texttt{clipped}}& --& any& boolean& \pageref{Dclipped}& Is argument a clipped picture?\\\hline -cmykcolor\index{cmykcolor?\texttt{cmykcolor}}& --& any& boolean& \pageref{Dccolrop}& Is the expression of type cmykcolor?\\\hline -color\index{color?\texttt{color}}& --& any& boolean& \pageref{Dcolrop}& Is the expression of type color?\\\hline -colormodel\index{colormodel?\texttt{colormodel}}& --& image object& numeric& \pageref{Dcolormodel}& What is the color model of the image object?\\\hline -\pl colorpart\index{colorpart?\texttt{colorpart}}& --& image object& -(cmyk)color\par numeric\par boolean& \pageref{Dcolorpart}& What is the -color of the image object?\\\hline -cosd\index{cosd?\texttt{cosd}}& --& numeric& numeric& \pageref{Dcosd}& Cosine of angle in degrees\\\hline -\pl cutafter\index{cutafter?\texttt{cutafter}}& path& path& path& \pageref{Dcuta}& Left argument with part after the intersection dropped\\\hline -\pl cutbefore\index{cutbefore?\texttt{cutbefore}}& path& path& path& \pageref{Dcutb}& Left argument with part before the intersection dropped\\\hline -cyanpart\index{cyanpart?\texttt{cyanpart}}& --& cmykcolor& numeric& \pageref{Dcmykprt}& Extract the first component\\\hline -cycle\index{cycle?\texttt{cycle}}& --& path& boolean& \pageref{Dcycop}& Determines whether a path is cyclic\\\hline -dashpart\index{dashpart?\texttt{dashpart}}& --& picture& picture& \pageref{Ddashpart}& Dash pattern of a path in a stroked picture\\\hline -decimal\index{decimal?\texttt{decimal}}& --& numeric& string& \pageref{Ddecop}& The decimal representation\\\hline -\pl dir\index{dir?\texttt{dir}}& --& numeric& pair& \pageref{Ddirop}& $(\cos\theta,\sin\theta)$ given $\theta$ in degrees\\\hline -\pl direction of\index{direction of?\texttt{direction of}}& numeric& path& pair& \pageref{Ddirof}& The direction of a path at a given `time'\\\hline -\pl direction\-point of\index{directionpoint of?\texttt{directionpoint of}}& pair& path& numeric& \pageref{Ddpntof}& Point where a path has a given direction\\\hline -direction\-time of\index{directiontime of?\texttt{directiontime of}}& pair& path& numeric& \pageref{Ddtimof}& `Time' when a path has a given direction\\\hline -\pl div\index{div?\texttt{div}}& numeric& numeric& numeric& --& Integer division $\lfloor l/r\rfloor$\\\hline -\pl dotprod\index{dotprod?\texttt{dotprod}}& pair& pair& numeric& \pageref{Ddprod}& vector dot product\\\hline -filled\index{filled?\texttt{filled}}& --& any& boolean& \pageref{Dfilled}& Is argument a filled outline?\\\hline -floor\index{floor?\texttt{floor}}& --& numeric& numeric& \pageref{Dfloor}& Greatest integer less than or equal to\\\hline -fontpart\index{fontpart?\texttt{fontpart}}& --& picture& string& \pageref{Dfontpart}& Font of a textual picture component\\\hline -fontsize\index{fontsize?\texttt{fontsize}}& --& string& numeric& \pageref{Dfntsiz}& The point size of a font\\\hline -greenpart\index{greenpart?\texttt{greenpart}}& --& color& numeric& \pageref{Drgbprt}& Extract the second component\\\hline -greypart\index{greypart?\texttt{greypart}}& --& numeric& numeric& \pageref{Dgreyprt}& Extract the first (only) component\\\hline -hex\index{hex?\texttt{hex}}& --& string& numeric& --& Interpret as a hexadecimal number\\\hline -infont\index{infont?\texttt{infont}}& string& string& picture& \pageref{Sinfont}& Typeset string in given font\\\hline -\pl intersec\-tionpoint\index{intersectionpoint?\texttt{intersectionpoint}}& path& path& pair& \pageref{Disecpt}& An intersection point\\\hline -intersec\-tiontimes\index{intersectiontimes?\texttt{intersectiontimes}}& path& path& pair& \pageref{Disectt}& Times ($t_l,t_r)$ on paths $l$ and $r$ when the paths intersect\\\hline -\pl inverse\index{inverse?\texttt{inverse}}& --& transform& transform& \pageref{Dinv}& Invert a transformation\\\hline -known\index{known?\texttt{known}}& --& any& boolean& \pageref{Dknown}& Does argument have a known value?\\\hline -length\index{length?\texttt{length}}& --& path\par string\par picture& numeric& \pageref{Dlength}\par \pageref{DlengthString}\par \pageref{DlengthPicture}& Number of components (arcs, characters, strokes, \ldots) in the argument\\\hline -\pl lft\index{lft?\texttt{lft}}& --& numeric\par pair& numeric\par pair& \pageref{Dlft}& Left side of current pen when its center is at the given coordinate(s)\\\hline -llcorner\index{llcorner?\texttt{llcorner}}& --& picture\par path\par pen& pair& \pageref{Dcornop}& Lower-left corner of bounding box\\\hline -lrcorner\index{lrcorner?\texttt{lrcorner}}& --& picture\par path\par pen& pair& \pageref{Dcornop}& Lower-right corner of bounding box\\\hline -magentapart\index{magentapart?\texttt{magentapart}}& --& cmykcolor& numeric& \pageref{Dcmykprt}& Extract the second component\\\hline -makepath\index{makepath?\texttt{makepath}}& --& pen& path& \pageref{Dmkpath}& Cyclic path bounding the pen shape\\\hline -makepen\index{makepen?\texttt{makepen}}& --& path& pen& \pageref{Dmkpen}& A polygonal pen made from the convex hull of the path knots\\\hline -mexp\index{mexp?\texttt{mexp}}& --& numeric& numeric& --& The function $\exp(x/256)$\\\hline -mlog\index{mlog?\texttt{mlog}}& --& numeric& numeric& --& The function $256\ln(x)$\\\hline -\pl mod\index{mod?\texttt{mod}}& --& numeric& numeric& --& The remainder function $l-r\lfloor l/r\rfloor$\\\hline -normal\-deviate\index{normaldeviate?\texttt{normaldeviate}}& --& --& numeric& --& Choose a random number with mean~0 and standard deviation~1\\\hline -not\index{not?\texttt{not}}& --& boolean& boolean& \pageref{Dnot}& Logical negation\\\hline -numeric\index{numeric?\texttt{numeric}}& --& any& boolean& \pageref{Dnumop}& Is the expression of type numeric?\\\hline -oct\index{oct?\texttt{oct}}& --& string& numeric& --& Interpret string as octal number\\\hline -odd\index{odd?\texttt{odd}}& --& numeric& boolean& --& Is the closest integer odd or even?\\\hline -or\index{or?\texttt{or}}& boolean& boolean& boolean& \pageref{Dor}& Logical inclusive or\\\hline -pair\index{pair?\texttt{pair}}& --& any& boolean& \pageref{Dpairop}& Is the expression of type pair?\\\hline -path\index{path?\texttt{path}}& --& any& boolean& \pageref{Dpathop}& Is the expression of type path?\\\hline -pathpart\index{pathpart?\texttt{pathpart}}& --& picture& path& \pageref{Dpathpart}& Path of a stroked picture component\\\hline -pen\index{pen?\texttt{pen}}& --& any& boolean& \pageref{Dpenop}& Is the expression of type pen?\\\hline -penoffset of\index{penoffset of?\texttt{penoffset of}}& pair& pen& pair& --& Point on the pen furthest to the right of the given direction\\\hline -penpart\index{penpart?\texttt{penpart}}& --& picture& pen& \pageref{Dpenpart}& Pen of a stroked picture component\\\hline -picture\index{picture?\texttt{picture}}& --& any& boolean& \pageref{Dpictop}& Is the expression of type picture?\\\hline -point of\index{point of?\texttt{point of}}& numeric& path& pair& \pageref{Dpntof}& Point on a path given a time value\\\hline -postcontrol of\index{postcontrol?\texttt{postcontrol}}& numeric& path& pair& --& First B\'ezier control point on path segment starting at the given time\\\hline -precontrol of\index{precontrol?\texttt{precontrol}}& numeric& path& pair& --& Last B\'ezier control point on path segment ending at the given time\\\hline -readfrom\index{readfrom?\texttt{readfrom}}& --& string& string& \pageref{Dreadfrom}& Read a line from file\\\hline -redpart\index{redpart?\texttt{redpart}}& --& color& numeric& \pageref{Drgbprt}& Extract the first component\\\hline -reverse\index{reverse?\texttt{reverse}}& --& path& path& \pageref{Drevrse}& `time'-reversed path, beginning swapped with ending\\\hline -rgbcolor\index{rgbcolor?\texttt{rgbcolor}}& --& any& boolean& \pageref{Drcolrop}& Is the expression of type color?\\\hline -rotated\index{rotated?\texttt{rotated}}& picture\par path\par pair\par pen\par transform& numeric& picture\par path\par pair\par pen\par transform& \pageref{Dtranop}& Rotate counterclockwise a given number of degrees\\\hline -\pl round\index{round?\texttt{round}}& --& numeric\par pair& numeric\par pair& \pageref{Dround}& round each component to the nearest integer\\\hline -\pl rt\index{rt?\texttt{rt}}& --& numeric\par pair& numeric\par pair& \pageref{Drt}& Right side of current pen when centered at given coordinate(s)\\\hline -scaled\index{scaled?\texttt{scaled}}& picture\par path\par pair\par pen\par transform& numeric& picture\par path\par pair\par pen\par transform& \pageref{Dtranop}& Scale all coordinates by the given amount\\\hline -scantokens\index{scantokens?\texttt{scantokens}}& --& string& token sequence& \pageref{Dscantokens}& Converts a string to a token or token sequence. Provides string to numeric conversion, etc.\\\hline -shifted\index{shifted?\texttt{shifted}}& picture\par path\par pair\par pen\par transform& pair& picture\par path\par pair\par pen\par transform& \pageref{Dtranop}& Add the given shift amount to each pair of coordinates\\\hline -sind\index{sind?\texttt{sind}}& --& numeric& numeric& \pageref{Dsind}& Sine of an angle in degrees\\\hline -slanted\index{slanted?\texttt{slanted}}& picture\par path\par pair\par pen\par transform& numeric& picture\par path\par pair\par pen\par transform& \pageref{Dtranop}& Apply the slanting transformation that maps $(x,y)$ into $(x+sy,y)$, where~$s$ is the numeric argument\\\hline -sqrt\index{sqrt?\texttt{sqrt}}& --& numeric& numeric& \pageref{Dsqrt}& Square root\\\hline -str\index{str?\texttt{str}}& --& suffix& string& \pageref{Dstr}& String representation for a suffix\\\hline -string\index{string?\texttt{string}}& --& any& boolean& \pageref{Dstrgop}& Is the expression of type string?\\\hline -stroked\index{stroked?\texttt{stroked}}& --& any& boolean& \pageref{Dstroked}& Is argument a stroked line?\\\hline -subpath of\index{subpath?\texttt{subpath}}& pair& path& path& \pageref{Dsubpth}& Portion of a path for given range of time values\\\hline -substring of\index{substring -of?\texttt{substring of}}& pair& string& string& \pageref{Dsubstr}& Substring bounded by given indices\\\hline -textpart\index{textpart?\texttt{textpart}}& --& picture& string& \pageref{Dtextpart}& Text of a textual picture component\\\hline -textual\index{textual?\texttt{textual}}& --& any& boolean& \pageref{Dtextual}& Is argument typeset text?\\\hline -\pl top\index{top?\texttt{top}}& --& numeric\par pair& numeric\par pair& \pageref{Dtop}& Top of current pen when centered at the given coordinate(s)\\\hline -transform\index{transform?\texttt{transform}}& --& any& boolean& \pageref{Dtrnfop}& Is the argument of type transform?\\\hline -transformed\index{transformed?\texttt{transformed}}& picture\par path\par pair\par pen\par transform& transform& picture\par path\par pair\par pen\par transform& \pageref{Dtrfrmd}& Apply the given transform to all coordinates\\\hline -ulcorner\index{ulcorner?\texttt{ulcorner}}& --& picture\par path\par pen& pair& \pageref{Dcornop}& Upper-left corner of bounding box\\\hline -uniform\-deviate\index{uniformdeviate?\texttt{uniformdeviate}}& --& numeric& numeric& --& Random number between zero and the value of the argument\\\hline -\pl unitvector\index{unitvector?\texttt{unitvector}}& --& pair& pair& \pageref{Duvec}& Rescale a vector so its length is~1\\\hline -unknown\index{unknown?\texttt{unknown}}& --& any& boolean& \pageref{Dunknwn}& Is the value unknown?\\\hline -urcorner\index{urcorner?\texttt{urcorner}}& --& picture\par path\par pen& pair& \pageref{Dcornop}& Upper-right corner of bounding box\\\hline -\pl whatever\index{whatever?\texttt{whatever}}& --& --& numeric& \pageref{Dwhatev}& Create a new anonymous unknown\\\hline -xpart\index{xpart?\texttt{xpart}}& --& pair\par transform& number& \pageref{Dxprt}& $x$ or $t_x$ component\\\hline -xscaled\index{xscaled?\texttt{xscaled}}& picture\par path\par pair\par pen\par transform& numeric& picture\par path\par pair\par pen\par transform& \pageref{Dtranop}& Scale all $x$ coordinates by the given amount\\\hline -xxpart\index{xxpart?\texttt{xxpart}}& --& transform& number& \pageref{Dtrprt}& $t_{xx}$ entry in transformation matrix\\\hline -xypart\index{xypart?\texttt{xypart}}& --& transform& number& \pageref{Dtrprt}& $t_{xy}$ entry in transformation matrix\\\hline -yellowpart\index{yellowpart?\texttt{yellowpart}}& --& cmykcolor& numeric& \pageref{Dcmykprt}& Extract the third component\\\hline -ypart\index{ypart?\texttt{ypart}}& --& pair\par transform& number& \pageref{Dyprt}& $y$ or $t_y$ component\\\hline -yscaled\index{yscaled?\texttt{yscaled}}& picture\par path\par pair\par pen\par transform& numeric& picture\par path\par pair\par pen\par transform& \pageref{Dtranop}& Scale all $y$ coordinates by the given amount\\\hline -yxpart\index{yxpart?\texttt{yxpart}}& --& transform& number& \pageref{Dtrprt}& $t_{yx}$ entry in transformation matrix\\\hline -yypart\index{yypart?\texttt{yypart}}& --& transform& number& \pageref{Dtrprt}& $t_{yy}$ entry in transformation matrix\\\hline -zscaled\index{zscaled?\texttt{zscaled}}& picture\par path\par pair\par pen\par transform& pair& picture\par path\par pair\par pen\par transform& \pageref{Dtranop}& Rotate and scale all coordinates so that $(1,0)$ is mapped into the given pair; i.e., do complex multiplication.\\\hline -\end{longtable} diff --git a/Master/texmf-dist/doc/metapost/base/source-manual/mpman.tex b/Master/texmf-dist/doc/metapost/base/source-manual/mpman.tex index dc13442ac28..c4a38d43a2c 100644 --- a/Master/texmf-dist/doc/metapost/base/source-manual/mpman.tex +++ b/Master/texmf-dist/doc/metapost/base/source-manual/mpman.tex @@ -1,4 +1,4 @@ -% $Id: mpman.tex 1118 2009-10-02 08:23:52Z taco $ +% $Id: mpman.tex 1219 2010-04-01 09:05:51Z taco $ % MetaPost manual, by John Hobby. License at end. \listfiles \RequirePackage{ifpdf} @@ -12,8 +12,8 @@ \fi \documentclass{article} % article is NOT the original style \usepackage[nofancy]{svninfo}% Access VCS information. -\svnInfo $Id: mpman.tex 1118 2009-10-02 08:23:52Z taco $ -\newcommand*{\mpversion}{1.208} +\svnInfo $Id: mpman.tex 1219 2010-04-01 09:05:51Z taco $ +\newcommand*{\mpversion}{1.211} \usepackage[T1]{fontenc} \usepackage{lmodern} diff --git a/Master/texmf-dist/doc/metapost/base/source-tutorial/mpintro.ltx b/Master/texmf-dist/doc/metapost/base/source-tutorial/mpintro.ltx index 223487790d8..f988b0ca9e7 100644 --- a/Master/texmf-dist/doc/metapost/base/source-tutorial/mpintro.ltx +++ b/Master/texmf-dist/doc/metapost/base/source-tutorial/mpintro.ltx @@ -60,6 +60,7 @@ \usepackage{hyperxmp} \usepackage{hyperref} \hypersetup{ + pdfencoding=unicode, pdfstartview=FitH, pdfpagemode=UseNone, colorlinks=true, -- cgit v1.2.3