diff options
author | Taco Hoekwater <taco@elvenkind.com> | 2007-11-28 22:38:47 +0000 |
---|---|---|
committer | Taco Hoekwater <taco@elvenkind.com> | 2007-11-28 22:38:47 +0000 |
commit | 068f23e738bb4d158c6e5986cb24ea6bddcee0eb (patch) | |
tree | bde51f1a1de612c002e6d9eaac407fd789ea9a1f | |
parent | efd2ea1905cc57421e4d5b3123797164601993a4 (diff) |
MetaPost version 1.002
git-svn-id: svn://tug.org/texlive/trunk@5639 c570f23f-e606-0410-a88d-b1316a301751
27 files changed, 1268 insertions, 959 deletions
diff --git a/Build/source/texk/web2c/dvitomp.ch b/Build/source/texk/web2c/dvitomp.ch index c30adbbaeca..ca7eac60830 100644 --- a/Build/source/texk/web2c/dvitomp.ch +++ b/Build/source/texk/web2c/dvitomp.ch @@ -26,12 +26,12 @@ @z @x [1] Duplicate banner line for use in |print_version_and_exit|. -@d banner=='% Written by DVItoMP, Version 0.992' +@d banner=='% Written by DVItoMP, Version 1.002' {the first line of the output file} @y -@d banner=='% Written by DVItoMP, Version 0.992/color' +@d banner=='% Written by DVItoMP, Version 1.002/color' {the first line of the output file} -@d term_banner=='This is DVItoMP, Version 0.992/color' +@d term_banner=='This is DVItoMP, Version 1.002/color' {the same in the usual format, as it would be shown on a terminal} @z @@ -442,7 +442,7 @@ begin usage_help (DVITOMP_HELP, nil); end else if argument_is ('version') then begin - print_version_and_exit (term_banner, 'AT&T Bell Laboraties', 'John Hobby.', nil); + print_version_and_exit (term_banner, 'AT&T Bell Laboraties', 'John Hobby.'); end; {Else it was a flag; |getopt| has already done the assignment.} until getopt_return_val = -1; diff --git a/Build/source/texk/web2c/dvitomp.web b/Build/source/texk/web2c/dvitomp.web index 01c76c6b72a..85b4dfc732c 100644 --- a/Build/source/texk/web2c/dvitomp.web +++ b/Build/source/texk/web2c/dvitomp.web @@ -65,7 +65,7 @@ an ``\.{MPX}'' file. The |banner| string defined here should be changed whenever \.{DVItoMP} gets modified. -@d banner=='% Written by DVItoMP, Version 0.992' +@d banner=='% Written by DVItoMP, Version 1.002' {the first line of the output file} @ This program is written in standard \PASCAL, except where it is necessary diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c index 8a2cc4896d9..b33882f7c5a 100644 --- a/Build/source/texk/web2c/lib/texmfmp.c +++ b/Build/source/texk/web2c/lib/texmfmp.c @@ -88,9 +88,9 @@ #define edit_var "MFEDIT" #endif /* MF */ #ifdef MP -#define BANNER "This is MetaPost, Version 0.993" +#define BANNER "This is MetaPost, Version 1.002" #define COPYRIGHT_HOLDER "AT&T Bell Laboratories" -#define AUTHOR "John Hobby" +#define AUTHOR "John Hobby.\nCurrent maintainer of MetaPost: Taco Hoekwater" #define PROGRAM_HELP MPHELP #define BUG_ADDRESS "tex-k@mail.tug.org" #define DUMP_VAR MPmemdefault diff --git a/Build/source/texk/web2c/metapost.mk b/Build/source/texk/web2c/metapost.mk index 0f3b9f164f1..da28a13ca49 100644 --- a/Build/source/texk/web2c/metapost.mk +++ b/Build/source/texk/web2c/metapost.mk @@ -1,5 +1,5 @@ # Makefile fragment for MetaPost. -# $Id: metapost.mk,v 1.2 2005/07/25 10:03:53 olaf Exp $ +# $Id: metapost.mk,v 1.15 2005/07/04 07:51:41 taco Exp $ # # Public domain. # @@ -20,21 +20,19 @@ mpware_sources = mpware/dmp.c mpware/makempx.in mpware/mpto.c mpware/newer.c mp_c = mpini.c mp0.c mp1.c mp2.c mp_o = mpini.o mp0.o mp1.o mp2.o mpextra.o loadpool.o -# this will break cross-compiles, but i dont know how to fix. -# -- Taco loadpool.c: mp.pool $(mpostdir)/makecpool - ./$(mpostdir)/makecpool mp.pool mpdir/mplib.h > loadpool.c - + $(native)/$(mpostdir)/makecpool mp.pool mpdir/mplib.h > loadpool.c +# mpostlibsdep also includes makecpool mpost: $(mp_o) $(mpostlibsdep) $(kpathsea_link) $(mp_o) $(mpostlibs) $(LOADLIBES) -$(mp_c) mpcoerce.h mpd.h: mp.p $(web2c_texmf) $(srcdir)/$(mpostdir)/mp.defines web2c/cvtmf1.sed web2c/cvtmf2.sed +$(mp_c) mpcoerce.h mpd.h: mp.p $(web2c_texmf) $(srcdir)/$(mpostdir)/mp.defines web2c/cvtmf1.sed web2c/cvtmf2.sed $(web2c) mp mpextra.c: lib/texmfmp.c sed s/TEX-OR-MF-OR-MP/mp/ $(srcdir)/lib/texmfmp.c >$@ -mp.p mp.pool: tangle mp.web mp.ch - $(tangle) mp.web mp.ch +mp.p mp.pool: tie tangle mp.web mp.ch + $(tangle) $(srcdir)/mp.web $(srcdir)/mp.ch check: mpost-check -mpost-check: mptrap mpost.mem $(mpware_programs) +mpost-check: mptrap mpost.mem $(mpware) ./mpost --progname=mpost '&./mpost \tracingstats:=1; end.' TEXMFCNF=../kpathsea \ MAKEMPX_BINDIR=`pwd`:`pwd`/mpware MPXCOMMAND=mpware/makempx \ @@ -96,9 +94,13 @@ mptrap-clean: # mpware # We put mpware (written directly in C) in a subdirectory. +$(mpware): $(mpware_programs) + $(mpware_programs): $(mpware_sources) - cd mpware && $(MAKE) $(common_makeargs) + cd $(mpware) && $(MAKE) $(common_makeargs) install-programs: install-mpware-programs install-mpware-programs: $(mpware_programs) cd $(mpware) && $(MAKE) $(install_makeargs) install-exec + +mp-programs: $(metapost) $(mpware) diff --git a/Build/source/texk/web2c/mp.web b/Build/source/texk/web2c/mp.web index 8f8ef7eb6c8..26dc205e7fa 100644 --- a/Build/source/texk/web2c/mp.web +++ b/Build/source/texk/web2c/mp.web @@ -97,8 +97,8 @@ undergoes any modifications, so that it will be clear which version of @^extensions to \MP@> @^system dependencies@> -@d banner=='This is MetaPost, Version 0.993' {printed when \MP\ starts} -@d metapost_version=="0.993" +@d banner=='This is MetaPost, Version 1.002' {printed when \MP\ starts} +@d metapost_version=="1.002" @ Different \PASCAL s have slightly different conventions, and the present @!@:PASCAL H}{\ph@> @@ -17088,10 +17088,7 @@ if p<>null then found:pict_length:=n; end; -@ The turning number is computed only with respect to a triangular pen whose -@:turning_number_}{\&{turningnumber} primitive@> -vertices are $(0,1)$ and $(\pm{1\over2},0)$. The choice of pen isn't supposed -to matter but rounding error could make a difference if the path has a cusp. +@ Implement |turningnumber| @<Additional cases of unary...@>= turning_op:if cur_type=pair_type then flush_cur_exp(0) @@ -17099,9 +17096,100 @@ turning_op:if cur_type=pair_type then flush_cur_exp(0) else if left_type(cur_exp)=endpoint then flush_cur_exp(0) {not a cyclic path} else begin - flush_cur_exp(turn_cycles(cur_exp)); + flush_cur_exp(turn_cycles_wrapper(cur_exp)); end; +@ The function |an_angle| returns the value of the |angle| primitive, or $0$ if the +argument is |origin|. + +@<Declare unary action...@>= +function an_angle (@!xpar,@!ypar:scaled):angle; +begin + if (not ((xpar=0) and (ypar=0))) then + an_angle := n_arg(xpar,ypar) + else + an_angle := 0; +end; + +@ The actual turning number is (for the moment) computed in a C function +that receives eight integers corresponding to the four controlling points, +and returns a single angle. Besides those, we have to account for discrete +moves at the actual points. + +@d p_nextnext==link(link(p)) +@d p_next==link(p) + +@d seven_twenty_deg==@'5500000000 {$720\cdot2^{20}$, represents $720^\circ$} + +@<Declare unary action...@>= +function new_turn_cycles (@!c:pointer):scaled; +label exit; +var @!res,ang:angle; { the angles of intermediate results } +@!turns:scaled; { the turn counter } +@!p:pointer; { for running around the path } +@!xp,yp:integer; { coordinates of next point } +@!x,y:integer; { helper coordinates } +@!in_angle,out_angle:angle; { helper angles} +@!old_setting:0..max_selector; {saved |selector| setting} +begin +res:=0; +turns:= 0; +p:=c; +old_setting := selector; selector:=term_only; +if internal[tracing_commands]>unity then begin + begin_diagnostic; + print_nl(""); + end_diagnostic(false); +end; +repeat + xp := x_coord(p_next); yp := y_coord(p_next); + ang := bezier_slope(x_coord(p), y_coord(p), right_x(p), right_y(p), + left_x(p_next), left_y(p_next), xp, yp, internal[tracing_commands]); + if ang>seven_twenty_deg then begin + print_err("Strange path"); + error; + new_turn_cycles := 0; + return; + end; + res := res + ang; + if res > one_eighty_deg then begin + res := res - three_sixty_deg; + turns := turns + unity; + end; + if res <= -one_eighty_deg then begin + res := res + three_sixty_deg; + turns := turns - unity; + end; + { incoming angle at next point } + x := left_x(p_next); y := left_y(p_next); + if (xp=x)and(yp=y) then begin x := right_x(p); y := right_y(p); end; + if (xp=x)and(yp=y) then begin x := x_coord(p); y := y_coord(p); end; + in_angle := an_angle(xp - x, yp - y); + { outgoing angle at next point } + x := right_x(p_next); y := right_y(p_next); + if (xp=x)and(yp=y) then begin x := left_x(p_nextnext); y := left_y(p_nextnext); end; + if (xp=x)and(yp=y) then begin x := x_coord(p_nextnext); y := y_coord(p_nextnext); end; + out_angle := an_angle(x - xp, y- yp); + ang := (out_angle - in_angle); + reduce_angle(ang); + if ang<>0 then begin + res := res + ang; + if res >= one_eighty_deg then begin + res := res - three_sixty_deg; + turns := turns + unity; + end; + if res <= -one_eighty_deg then begin + res := res + three_sixty_deg; + turns := turns - unity; + end; + end; + p := link(p); +until p=c; +new_turn_cycles := turns; +exit: +selector:=old_setting; +end; + @ This code is based on Bogus\l{}av Jackowski's |emergency_turningnumber| macro, with some minor changes by Taco @@ -17130,19 +17218,6 @@ the old code was not always correct either, and worse, it sometimes failed for w paths as well. All known bugs that were triggered by the original code no longer occur with this code, and it runs roughly 3 times as fast because the algorithm is much simpler. -@ The macro |Angle()| returns the value of the |angle| primitive, or $0$ if the argument is -|origin|. Converting that calling convention to web code gives the |an_angle| function. - -@<Declare unary action...@>= -function an_angle (@!xpar,@!ypar:scaled):angle; -begin - if (not ((xpar=0) and (ypar=0))) then - an_angle := n_arg(xpar,ypar) - else - an_angle := 0; -end; - - @ It is possible to overflow the return value of the |turn_cycles| function when the path is sufficiently long and winding, but I am not going to bother testing for that. In any case, it would only return @@ -17163,29 +17238,50 @@ var @!res,ang:angle; { the angles of intermediate results } @!turns:scaled; { the turn counter } @!p:pointer; { for running around the path } begin res:=0; turns:= 0; p:=c; -if ((link(p) = p) or (link(link(p)) = p)) then - if an_angle (x_coord(p) - right_x(p), y_coord(p) - right_y(p)) >= 0 then - turn_cycles := unity - else - turn_cycles := -unity -else begin - repeat - ang := an_angle (x_coord(p_to) - x_coord(p_here), y_coord(p_to) - y_coord(p_here)) - - an_angle (x_coord(p_here) - x_coord(p_from), y_coord(p_here) - y_coord(p_from)); - reduce_angle(ang); - res := res + ang; - if res >= three_sixty_deg then begin - res := res - three_sixty_deg; - turns := turns + unity; - end; - if res <= -three_sixty_deg then begin - res := res + three_sixty_deg; - turns := turns - unity; - end; - p := link(p); - until p=c; - turn_cycles := turns; +repeat + ang := an_angle (x_coord(p_to) - x_coord(p_here), y_coord(p_to) - y_coord(p_here)) + - an_angle (x_coord(p_here) - x_coord(p_from), y_coord(p_here) - y_coord(p_from)); + reduce_angle(ang); + res := res + ang; + if res >= three_sixty_deg then begin + res := res - three_sixty_deg; + turns := turns + unity; + end; + if res <= -three_sixty_deg then begin + res := res + three_sixty_deg; + turns := turns - unity; + end; + p := link(p); +until p=c; +turn_cycles := turns; end; + +@ @<Declare unary action...@>= +function turn_cycles_wrapper (@!c:pointer):scaled; + var nval,oval:scaled; + saved_t_o:scaled; {tracing\_online saved } +begin + if (link(c)=c)or(link(link(c))=c) then + if an_angle (x_coord(c) - right_x(c), y_coord(c) - right_y(c)) > 0 then + turn_cycles_wrapper := unity + else + turn_cycles_wrapper := -unity + else begin + nval := new_turn_cycles(c); + oval := turn_cycles(c); + if nval<>oval then begin + saved_t_o:=internal[tracing_online]; + internal[tracing_online]:=unity; + begin_diagnostic; + print_nl ("Warning: the turningnumber algorithms do not agree. The current computed value is "); + print_scaled(nval); + print(", but the 'connect-the-dots' algorithm returned "); + print_scaled(oval); + end_diagnostic(false); + internal[tracing_online]:=saved_t_o; + end; + turn_cycles_wrapper := nval; + end; end; @ @<Declare unary action...@>= @@ -21649,6 +21745,7 @@ This routine issues a warning message if the user has asked for it. procedure lost_warning(@!f:font_number;@!k:pool_pointer); begin if internal[tracing_lost_chars]>0 then begin begin_diagnostic; + if selector=log_only then incr(selector); print_nl("Missing character: There is no "); @.Missing character@> print(so(str_pool[k])); print(" in font "); @@ -21786,8 +21883,7 @@ function new_dummy_font: font_number; begin new_dummy_font := read_font_info("dummy"); end; - -@x +@# function round_xn_over_d(@!x:scaled; @!n,@!d:integer):scaled; var positive:boolean; {was |x>=0|?} @!t,@!u,@!v:nonnegative_integer; {intermediate quantities} @@ -22395,9 +22491,9 @@ begin (gs_colormodel<>cmyk_model) then begin if color_model(p)=uninitialized_model then begin - gs_red:=unity; - gs_green:=unity; - gs_blue:=unity; + gs_red:=0; + gs_green:=0; + gs_blue:=0; gs_black:=unity;@/ end else begin @@ -22649,14 +22745,14 @@ if internal[mpprocset]=0 then begin else begin if fill_also then print_nl("B") else print_ln; if (txy<>0)or(tyx<>0) then - begin {print_ln;} + begin print(" ["); ps_pair_out(txx,tyx); ps_pair_out(txy,tyy);@/ ps_print("0 0] t"); end else if (txx<>unity)or(tyy<>unity) then - begin {print_ln;} + begin ps_pair_out(txx,tyy); print(" s"); end; @@ -22673,7 +22769,7 @@ tyx:=left_y(p);@/ txy:=right_x(p); tyy:=right_y(p); if (x_coord(p)<>0)or(y_coord(p)<>0) then - begin print_ln; print_cmd("gsave ","q "); + begin print_nl(""); print_cmd("gsave ","q "); ps_pair_out(x_coord(p),y_coord(p)); ps_print("translate ");@/ txx:=txx-x_coord(p); @@ -23046,9 +23142,7 @@ end @ @<Print any pending specials@>= t:=link(spec_head); while t<>null do - begin if length(value(t))<=emergency_line_length then print(value(t)) - else overflow("output line length",emergency_line_length); -@:MetaPost capacity exceeded output line length}{\quad output line length@> + begin print(value(t)); print_ln; t:=link(t); end; @@ -23202,7 +23296,7 @@ begin end else begin begin_diagnostic; - {selector:=term_and_log;} + if selector=log_only then incr(selector); print_err("Warning: font "); print(font_name[f]); print(" cannot be found in any fontmapfile!"); @@ -23696,11 +23790,13 @@ if ldf<>null_font then begin end; end; if internal[mpprocset]>0 then begin + print_nl("%%BeginResource: procset mpost"); if (internal[prologues]>0)and(ldf<>null_font) then print("/bd{bind def}bind def/fshow {exch findfont exch scalefont setfont show}bd") else print_nl("/bd{bind def}bind def"); @<Print the procset@>; + print_nl("%%EndResource"); print_ln; end; end diff --git a/Build/source/texk/web2c/mpdir/Makefile.in b/Build/source/texk/web2c/mpdir/Makefile.in index c6abb102f2d..5b1cbc6893c 100644 --- a/Build/source/texk/web2c/mpdir/Makefile.in +++ b/Build/source/texk/web2c/mpdir/Makefile.in @@ -14,7 +14,7 @@ CXX = @CXX@ XCPPFLAGS=-I.. -I$(srcdir)/.. -I../.. -I$(srcdir)/../.. -OBJS = mapfile.o avl.o avlstuff.o utils.o writeenc.o writet1.o writefont.o +OBJS = mapfile.o avl.o avlstuff.o utils.o writeenc.o writet1.o writefont.o turningnumber.o all: libmpost.a makecpool @@ -34,7 +34,7 @@ clean:: depend: rm -f $(OBJS) XXCFLAGS=-MM XCFLAGS=-MM $(MAKE) -k $(OBJS) | \ - grep -v "^$(CC)\|$(CXX)\|$(AR)\|make\|klibtool" | \ + grep -v "^$(CC)\|$(CXX)\|$(AR)\|make" | \ sed 's: [^ ]*/\.\./libs/[^ ]*::g' > $(srcdir)/depend.mk kpse_include mpdir/depend.mk diff --git a/Build/source/texk/web2c/mpdir/mp.defines b/Build/source/texk/web2c/mpdir/mp.defines index 90f196b1ff5..7af554a389a 100644 --- a/Build/source/texk/web2c/mpdir/mp.defines +++ b/Build/source/texk/web2c/mpdir/mp.defines @@ -54,4 +54,4 @@ $Id$ { function from turningnumber.c } -@define function bezierslope();
\ No newline at end of file +@define function bezierslope(); diff --git a/Build/source/texk/web2c/mpdir/mplib.h b/Build/source/texk/web2c/mpdir/mplib.h index 363836a994d..232956dbff7 100644 --- a/Build/source/texk/web2c/mpdir/mplib.h +++ b/Build/source/texk/web2c/mpdir/mplib.h @@ -297,4 +297,8 @@ extern void writezip (boolean); extern void avlputobj (integer, integer); extern integer avlfindobj (integer, integer, integer); +/* turningnumber.c */ + +extern angle bezierslope(integer,integer,integer,integer,integer,integer,integer,integer,int); + #endif /* MPOSTLIB */ diff --git a/Build/source/texk/web2c/mpdir/turningnumber.c b/Build/source/texk/web2c/mpdir/turningnumber.c new file mode 100644 index 00000000000..bfb7d9133d2 --- /dev/null +++ b/Build/source/texk/web2c/mpdir/turningnumber.c @@ -0,0 +1,113 @@ +/* $Id$ */ + +#include "mplib.h" + +#define bezier_error (720<<20)+1 + +#define sign(v) ((v)>0 ? 1 : ((v)<0 ? -1 : 0 )) + +#define print_roots(a) { if (debuglevel>(65536*2)) \ + fprintf(stdout,"bezierslope(): %s, i=%f, o=%f, angle=%f\n", \ + (a),in,out,res); } + +#define out ((double)(xo>>20)) +#define mid ((double)(xm>>20)) +#define in ((double)(xi>>20)) + +#define divisor (256*256) + +#define double2angle(a) (int)floor(a*256.0*256.0*16.0) + +angle +bezierslope(integer AX,integer AY,integer BX,integer BY, + integer CX,integer CY,integer DX,integer DY, int debuglevel) { + double a, b, c; + integer deltax,deltay; + double ax,ay,bx,by,cx,cy,dx,dy; + + angle xi = 0, xo = 0, xm = 0; + double res = 0; + + ax=AX/divisor; ay=AY/divisor; + bx=BX/divisor; by=BY/divisor; + cx=CX/divisor; cy=CY/divisor; + dx=DX/divisor; dy=DY/divisor; + + deltax = (BX-AX); deltay = (BY-AY); + if (deltax==0 && deltay == 0) { deltax=(CX-AX); deltay=(CY-AY); } + if (deltax==0 && deltay == 0) { deltax=(DX-AX); deltay=(DY-AY); } + xi = anangle(deltax,deltay); + + deltax = (CX-BX); deltay = (CY-BY); + xm = anangle(deltax,deltay); + + deltax = (DX-CX); deltay = (DY-CY); + if (deltax==0 && deltay == 0) { deltax=(DX-BX); deltay=(DY-BY); } + if (deltax==0 && deltay == 0) { deltax=(DX-AX); deltay=(DY-AY); } + xo = anangle(deltax,deltay); + + a = (bx-ax)*(cy-by) - (cx-bx)*(by-ay); /* a = (bp-ap)x(cp-bp); */ + b = (bx-ax)*(dy-cy) - (by-ay)*(dx-cx);; /* b = (bp-ap)x(dp-cp);*/ + c = (cx-bx)*(dy-cy) - (dx-cx)*(cy-by); /* c = (cp-bp)x(dp-cp);*/ + + if (debuglevel>(65536*2)) { + fprintf(stdout, + "bezierslope(): (%.2f,%.2f),(%.2f,%.2f),(%.2f,%.2f),(%.2f,%.2f)\n", + ax,ay,bx,by,cx,cy,dx,dy); + fprintf(stdout,"bezierslope(): a,b,c,b^2,4ac: (%.2f,%.2f,%.2f,%.2f,%.2f)\n",a,b,c,b*b,4*a*c); + } + + if ((a==0)&&(c==0)) { + res = (b==0 ? 0 : (out-in)); + print_roots("no roots (a)"); + } else if ((a==0)||(c==0)) { + if ((sign(b) == sign(a)) || (sign(b) == sign(c))) { + res = out-in; /* ? */ + if (res<-180.0) + res += 360.0; + else if (res>180.0) + res -= 360.0; + print_roots("no roots (b)"); + } else { + res = out-in; /* ? */ + print_roots("one root (a)"); + } + } else if ((sign(a)*sign(c))<0) { + res = out-in; /* ? */ + if (res<-180.0) + res += 360.0; + else if (res>180.0) + res -= 360.0; + print_roots("one root (b)"); + } else { + if (sign(a) == sign(b)) { + res = out-in; /* ? */ + if (res<-180.0) + res += 360.0; + else if (res>180.0) + res -= 360.0; + print_roots("no roots (d)"); + } else { + if ((b*b) == (4*a*c)) { + res = bezier_error; + /* print_roots("double root"); *//* cusp */ + } else if ((b*b) < (4*a*c)) { + res = out-in; /* ? */ + if (res<=0.0 &&res>-180.0) + res += 360.0; + else if (res>=0.0 && res<180.0) + res -= 360.0; + print_roots("no roots (e)"); + } else { + res = out-in; + if (res<-180.0) + res += 360.0; + else if (res>180.0) + res -= 360.0; + print_roots("two roots"); /* two inflections */ + } + } + } + return double2angle(res); +} + diff --git a/Build/source/texk/web2c/mpdir/writefont.c b/Build/source/texk/web2c/mpdir/writefont.c index e88b4dbab7d..899b42b54a2 100644 --- a/Build/source/texk/web2c/mpdir/writefont.c +++ b/Build/source/texk/web2c/mpdir/writefont.c @@ -184,17 +184,6 @@ void mpfontencodings (int lastfnum, int encodings_only) { if (encodings_only || (!is_subsetted (fm))) { e = fm->encoding; write_enc (NULL, e, 0); - } - } - } - } - } - for (f=nullfont+1;f<=lastfnum;f++) { - if (fontsizes[f]!=0 && hasfmentry (f)) { - fm = (fm_entry *) mpfontmap[f]; - if (fm != NULL && (fm->ps_name != NULL)) { - if (is_reencoded (fm)) { - if (encodings_only || (!is_subsetted (fm))) { /* clear for next run */ e->objnum = 0; } diff --git a/Build/source/texk/web2c/mpware/dmp.c b/Build/source/texk/web2c/mpware/dmp.c index cf876f8aa91..9d8e4a21cef 100644 --- a/Build/source/texk/web2c/mpware/dmp.c +++ b/Build/source/texk/web2c/mpware/dmp.c @@ -23,8 +23,8 @@ * gets modified. */ -char *banner = "% Written by DMP, Version 0.992"; /* first line of output */ -char *term_banner = "This is DMP, Version 0.992"; +char *banner = "% Written by DMP, Version 1.002"; /* first line of output */ +char *term_banner = "This is DMP, Version 1.002"; #include <stdio.h> #include <stdlib.h> diff --git a/Build/source/texk/web2c/mpware/makempx.c b/Build/source/texk/web2c/mpware/makempx.c index 34eaa6895a5..a04aaacc405 100644 --- a/Build/source/texk/web2c/mpware/makempx.c +++ b/Build/source/texk/web2c/mpware/makempx.c @@ -95,7 +95,7 @@ #define GETCWD getcwd #endif -#define version "0.993" +#define version "1.002" #define ERRLOG "mpxerr.log" #define TEXERR "mpxerr.tex" diff --git a/Build/source/texk/web2c/mpware/mpto.c b/Build/source/texk/web2c/mpware/mpto.c index 27d687493bd..593dc1a43cd 100644 --- a/Build/source/texk/web2c/mpware/mpto.c +++ b/Build/source/texk/web2c/mpware/mpto.c @@ -25,9 +25,7 @@ #include <stdio.h> #include <stdlib.h> -#ifdef WIN32 #include <string.h> -#endif /* MetaPost itself has a configurable max line length, but we can afford to @@ -49,7 +47,7 @@ char *tex_pretex1 = "\\gdef\\mpxshipout{\\shipout\\hbox\\bgroup%\n" " \\ht0=0pt \\dp0=0pt \\box0 \\egroup}\n" "\\mpxshipout%% line %d %s\n"; char *tex_pretex = "\\mpxshipout%% line %d %s\n"; -char *tex_posttex = "\\stopmpxshipout\n"; +char *tex_posttex = "\n\\stopmpxshipout\n"; char *tex_preverb1 = ""; /* if very first instance */ char *tex_preverb = "%% line %d %s\n"; /* all other instances */ char *tex_postverb = "%\n"; @@ -122,7 +120,7 @@ getline(void) /* Return nonzero if a prefix of string s matches the null-terminated string t - * and the next character is not a letter of an underscore. + * and the next character is not a letter or an underscore. */ int match_str(char *s, char *t) @@ -300,23 +298,14 @@ copytex(void) { char *s; /* where a string to print stops */ char c; - - while (*aa == ' ' || *aa == '\t') - aa++; - if (*aa == 0) - if ((aa = getline()) == NULL) - err("btex section does not end"); + char *res = NULL; do { if (*aa == 0) - if ((aa = getline()) == NULL) - err("btex section does not end"); - else - printf("\n"); + if ((aa = getline()) == NULL) + err("btex section does not end"); + if (getbta(aa) && *tt == 'e') { - s = tt - 1; - while (s >= bb && (*s == ' ' || *s == '\t')) - s--; - s++; + s = tt; } else { if (*tt == 'b') err("btex in TeX mode"); @@ -326,9 +315,31 @@ copytex(void) } c = *s; *s = 0; - printf("%s", bb); + if (res==NULL) { + res = malloc(strlen(bb)+2); + if (res==NULL) + err("memory allocation failure"); + res = strncpy(res,bb,(strlen(bb)+1)); + } else { + res = realloc(res,strlen(res)+strlen(bb)+2); + if (res==NULL) + err("memory allocation failure"); + res = strncat(res,bb, strlen(bb)); + } + if (c == '\0') + res = strncat(res, "\n", 1); *s = c; } while (*tt != 'e'); + /* whitespace at the end */ + for (s = res + strlen(res) - 1; + s >= res && (*s == ' ' || *s == '\t' || *s == '\r' || *s == '\n'); s--); + *(++s) = '\0'; + /* whitespace at the start */ + for (s = res; + s < (res + strlen(res)) && (*s == ' ' || *s == '\t' || *s == '\r' + || *s == '\n'); s++); + printf("%s%%",s); + free(res); } @@ -386,7 +397,7 @@ main(int argc, char **argv) exit(0); } else if (argc > 1 && (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-version") == 0)) { - printf("mpto 0.992\n\ + printf("mpto 1.002\n\ This program is in the public domain.\n\ Primary author of mpto: John Hobby.\n\ Current maintainer: Taco Hoekwater.\n"); diff --git a/Build/source/texk/web2c/mpware/newer.c b/Build/source/texk/web2c/mpware/newer.c index a19d646b9f9..951575cfb75 100644 --- a/Build/source/texk/web2c/mpware/newer.c +++ b/Build/source/texk/web2c/mpware/newer.c @@ -87,7 +87,7 @@ main(int argc, char **argv) } else if (strcmp(argv[1], "-version") == 0 || strcmp(argv[1], "--version") == 0) { - fputs("newer 0.992\n\ + fputs("newer 1.002\n\ This program is in the public domain.\n\ Primary author of newer: John Hobby.\n\ Current maintainer: Taco Hoekwater.\n", stdout); diff --git a/Master/texmf-dist/doc/metapost/base/mpgraph.pdf b/Master/texmf-dist/doc/metapost/base/mpgraph.pdf Binary files differindex ce2c6bcdc8e..13fa82c4d00 100644 --- a/Master/texmf-dist/doc/metapost/base/mpgraph.pdf +++ b/Master/texmf-dist/doc/metapost/base/mpgraph.pdf diff --git a/Master/texmf-dist/doc/metapost/base/mpintro.pdf b/Master/texmf-dist/doc/metapost/base/mpintro.pdf Binary files differindex b6c896c5de4..52ac497e6d5 100644 --- a/Master/texmf-dist/doc/metapost/base/mpintro.pdf +++ b/Master/texmf-dist/doc/metapost/base/mpintro.pdf diff --git a/Master/texmf-dist/doc/metapost/base/mpman.pdf b/Master/texmf-dist/doc/metapost/base/mpman.pdf Binary files differindex e2f4f982b4a..ea2ffee5c76 100644 --- a/Master/texmf-dist/doc/metapost/base/mpman.pdf +++ b/Master/texmf-dist/doc/metapost/base/mpman.pdf diff --git a/Master/texmf-dist/doc/metapost/base/source/Makefile b/Master/texmf-dist/doc/metapost/base/source/Makefile index 7c14b2d2b08..39c8e9ad6d5 100644 --- a/Master/texmf-dist/doc/metapost/base/source/Makefile +++ b/Master/texmf-dist/doc/metapost/base/source/Makefile @@ -1,26 +1,33 @@ # $Id: Makefile,v 1.4 2005/03/21 15:25:51 taco Exp $ -# Makefile for mpman and mpgraph. -# Public domain. -# -# (In TeX Live, another Makefile has rules for building grdemo and mpintro.) -# +# Makefile for MetaPost documentation. Public domain. +# Rules for the groff/troff docs are in TeX Live, +# texmf-dist/doc/metapost/base/Makefile. pdflatex = pdflatex +bibtex = bibtex mpost = TEX=tex mpost -all: mpman.pdf mpgraph.pdf +all: mpman.pdf mpintro.pdf mpgraph.pdf grdemo.pdf mpgraph.pdf: mpgraph.tex mpgraph.bib mpgraph.mp $(mpost) mpgraph $(pdflatex) mpgraph - bibtex mpgraph + $(bibtex) mpgraph $(pdflatex) mpgraph $(pdflatex) mpgraph +mpintro.pdf: mpintro.tex mpintro.bib examples.mp manfig.mp + $(mpost) examples + $(mpost) manfig + $(pdflatex) mpintro + $(bibtex) mpintro + $(pdflatex) mpintro + $(pdflatex) mpintro + mpman.pdf: mpman.tex mpman.bib mpman.ist manfig.mp $(mpost) manfig $(pdflatex) mpman - bibtex mpman + $(bibtex) mpman $(pdflatex) mpman $(pdflatex) mpman makeindex -s mpman.ist mpman diff --git a/Master/texmf-dist/doc/metapost/base/source/examples.mp b/Master/texmf-dist/doc/metapost/base/source/examples.mp index 2cd4cb6811b..4e9a7e58ba8 100644 --- a/Master/texmf-dist/doc/metapost/base/source/examples.mp +++ b/Master/texmf-dist/doc/metapost/base/source/examples.mp @@ -1,6 +1,8 @@ % $Id: examples.mp,v 1.2 2004/09/19 19:10:08 karl Exp $ % 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); diff --git a/Master/texmf-dist/doc/metapost/base/source/manfig.mp b/Master/texmf-dist/doc/metapost/base/source/manfig.mp index 62b698dc851..73b48ab9470 100644 --- a/Master/texmf-dist/doc/metapost/base/source/manfig.mp +++ b/Master/texmf-dist/doc/metapost/base/source/manfig.mp @@ -3,7 +3,64 @@ 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; @@ -853,4 +910,40 @@ label.urt(btex$b$etex, cuta(ee,cc) ee.c{(cc.c-ee.c)rotated-15}..cc.c); endfig; +beginfig(55) +picture wheel, car; +path body; + u := 5bp; + % Use a calligraphic pen. + pickup pencircle scaled .1u yscaled .6 rotated 30; + % Define a wheel object. + wheel := image( + draw fullcircle scaled 2u xscaled .8 rotated 30; + draw fullcircle scaled .1u xscaled .8 rotated 30 + withpen currentpen scaled .5; + ); + % Construct path for car body. + body := (3.2u,0){right}..(4.5u,1.5u){up}..(1.5u,2.5u){dir(-170)} + ..(1.5u,4.25u){up}...(0,5u){left}; + body := body .. reverse body reflectedabout (origin, (0,u)); + % Define a car object. + car := image( + draw wheel shifted (2u, 0);% Draw two wheels. + draw wheel shifted (-2u, 0); + draw (-.8u,0){dir(5)}..(.8u,0);% Draw connection betweeen wheels. + draw body;% Draw body. + % Draw speed indicators. + for i=1.5, 2, 2.5: + draw (5u, u*i){right}..{dir(-10)}(6.5u,u*i*.95); + endfor + ) shifted (0, u) slanted -.2 rotated 1;% Introduce asymmetries. + % Draw two cars and a faster one. + draw car shifted (5u,0); + draw car shifted (20u,0); + draw car slanted -.25 shifted (45u,0); + % Draw motorway. + draw (-5u,-u)...(25u,-.5u)...(60u,-u) + withpen currentpen scaled 4 withcolor .7white; +endfig; + end diff --git a/Master/texmf-dist/doc/metapost/base/source/mpgraph.tex b/Master/texmf-dist/doc/metapost/base/source/mpgraph.tex index e19b1024ce9..77c5d71c5a5 100644 --- a/Master/texmf-dist/doc/metapost/base/source/mpgraph.tex +++ b/Master/texmf-dist/doc/metapost/base/source/mpgraph.tex @@ -1,12 +1,19 @@ % $Id: mpgraph.tex,v 1.3 2005/03/22 00:16:53 karl Exp $ % MetaPost graph doc, by John Hobby. License at end. +\ifnum\pdftexversion<140 +\else +\pdfminorversion=5 +\pdfobjcompresslevel=1% Use compressed object streams. +\fi +\RequirePackage[resetfonts]{cmap} \documentclass{article} % article is NOT the original style \usepackage{makeidx} \usepackage{fancyvrb} \usepackage{ctabbing} \RecustomVerbatimEnvironment{verbatim}{BVerbatim}{baseline=c} \usepackage{graphics} -\usepackage[textwidth=6in,textheight=8.75in]{geometry} +\usepackage[textwidth=6in,textheight=8.65in]{geometry} +\usepackage{multicol} \newcommand\descr[1]{{\langle\hbox{\rm#1}\rangle}} \newcommand\invisgap{\nobreak\hskip0pt\relax} @@ -41,6 +48,22 @@ in a stand-alone graph package.} \newcommand\mykeywords{% typesetting; graphs; MetaPost} +\usepackage[rgb,x11names]{xcolor}% Optimize for screen reading. +\usepackage{hyperxmp} +\usepackage{hyperref} +\hypersetup{ + pdftitle={Drawing Graphs with MetaPost}, + pdfauthor={John D. Hobby and the MetaPost development team}, + pdfkeywords={typesetting, graphs, MetaPost, TeX} +} +\hypersetup{ + pdfstartview={XYZ null null null},% Zoom factor is determined by viewer. + colorlinks, + linkcolor=RoyalBlue3, + urlcolor=Chocolate4, + citecolor=SpringGreen3 +} +\usepackage[all]{hypcap} \begin{document} @@ -50,6 +73,10 @@ in a stand-alone graph package.} \begin{keywords} \mykeywords \end{keywords} \fi +\setlength{\columnsep}{2.5em} +\begin{multicols}{2} +\tableofcontents +\end{multicols} \section{Introduction} \label{intro} @@ -93,8 +120,7 @@ Section~\ref{grmac} describes the graph macros from a user's perspective and presents several examples. Sections \ref{nummac} and~\ref{formsec} discuss auxiliary packages for manipulating and typesetting numbers and Section~\ref{concl} gives some concluding remarks. Appendix~\ref{summsec} summarizes the graph-drawing -macros, and Appendix~\ref{nfeats} describes some recent additions to the MetaPost -language that have not been presented elsewhere. +macros. \section{Using the Graph Macros} @@ -972,135 +998,9 @@ It is necessary to {\tt input sarith} before using the following macros: \end{description} - -\section{New Language Features} -\label{nfeats} - -The {\tt graph.mp} macros and the arithmetic routines in {\tt marith.mp} -and {\tt sarith.mp} use various language features that were introduced -in Version 0.60 of the MetaPost language. We summarize these features here -because they are not covered in existing documentation \cite{ho:mp3,ho:mp4}. -Also new is the built-in macro -$$ \hbox{\tt image($\descr{drawing commands}$)} $$ -that was used in Section~\ref{dfilesec} to find the picture produced by a -sequence of drawing commands. - -\subsection{Reading and Writing Files} - -A new operator -$$ {\tt readfrom}\ \descr{file name} $$ -returns a string giving the next line of input from the named file. The -\tdescr{file name} can be any primary expression of type string. If the file -has ended or cannot be read, the result is a string consisting of a single -null character. The preloaded {\tt plain} macro package introduces the name -{\tt EOF} for this string. After {\tt readfrom} has returned {\tt EOF}, -additional reads from the same file cause the file to be reread from the -start. - -The opposite of {\tt readfrom} is the command -$$ {\tt write}\ \descr{string expression}\ {\tt to} \descr{file name} $$ -This writes a line of text to the specified output file, opening the file -first if necessary. All such files are closed automatically when the -program terminates. They can also be closed explicitly by using {\tt EOF} -as the \tdescr{string expression}. The only way to tell if a {\tt write} -command has succeeded is to close the file and use {\tt readfrom} to look -at it. - -\subsection{Extracting Information from Pictures} - -MetaPost pictures are composed of stroked lines, filled outlines, pieces -of typeset text, clipping paths, and {\tt setbounds} paths. (A {\tt setbounds} -path gives an artificial bounding box as is needed for \TeX\ output.) -A picture can have many components of each type. They can be accessed via -an iteration of the form -$$ {\tt for}\ \descr{symbolic token}\ {\tt within}\ - \descr{picture expression}\hbox{\tt:}\ \descr{loop text}\ {\tt endfor} -$$ -The \tdescr{loop text} can be anything that is balanced with respect to -{\tt for} and {\tt endfor}. The \tdescr{symbolic token} is a loop variable that -scans the components of the picture in the order in which they were drawn. The -component for a clipping or {\tt setbounds} path includes everything the path -applies to. Thus if a single clipping or {\tt setbounds} path applies to -everything in the \tdescr{picture expression}, the whole picture could be -thought of as one big component. In order to make the contents of such a picture -accessible, the {\tt for}\ldots{\tt within} iteration ignores the enclosing -clipping or {\tt setbounds} path in this case. - -Once the {\tt for}\ldots{\tt within} iteration has found a picture component, -there are numerous operators for identifying it and extracting relevant -information. The operator -$$ {\tt stroked}\ \descr{primary expression} $$ -tests whether the expression is a known picture whose first component is a -stroked line. Similarly, the {\tt filled} and {\tt textual} operators -return {\tt true} if the first component is a filled outline or a piece of -typeset text. The {\tt clipped} and {\tt bounded} operators test whether -the argument is a known picture that starts with a clipping path or a -{\tt setbounds} path. This is true if the first component is clipped or -bounded or if the entire picture is enclosed in a clipping or {\tt setbounds} -path. - -There are also numerous part extraction operators that test the first component -of a picture. If {\tt p} is a picture and {\tt stroked p} is true, -{\tt pathpart p} is the path describing the line that got stroked, -{\tt penpart p} is the pen that was used, {\tt dashpart p} is the dash -pattern, and the color is -$$ \hbox{\tt (redpart p, greenpart p, bluepart p)} $$ -If the line is not dashed, {\tt dashpart p} returns an empty picture. - -The same part extraction operators work when {\tt filled p} is true, except -that {\tt dashpart p} is not meaningful in that case. For text components, -{\tt textual p} is true, {\tt textpart p} gives the text that got -typeset, {\tt fontpart p} gives the font that was used, and {\tt xpart~p}, -{\tt ypart~p}, {\tt xxpart~p}, {\tt xypart~p}, {\tt yxpart~p}, {\tt yypart~p} -tell how the text has been shifted, rotated, and scaled. The {\tt redpart}, -{\tt greenpart}, and {\tt bluepart} operators also work for text components. - -When {\tt clipped p} or {\tt bounded p} is true, {\tt pathpart p} gives the -clipping or {\tt setbounds} path and the other part extraction operators are -not meaningful. Such non-meaningful part extractions do not generate -errors---they return null values instead: -the trivial path {\tt (0,0)} for {\tt pathpart}, -{\tt nullpen} for {\tt penpart}, -an empty picture for {\tt dashpart}, -zero for {\tt redpart}, {\tt greenpart}, {\tt bluepart}, -and the null string for {\tt textpart} or {\tt fontpart}. - -One final operator for extracting information from a picture is -$$ {\tt length}\ \descr{picture primary} $$ -This returns the number of components that a {\tt for}\ldots {\tt within} -iteration would find. - -\subsection{Other New Features} - -The {\tt marith.mp} and {\tt sarith.mp} packages use numbers of magnitude -4096 more. Since such numbers can cause overflow problems in MetaPost's -linear equation solving and path fitting algorithms, they are normally -allowed only as intermediate results. This limitation is removed when -the internal variable {\tt warningcheck} is zero. In earlier versions -of MetaPost, the limitation could be removed for variables but explicit -constants were always restricted to be less than 4096. - -For completeness, we also mention one other new feature of MetaPost -Version 0.60. When \TeX\ material is included in a picture via the -{\tt btex}\ldots{\tt etex} feature, the thickness of horizontal and -vertical rules gets rounded to exactly the right number of pixels; i.e., -interpreting MetaPost output according to the PostScript scan -conversion rules~\cite{ad:red} makes the pixel width equal to the ceiling -of the unrounded width. In fact, a similar relationship holds for all line -widths. The generated PostScript sets line widths by first transforming -to device coordinates and rounding appropriately. - - - - - - \bibliographystyle{plain} \bibliography{mpgraph} - - - \end{document} diff --git a/Master/texmf-dist/doc/metapost/base/source/mpintro.tex b/Master/texmf-dist/doc/metapost/base/source/mpintro.tex index 539a107c0b5..a95d7d1dfb8 100644 --- a/Master/texmf-dist/doc/metapost/base/source/mpintro.tex +++ b/Master/texmf-dist/doc/metapost/base/source/mpintro.tex @@ -1,7 +1,7 @@ % $Id: mpintro.tex,v 1.2 2004/09/19 19:10:08 karl Exp $ % MetaPost doc, by John Hobby. -\documentstyle{article} -\input epsf +\documentclass{article} +\usepackage{graphicx} \author{John D. Hobby} \title{The MetaPost System} @@ -63,45 +63,14 @@ 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 dpost} output processor includes PostScript figures when they are +{\tt grops} output processor includes PostScript figures when they are requested via troff's {\tt \char`\\X} command. \begin{figure}[htp] -$$ \def\fbox#1{\hbox{\vrule - \vbox{\hrule\kern5pt\hbox{\kern5pt\hbox{#1}\kern5pt}\kern5pt\hrule}% - \vrule}} - \vbox{ - \halign{$\hfil#\hfil$&\hskip1in$\hfil#\hfil$\cr - \hbox{Figures in MetaPost}& - \hbox{\TeX\ Document} - \cr - \bigg\downarrow& - \bigg\downarrow - \cr - \fbox{\vrule height.2in depth.133in width0pt - \kern .1in MetaPost\kern.1in} - & - \fbox{\vrule height.2in depth.133in width0pt - \kern .167in \TeX\kern.167in} - \cr - \bigg\downarrow& - \bigg\downarrow - \cr - \hbox{Figures in PostScript}& - \hbox{{\tt dvi} file} - \cr - \bigg\downarrow& - \bigg\downarrow - \cr - \fbox{\vrule height.2in depth.133in width0pt - \kern 1in {\tt dvips} \kern1in} - \span\omit\cr - \bigg\downarrow\span\omit\cr - \hbox{PostScript}\span\omit\cr}} - \atop - \vbox{\noindent Fig.~1: A diagram of the processing for a \TeX\ document with figures - done in Meta\-Post} -$$ +\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 @@ -143,9 +112,13 @@ end %stopverbatim$$ Then the command \lit{mp} \lit{fig} produces an output file \lit{fig.1} that can be included in a -\TeX\ document. After \lit{\string\input} \lit{epsf} the \TeX\ commands +\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 -$$ \epsfbox{examples.1} $$ +$$ \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 @@ -248,7 +221,7 @@ makelabel.rt(btex $Q$ etex, p2 intersectionpoint q1.5); endfig; %stopverbatim$$ produces the following figure:\vadjust{\okbreak} -$$ \epsfbox{examples.2} $$ +$$ \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 @@ -434,7 +407,7 @@ label.bot(btex $x_3$ etex, z3a); endfig; %stopverbatim$$ This produces the following figure:\vadjust{\okbreak} -$$ \epsfbox{examples.3} $$ +$$ \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 @@ -479,7 +452,7 @@ labels.top(0,1,2,3,4,5); endfig; linecap:=rounded; %stopverbatim \qquad -\vcenter{\epsfbox{examples.4}} +\vcenter{\includegraphics{examples-4}} $$ There is also a \lit{linejoin} parameter as illustrated below. @@ -500,7 +473,7 @@ labels.bot(0,1,2,3,4,5,6,7,8); endfig; linejoin:=rounded; %stopverbatim \qquad -\vcenter{\epsfbox{examples.5}} +\vcenter{\includegraphics{examples-5}} \mskip-54mu % allow it to hang into the margin $$ @@ -673,7 +646,7 @@ $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} -$$ \epsfbox{examples.6} $$ +$$ \includegraphics{examples-6} $$ \okbreak @@ -718,7 +691,7 @@ label.rt(btex ndblock etex, z.ptr); endfig; $$ It is instructive to compare the MetaPost output below with the similar figure in the {\it pic} manual \cite{ke:pic}.\vadjust{\okbreak} -$$ \epsfbox{examples.7} $$ +$$ \includegraphics{examples-7} $$ The second line of input for the above figure contains $$ \lit{boxjoin(a.se=b.sw; a.ne=b.nw)} $$ @@ -772,7 +745,7 @@ 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} -$$ \epsfbox{examples.8} $$ +$$ \includegraphics{examples-8} $$ \okbreak @@ -814,7 +787,7 @@ endfig; $$ The ``boxes'' produced when using \lit{circleit} come out circular unless something forces a different aspect ratio.\vadjust{\okbreak} -$$ \epsfbox{examples.9} $$ +$$ \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")} diff --git a/Master/texmf-dist/doc/metapost/base/source/mpman-optab.tex b/Master/texmf-dist/doc/metapost/base/source/mpman-optab.tex new file mode 100644 index 00000000000..de9f68cd905 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/base/source/mpman-optab.tex @@ -0,0 +1,145 @@ +%%% 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
+\&& 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
+*& numeric& (cmyk)color\par numeric\par pair& (cmyk)color\par numeric\par pair& \pageref{Dmldiv}& Multiplication\\\hline
+*& (cmyk)color\par numeric\par pair& numeric& (cmyk)color\par numeric\par pair& \pageref{Dmldiv}& Multiplication\\\hline
+**& numeric& numeric& numeric& \pageref{Dpow}& Exponentiation\\\hline
++& (cmyk)color\par numeric\par pair& (cmyk)color\par numeric\par pair& (cmyk)color\par numeric\par pair& \pageref{Dadd}& Addition\\\hline
+++& numeric& numeric& numeric& \pageref{Dpyadd}& Pythagorean addition $\sqrt{l^2+r^2}$\\\hline
++-+& numeric& numeric& numeric& \pageref{Dpysub}& Pythagorean subtraction $\sqrt{l^2-r^2}$\\\hline
+-& (cmyk)color\par numeric\par pair& (cmyk)color\par numeric\par pair& (cmyk)color\par numeric\par pair& \pageref{Dadd}& Subtraction\\\hline
+-& --& (cmyk)color\par numeric\par pair& (cmyk)color\par numeric\par pair& \pageref{Dneg}& Negation\\\hline
+/& (cmyk)color\par numeric\par pair& numeric& (cmyk)color\par numeric\par pair& \pageref{Dmldiv}& Division\\\hline
+< = >\par <= >=\par <>& 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& --& numeric\par pair& numeric& \pageref{Dabs}& Absolute value\par Euclidean length $\sqrt{(\mbox{\ttfamily xpart\ } r)^2+(\mbox{\ttfamily ypart\ } r)^2}$\\\hline
+and& boolean& boolean& boolean& \pageref{Dand}& Logical and\\\hline
+angle& --& pair& numeric& \pageref{Dangle}& 2$-$argument arctangent (in degrees)\\\hline
+arclength& --& path& numeric& \pageref{Darclng}& Arc length of a path\\\hline
+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& --& picture\par path\par pen& path& \pageref{Dbbox}& A rectangular path for the bounding box\\\hline
+blackpart& --& cmykcolor& numeric& \pageref{Dcmykprt}& Extract the fourth component\\\hline
+bluepart& --& color& numeric& \pageref{Drgbprt}& Extract the third component\\\hline
+boolean& --& any& boolean& \pageref{Dboolop}& Is the expression of type boolean?\\\hline
+\pl bot& --& numeric\par pair& numeric\par pair& \pageref{Dbot}& Bottom of current pen when centered at the given coordinate(s)\\\hline
+bounded& --& any& boolean& \pageref{Dbounded}& Is argument a picture with a bounding box?\\\hline
+\pl ceiling& --& numeric& numeric& \pageref{Dceil}& Least integer greater than or equal to\\\hline
+\pl center& --& picture\par path\par pen& pair& \pageref{Dcenter}& Center of the bounding box\\\hline
+char& --& numeric& string& \pageref{Dchar}& Character with a given ASCII code\\\hline
+clipped& --& any& boolean& \pageref{Dclipped}& Is argument a clipped picture?\\\hline
+cmykcolor& --& any& boolean& \pageref{Dccolrop}& Is the expression of type cmykcolor?\\\hline
+colormodel& --& image object& numeric& --& What is the color model of the image object?\\\hline
+color& --& any& boolean& \pageref{Dcolrop}& Is the expression of type color?\\\hline
+cosd& --& numeric& numeric& \pageref{Dcosd}& Cosine of angle in degrees\\\hline
+\pl cutafter& path& path& path& \pageref{Dcuta}& Left argument with part after the intersection dropped\\\hline
+\pl cutbefore& path& path& path& \pageref{Dcutb}& Left argument with part before the intersection dropped\\\hline
+cyanpart& --& cmykcolor& numeric& \pageref{Dcmykprt}& Extract the first component\\\hline
+cycle& --& path& boolean& \pageref{Dcycop}& Determines whether a path is cyclic\\\hline
+dashpart& --& picture& picture& \pageref{Ddashpart}& Dash pattern of a path in a stroked picture\\\hline
+decimal& --& numeric& string& \pageref{Ddecop}& The decimal representation\\\hline
+\pl dir& --& numeric& pair& \pageref{Ddirop}& $(\cos\theta,\sin\theta)$ given $\theta$ in degrees\\\hline
+\pl direction of& numeric& path& pair& \pageref{Ddirof}& The direction of a path at a given `time'\\\hline
+\pl direction\-point of& pair& path& numeric& \pageref{Ddpntof}& Point where a path has a given direction\\\hline
+direction\-time 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& pair& pair& numeric& \pageref{Ddprod}& vector dot product\\\hline
+filled& --& any& boolean& \pageref{Dfilled}& Is argument a filled outline?\\\hline
+floor& --& numeric& numeric& \pageref{Dfloor}& Greatest integer less than or equal to\\\hline
+fontpart& --& picture& string& \pageref{Dfontpart}& Font of a textual picture component\\\hline
+fontsize& --& string& numeric& \pageref{Dfntsiz}& The point size of a font\\\hline
+greenpart& --& color& numeric& \pageref{Drgbprt}& Extract the second component\\\hline
+greypart& --& numeric& numeric& --& Extract the first (only) component\\\hline
+hex\index{hex?\texttt{hex}}& --& string& numeric& --& Interpret as a hexadecimal number\\\hline
+infont& string& string& picture& \pageref{Sinfont}& Typeset string in given font\\\hline
+\pl intersec\-tionpoint& path& path& pair& \pageref{Disecpt}& An intersection point\\\hline
+intersec\-tiontimes& path& path& pair& \pageref{Disectt}& Times ($t_l,t_r)$ on paths $l$ and $r$ when the paths intersect\\\hline
+\pl inverse& --& transform& transform& \pageref{Dinv}& Invert a transformation\\\hline
+known& --& any& boolean& \pageref{Dknown}& Does argument have a known value?\\\hline
+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& --& numeric\par pair& numeric\par pair& \pageref{Dlft}& Left side of current pen when its center is at the given coordinate(s)\\\hline
+llcorner& --& picture\par path\par pen& pair& \pageref{Dcornop}& Lower-left corner of bounding box\\\hline
+lrcorner& --& picture\par path\par pen& pair& \pageref{Dcornop}& Lower-right corner of bounding box\\\hline
+magentapart& --& cmykcolor& numeric& \pageref{Dcmykprt}& Extract the second component\\\hline
+makepath& --& pen& path& \pageref{Dmkpath}& Cyclic path bounding the pen shape\\\hline
+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& --& boolean& boolean& \pageref{Dnot}& Logical negation\\\hline
+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& boolean& boolean& boolean& \pageref{Dor}& Logical inclusive or\\\hline
+pair& --& any& boolean& \pageref{Dpairop}& Is the expression of type pair?\\\hline
+path& --& any& boolean& \pageref{Dpathop}& Is the expression of type path?\\\hline
+pathpart& --& picture& path& \pageref{Dpathpart}& Path of a stroked picture component\\\hline
+pen& --& any& boolean& \pageref{Dpenop}& Is the expression of type pen?\\\hline
+penoffset of\index{penoffset?\texttt{penoffset}}& pair& pen& pair& --& Point on the pen furthest to the right of the given direction\\\hline
+penpart& --& picture& pen& \pageref{Dpenpart}& Pen of a stroked picture component\\\hline
+picture& --& any& boolean& \pageref{Dpictop}& Is the expression of type picture?\\\hline
+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& --& string& string& \pageref{Dreadfrom}& Read a line from file\\\hline
+redpart& --& color& numeric& \pageref{Drgbprt}& Extract the first component\\\hline
+reverse& --& path& path& \pageref{Drevrse}& `time'-reversed path, beginning swapped with ending\\\hline
+rgbcolor& --& any& boolean& \pageref{Drcolrop}& Is the expression of type color?\\\hline
+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& --& numeric\par pair& numeric\par pair& \pageref{Dround}& round each component to the nearest integer\\\hline
+\pl rt& --& numeric\par pair& numeric\par pair& \pageref{Drt}& Right side of current pen when centered at given coordinate(s)\\\hline
+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& --& string& token sequence& \pageref{Dscantokens}& Converts a string to a token or token sequence. Provides string to numeric conversion, etc.\\\hline
+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& --& numeric& numeric& \pageref{Dsind}& Sine of an angle in degrees\\\hline
+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& --& numeric& numeric& \pageref{Dsqrt}& Square root\\\hline
+str& --& suffix& string& \pageref{Dstr}& String representation for a suffix\\\hline
+string& --& any& boolean& \pageref{Dstrgop}& Is the expression of type string?\\\hline
+stroked& --& any& boolean& \pageref{Dstroked}& Is argument a stroked line?\\\hline
+subpath of& pair& path& path& \pageref{Dsubpth}& Portion of a path for given range of time values\\\hline
+substring of& pair& string& string& \pageref{Dsubstr}& Substring bounded by given indices\\\hline
+textpart& --& picture& string& \pageref{Dtextpart}& Text of a textual picture component\\\hline
+textual& --& any& boolean& \pageref{Dtextual}& Is argument typeset text?\\\hline
+\pl top& --& numeric\par pair& numeric\par pair& \pageref{Dtop}& Top of current pen when centered at the given coordinate(s)\\\hline
+transform& --& any& boolean& \pageref{Dtrnfop}& Is the argument of type transform?\\\hline
+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& --& 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& --& pair& pair& \pageref{Duvec}& Rescale a vector so its length is~1\\\hline
+unknown& --& any& boolean& \pageref{Dunknwn}& Is the value unknown?\\\hline
+urcorner& --& picture\par path\par pen& pair& \pageref{Dcornop}& Upper-right corner of bounding box\\\hline
+\pl whatever& --& --& numeric& \pageref{Dwhatev}& Create a new anonymous unknown\\\hline
+withpost\-script& --& string& ---& \pageref{Dwithpost}& End raw PostScript code\\\hline
+withpre\-script& --& string& ---& \pageref{Dwithpre}& Begin raw PostScript code\\\hline
+xpart& --& pair\par transform& number& \pageref{Dxprt}& $x$ or $t_x$ component\\\hline
+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& --& transform& number& \pageref{Dtrprt}& $t_{xx}$ entry in transformation matrix\\\hline
+xypart& --& transform& number& \pageref{Dtrprt}& $t_{xy}$ entry in transformation matrix\\\hline
+yellowpart& --& cmykcolor& numeric& \pageref{Dcmykprt}& Extract the third component\\\hline
+ypart& --& pair\par transform& number& \pageref{Dyprt}& $y$ or $t_y$ component\\\hline
+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& --& transform& number& \pageref{Dtrprt}& $t_{yx}$ entry in transformation matrix\\\hline
+yypart& --& transform& number& \pageref{Dtrprt}& $t_{yy}$ entry in transformation matrix\\\hline
+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/mpman.bib b/Master/texmf-dist/doc/metapost/base/source/mpman.bib index c9e8838fe60..878737006de 100644 --- a/Master/texmf-dist/doc/metapost/base/source/mpman.bib +++ b/Master/texmf-dist/doc/metapost/base/source/mpman.bib @@ -61,6 +61,14 @@ address = "Reading, Massachusetts", year = 1986 } +@book{ad:red2, + author = "{Adobe Systems Inc.}", + title = "{P}ost{S}cript Language Reference Manual", + publisher = "Addison Wesley", + address = "Reading, Massachusetts", + edition = "second", + year = 1990 +} @article{ho:mp1, author = "J. D. Hobby", title = "A {\MF}-like System with {P}ost{S}cript Output", diff --git a/Master/texmf-dist/doc/metapost/base/source/mpman.tex b/Master/texmf-dist/doc/metapost/base/source/mpman.tex index 28b7e44b27c..8a1ce606dfd 100644 --- a/Master/texmf-dist/doc/metapost/base/source/mpman.tex +++ b/Master/texmf-dist/doc/metapost/base/source/mpman.tex @@ -1,5 +1,11 @@ % $Id: mpman.tex,v 1.26 2005/04/13 12:57:28 karl Exp $ % MetaPost manual, by John Hobby. License at end. +\ifnum\pdftexversion<140 +\else +\pdfminorversion=5 +\pdfobjcompresslevel=1% Use compressed object streams. +\fi +\RequirePackage[resetfonts]{cmap} \documentclass{article} % article is NOT the original style % \usepackage{makeidx} @@ -8,10 +14,12 @@ \RecustomVerbatimEnvironment {verbatim}{BVerbatim}{baseline=c} \usepackage{graphicx} +\usepackage[latin1]{inputenc} +\pdfmapfile{+lm-math.map} \usepackage[textwidth=6in,textheight=8.65in]{geometry} \usepackage{tocloft} \setlength\cftbeforesecskip{1.3ex plus 0.3ex minus 0.3ex} -\usepackage{url} +\usepackage{ltxtable} \makeatletter \def\logo{\global\font\logo=logo10 at1\@ptsize\p@ \logo} @@ -53,11 +61,28 @@ \makeindex +\usepackage{multicol} +\usepackage[rgb,x11names]{xcolor}% Optimize for screen reading. +\usepackage{hyperxmp} +\usepackage{hyperref} +\hypersetup{ + pdftitle={A User's Manual for MetaPost}, + pdfauthor={John D. Hobby and the MetaPost development team}, + pdfkeywords={MetaPost, PostScript, vector graphics language, MetaFont, TeX} +} +\hypersetup{ + pdfstartview={XYZ null null null},% Zoom factor is determined by viewer. + colorlinks, + linkcolor=RoyalBlue3, + urlcolor=Chocolate4, + citecolor=SpringGreen3 +} +\usepackage[all]{hypcap} \begin{document} \VerbatimFootnotes -\author{John D. Hobby} +\author{John D. Hobby\\\small and the MetaPost development team} \title{A User's Manual for MetaPost} -\date{documented version: 0.99} +\date{documented version: 1.000} \maketitle \begin{abstract} @@ -75,15 +100,10 @@ An appendix explains the differences between MetaPost and \MF. \end{abstract} \thispagestyle{empty} \newpage -\setcounter{page}{1} -\pagestyle{plain} -\pagenumbering{roman} +\setlength{\columnsep}{2.5em} +\begin{multicols}{2} \tableofcontents -\newpage -\setcounter{page}{1} -\pagestyle{headings} -\pagenumbering{arabic} -\setlength{\parskip}{.75ex plus 0.5ex minus 0.2ex} +\end{multicols} \section{Introduction} \label{intro} @@ -111,52 +131,6 @@ of a freehand drawing tool or even an interactive graphics editor. It is really a programming language for generating graphics, especially figures for \TeX\footnote{\TeX\ is a trademark of the American Mathematical Society.}\index{TeX?\TeX} and troff\index{troff} documents. -The figures can be integrated into a \TeX\ document via a freely -available program called {\tt dvips}\index{dvips} as shown in -Figure~\ref{fig0}.\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 dpost} output -processor includes PostScript figures when they are requested via -troff's {\tt \char`\\X} command. - -\begin{figure}[htp] -$$ \def\fbox#1{\hbox{\vrule - \vbox{\hrule\kern5pt\hbox{\kern5pt\hbox{#1}\kern5pt}\kern5pt\hrule}% - \vrule}} - \vbox{ - \halign{$\hfil#\hfil$&\hskip1in$\hfil#\hfil$\cr - \hbox{Figures in MetaPost}& - \hbox{\TeX\ Document} - \cr - \bigg\downarrow& - \bigg\downarrow - \cr - \fbox{\vrule height.2in depth.133in width0pt - \kern .1in MetaPost\kern.1in} - & - \fbox{\vrule height.2in depth.133in width0pt - \kern .167in \TeX\kern.167in} - \cr - \bigg\downarrow& - \bigg\downarrow - \cr - \hbox{Figures in PostScript}& - \hbox{{\tt dvi} file} - \cr - \bigg\downarrow& - \bigg\downarrow - \cr - \fbox{\vrule height.2in depth.133in width0pt - \kern 1in {\tt dvips} \kern1in} - \span\omit\cr - \bigg\downarrow\span\omit\cr - \hbox{PostScript}\span\omit\cr}} -$$ -\caption[A diagram of the processing for a document with MetaPost figures] - {A diagram of the processing for a \TeX\ document with figures - in MetaPost} -\label{fig0} -\end{figure} To use MetaPost, you prepare an input file containing MetaPost code and then invoke MetaPost, usually by giving a command of the @@ -186,14 +160,18 @@ version 0.9). For instance: $$\begin{verbatim} if known mpversion: message "mp = " & mpversion; - if mpversion > "1.0": message "time has flown by" fi -fi; + if scantokens(mpversion) < 1: message "CMYK color support not available!" fi +fi +\end{verbatim} +$$ +prints +$$\begin{verbatim} +mp = 1.000 \end{verbatim} $$ -prints `{\tt mp = 0.9}'. (Incidentally, \texttt{>} does a simple ASCII -comparison of strings; that works here, because of our particular -version numbering---until and unless MetaPost reaches version 10!) -\index{Creator comment in PostScript output} +The {\tt scantokens} command is described on p.~\pageref{Dscantokens} +and can be utilized to convert strings to numbers. +\index{Creator comment in PostScript output}% The version number is also included in the \texttt{Creator} comment in the PostScript output. @@ -215,13 +193,13 @@ written about MetaPost. For general help, try the \url{metapost@tug.org} mailing list; you can subscribe to this list at \url{http://tug.org/mailman/listinfo/metapost}. -The development is currently hosted at Sarovar; visit -\url{http://www.sarovar.org/projects/metapost} for the current -development team members, sources, and much else. +The development is currently hosted at +\url{https://foundry.supelec.fr/projects/metapost/}; visit this site +for the current development team members, sources, and much else. Please report bugs and request enhancements either on the -\url{metapost@tug.org} list, or through Sarovar. (Please do not send -reports directly to Dr.\ Hobby any more.) +\url{metapost@tug.org} list, or through the address given above. +(Please do not send reports directly to Dr.\ Hobby any more.) \section{Basic Drawing Statements} @@ -233,7 +211,7 @@ $$ \hbox{\verb|draw (20,20)--(0,0)|} $$ draws\index{draw?\texttt{draw}} a diagonal line and $$ \hbox{\verb|draw (20,20)--(0,0)--(0,30)--(30,0)--(0,0)|} $$ draws a polygonal line like this: -$$ \includegraphics{manfig-0} $$ +$$ \includegraphics{manfig-1} $$ \label{Ddrawdot}MetaPost also has a \ttt{drawdot} command to print a single point, as in \ttt{drawdot(30,0)}. @@ -261,7 +239,7 @@ generates a larger version of the above diagram. It is OK to say \verb|0| instead \verb|0cm| because {\tt cm} is really just a conversion factor and {\tt 0cm} just multiplies the conversion factor by zero. (MetaPost understands constructions like {\tt -2cm}\index{multiplication!implicit} as shorthand for \verb|2*cm|). +2cm}\index{multiplication, implicit} as shorthand for \verb|2*cm|). It is convenient to introduce your own scale factor, say $u$. Then you can define coordinates in terms of $u$ and decide later whether you want @@ -329,33 +307,206 @@ file. What does one do with all the PostScript files? They can be included as figures in a \TeX\index{TeX?\TeX} or troff\index{troff} document if you have an output driver that can handle encapsulated PostScript figures. -If your standard \TeX\ macro directory contains a file {\tt -epsf.tex}\index{epsf.tex?\texttt{epsf.tex}}, you can probably include -{\tt fig.1} in a \TeX\ document as follows: -$$ \begin{array}{c} - \hbox{\verb|\input epsf |}\\ - \vdots\\ - \hbox{\verb|$$\epsfbox{fig.1}$$|} - \end{array} -$$ -The \verb|\epsfbox| macro figures out how much room to leave for the figure and -uses \TeX's \verb|\special| command to insert a request for {\tt fig.1}. +They can also be previewed before they are included in a thousand pages +document. The next sections give some more information. + + +\section{Handling MetaPost output} +\label{Dmpoutput} + +\subsection{Previewing MetaPost graphics} +\label{Dpreview} +\index{previewing} + +The output of MetaPost is a variant of PostScript, called Encapsulated +PostScript\index{PostScript!structured} (EPSF\index{EPSF}). MetaPost +graphics can therefore be previewed with any decent PostScript viewer, +e.\,g., GSview\index{GSview}. + +The situation becomes only a little bit fussy when MetaPost output +contains text. By default, MetaPost doesn't produce self-contained EPS +files, e.\,g., font resources and encoding vectors are not stored in +the output. For that reason MetaPost output containing text may be +rendered with wrong fonts, wrong glyphs or with no text at all in a +PostScript viewer. For a long time, the most reliable way for +previewing was to prepare a test document that includes all MetaPost +figures, process that with \TeX\ or \LaTeX\ and \ttindex{dvips} and +display the resulting \ttt{ps} file in a PostScript +viewer.\footnote{There are alternatives, though. \ttindex{mpstoeps} is +a Perl script that automates the process outlined above. +\ttindex{mptopdf} is another tools that converts MetaPost files to +PDF.} + +However, with MetaPost version~1.000 the situation changed. Since that +version MetaPost is able to produce self-contained EPS files, that can +reliably be previewed, may they contain text or not. The +new behaviour can be triggered by setting MetaPost's internal variable +\ttt{prologues}\index{prologues?\texttt{prologues}} to~3. See +section~\ref{Dbtex} for more information on \ttt{prologues}. + + +\subsection{Using MetaPost graphics in \TeX, \LaTeX, pdf\LaTeX, pdf\TeX, Con\TeX{}t and troff} +\label{Dteximport} +\index{TeX?\TeX!importing MetaPost files} +\index{LaTeX?\LaTeX!importing MetaPost files} +\index{pdfLaTeX?pdf\LaTeX!importing MetaPost files} +\index{pdfTeX?pdf\TeX!importing MetaPost files} +\index{ConTeXt?Con\TeX t!importing MetaPost files} +\index{troff!importing MetaPost files} + +How MetaPost figures can be integrated into documents prepared with +\TeX\ and friends depends on the exact format and output driver. +Figure~\ref{fig0} shows the workflow for plain \TeX, \LaTeX\ and the +freely available program \ttindex{dvips}.\footnote{The C source for +\ttt{dvips} comes with the web2c \TeX\ distribution. Similar programs +are available from other sources.} A similar procedure works with +troff: the \ttt{grops} output processor includes PostScript figures when +they are requested via troff's \ttt{\string\X} command. For the PDF +flavour of \TeX\ and \LaTeX\ the situation is a little bit different. +The next paragraphs give brief information on some popular \TeX\ formats +and output drivers. -It is also possible to include MetaPost output in a {\em troff\/} document. -The {\tt -mpictures\/} macro package defines a command \verb|.BP| that includes -an encapsulated PostScript file. For instance, the {\em troff\/} command -$$ \hbox{\verb|.BP fig.1 3c 3c|} $$ -includes {\tt fig.1} and specifies that its height and width are both three -centimeters. +\begin{figure}[htp] +$$ \includegraphics{manfig-0} $$ +\caption[A diagram of the processing for a document with MetaPost figures] + {A diagram of the processing for a \TeX\ document with figures + in MetaPost} +\label{fig0} +\end{figure} + +\paragraph{\TeX} +\TeX\ users can import EPS graphics by first loading package +\ttt{epsf}\index{epsf.tex?\texttt{epsf.tex}} via \verb+\input epsf+ and +then issuing the command +$$ \verb+\epsfbox{+\descr{filename}\verb+}+ $$% +\index{epsfbox?\texttt{\string\epsfbox}} +to load an EPS file, e.\,g., \verb+\epsfbox{fig.1}+. + +\paragraph{\LaTeX} +For \LaTeX\ documents the procedure is similar: first package +\ttindex{graphicx} has to be loaded by putting +\verb+\usepackage{graphicx}+ into the document preamble and then EPS +files can be loaded via +$$ \verb+\includegraphics{+\descr{filename}\verb+}+ $$% +\index{includegraphics?\texttt{\string\includegraphics}} +e.\,g., \verb+\includegraphics{fig.1}+. + +As can be seen in figure~\ref{fig0} graphic files are never included in a +\TeX\index{TeX?\TeX!importing MetaPost files} or +\LaTeX\index{LaTeX?\LaTeX!importing MetaPost files} run. Instead, +\TeX\ and \LaTeX\ only read bounding box information off the PostScript +file, reserve as much space on a page as the graphic +occupies and write a reference to the corresponding file into the +\ttt{dvi} output. The graphic file is only included in the subsequent +run of an output driver, that can handle PostScript files, e.\,g., +\ttindex{dvips}. + +\paragraph{pdf\LaTeX} +The application pdf\LaTeX, when run in PDF mode, is both, a +\LaTeX\ interpreter and an output driver for the PDF document format. +For that reason graphic files are included in a single +pdf\LaTeX\ run. In contrast to \ttt{dvips}, pdf\LaTeX\ can't process +general PostScript files, but only so-called purified +EPS\index{PostScript!purified} files, which may only use a restricted +set of PostScript language features. Fortunately, MetaPost output +\emph{is} purified EPS, so we are in luck. Since +\ttt{mps}\index{files!mps?\texttt{mps}} is pdf\LaTeX's default +extension for purified EPS files, we can +\begin{itemize} +\item tell pdf\LaTeX\ to handle MetaPost's numbered files according to +\ttt{mps} file rules, or +\item change the file extension of MetaPost output to \ttt{mps}. +\end{itemize} + +For the conventional first approach we have to add the line +$$ \verb+\DeclareGraphicsRule{*}{mps}{*}{}+ $$% +\index{DeclareGraphicsRule?\texttt{\string\DeclareGraphicsRule}}% +to the document preamble after loading package \ttt{graphicx}. That +declaration tells pdf\LaTeX\ to load \emph{all} files with unknown file +extensions as \ttt{mps} files. Refer to the documentation of the +\ttt{graphicx} and \ttt{graphics} packages for more details. + +Since MetaPost version~1.000 the second approach is +recommended.\footnote{For handling MetaPost file extensions in MetaPost +source files seems to be the more natural place than \LaTeX\ sources. +Moreover, setting the MetaPost file extension to \ttt{mps} prevents from +file extension pollution and you only have to register one new extension +with your PostScript viewer, \ttt{.mps}, instead of \ttt{.0}, \ttt{.1}, +\ttt{.2}, etc.} The MetaPost primitive \verb+filenametemplate+ can be +used to set the file extension of MetaPost output to \ttt{mps} (see +section~\ref{Dfilenametemplate}). Hence, no \verb+\DeclareGraphicsRule+ +declaration is needed. Moreover, the file extension can then be omitted +in the \verb+\includegraphics+ command. + +\paragraph{\LaTeX\ and pdf\LaTeX} +If you want to keep flexible and be able to compile your documents with +both, \LaTeX\ and pdf\LaTeX, there are some things to take care of. If +you're using the conventional \verb+\DeclareGraphicsRule+ declaration, +that may only be activated if pdf\LaTeX\ runs in PDF mode. A +fully-featured declaration should therefore look like this: -\subsection{Filename templates} +$$ +\begin{verbatim} +\usepackage{graphicx} +\usepackage{ifpdf} +\ifpdf + \DeclareGraphicsRule{*}{mps}{*}{} +\fi +\end{verbatim} +$$ -Metapost has support for output file-name templates. These templates +If you're using the \ttt{filenametemplate} method the \ttt{mps} file +extension should not be omitted in \verb+\includegraphics+ commands, +since \ttt{mps} is not part of \LaTeX's file name completion scheme, by +default. If the \ttt{mps} extension is present, \LaTeX\ handles those +files as \ttt{eps} files, which is obviously correct. For more +information see the description of \verb+\DeclareGraphicsExtensions+% +\index{DeclareGraphicsExtensions?\texttt{\string\DeclareGraphicsExtensions}} +and \verb+\DeclareGraphicsRule+ in the documentaion of packages +\ttt{graphicx} and \ttt{graphics}. + +\paragraph{pdf\TeX} +Users of plain pdf\TeX\ should refer to the standalone macros of the +\ttindex{mptopdf} bundle, that can be found at +\url{http://context.aanhet.net/mptopdf.htm}. + +\paragraph{Con\TeX t} +In Con\TeX t\index{ConTeXt?Con\TeX t} support of MetaPost is integrated +in the kernel. Apart from inline graphics (see MetaFun\index{MetaFun} +manual), one can embed graphics explictely with the +\verb+\externalfigure+% +\index{externalfigure?\texttt{\string\externalfigure}} command. +Numbered graphics are recognized automatically, as are graphics with the +\ttt{mps} suffix. Special features like shading, transparency, image +inclusion, color spaces and such are handled automatically. In practice +Con\TeX t users will probably define MetaPost graphics in the document +source which has some advantages, like a more natural interfacing with +document properties, font support, and automatic processing. Support +for MetaPost inclusion is present in the versions MkII as well as MkIV, +but the used methods are slightly different. Future versions of MkIV +will support an even more tight integration. + +\paragraph{troff} +It is also possible to include MetaPost output in a GNU \emph{troff} +document. The \ttt{-mpspic}\index{mpspic?\texttt{-mpspic}} macro +package defines a command \verb|.PSPIC|\index{PSPIC?\texttt{.PSPIC}} +that includes an encapsulated PostScript file. For instance, the +\emph{troff} command +$$ \hbox{\verb|.PSPIC fig.1|} $$ +includes \ttt{fig.1}, using the natural height and width of the +image as given in the file's bounding box. + + +\subsection{File name templates} +\suppressfloats[t] + +MetaPost has support for output file name templates. These templates use \ttt{printf}-style escape sequences and are re-evaluated before each figure is written to disk. -The command to use is \ttt{filenametemplate}, and it accepts a string -as argument. The syntax is as simple as: +The command to use is \ttt{filenametemplate}% +\index{filenametemplate?\texttt{filenametemplate}}\label{Dfilenametemplate}, +and it accepts a string as argument. The syntax is as simple as: \begin{center}\begin{tabular}{l} \verb|filenametemplate "%j-%3c.mps";|\\ @@ -371,7 +522,7 @@ sequences are possible, see table~\ref{tab:fntmpl} for details. \def\d{$\langle$0-9$\rangle$} \begin{table} -\begin{center}\begin{tabular}{ll} +\begin{center}\begin{tabular}{>{\ttfamily}ll} \%\% & A percent sign \\ \%\,j & The current jobname\\ \%\d c & The charcode value\\ @@ -385,6 +536,27 @@ sequences are possible, see table~\ref{tab:fntmpl} for details. \label{tab:fntmpl} \end{table} +The \ttt{filenametemplate} primitive can also be helpful for naming +graphic files individually, yet keeping all MetaPost sources in one file. +E.\,g., collecting different diagram sources in a file \ttt{fig.mp} +$$ +\begin{verbatim} +filenametemplate "fig-quality.mps"; +beginfig(1); + ... +endfig; + +filenametemplate "fig-cost-vs-productivity.mps"; +beginfig(2); + ... +endfig; +\end{verbatim} +$$ +it might be easier to recall the correct diagram names in the +\TeX\ document than with numbered file names. Note, the argument to +\ttt{beginfig} is not relevant as long as there's no \ttt{\%c} pattern +in the file name template string. + To ensure compatibility with older files, the default value of \ttt{filenametemplate} is \verb|%j.%c|. If you assign an empty string, it will revert to that default. @@ -394,8 +566,9 @@ If you assign an empty string, it will revert to that default. \label{curves} MetaPost is perfectly happy to draw curved lines as well as straight ones. -A \verb|draw| statement with the points separated by \verb|..| draws -a smooth curve through the points. For example consider the result of +A \verb|draw| statement with the points separated by +\verb|..|\index{..?\texttt{..}} draws a smooth curve through the points. +For example consider the result of $$ \hbox{\verb|draw z0..z1..z2..z3..z4|} $$ after defining five points as follows: $$\begin{verbatim} @@ -794,7 +967,7 @@ of {\tt z1}, {\tt z2}, {\tt z3}, and~{\tt z6}. The next step in the construction of Figure~\ref{fig12} is to define points {\tt z4} and {\tt z5} equally spaced along the line from {\tt z3} to {\tt z6}. Since this operation comes up often, MetaPost has a special syntax for it. This -mediation construction\index{mediation} +mediation construction\index{mediation}\index{[]?\texttt{[]}!mediation} $$ \hbox{\verb|z4=1/3[z3,z6]|} $$ means that {\tt z4} is $1\over3$ of the way from $z3$ to $z6$; i.e., $$ {\tt z4}={\tt z3}+{1\over3}({\tt z6}-{\tt z3}). $$ @@ -974,11 +1147,13 @@ determine {\tt T}. Transforms can also be applied to paths, pictures, pens, and transforms. The color\index{color type} type is like the pair type, except -that it has three components instead of two and each component is normally between 0 and 1. Like pairs, colors can be added, subtracted, used in mediation expressions, or multiplied or divided by numerics. Colors can be specified in terms of the predefined constants {\tt black}\index{black?\texttt{black}}\label{Dblack}, {\tt -white}\index{white?\texttt{white}}\label{Dwhite}, -{\tt red}\index{red?\texttt{red}}\label{Dred}, -{\tt green}\index{green?\texttt{green}}\label{Dgreen}, -{\tt blue}\index{blue?\texttt{blue}}\label{Dblue}, or the red, green, and +that it has three components instead of two and each component is +normally between 0 and 1. Like pairs, colors can be added, +subtracted, used in mediation expressions, or multiplied or divided +by numerics. Colors can be specified in terms of the predefined +constants \ttindex{black}\label{Dblack}, \ttindex{white}\label{Dwhite}, +\ttindex{red}\label{Dred}, \ttindex{green}\label{Dgreen}, +\ttindex{blue}\label{Dblue}, or the red, green, and blue components can be given explicitly. Black is {\tt (0,0,0)} and white is {\tt (1,1,1)}. A level of gray such as {\tt (.4,.4,.4)} can also be specified as {\tt 0.4white}. Although color typed variables may be @@ -1045,7 +1220,7 @@ an elliptical pen or a polygonal pen. \subsection{Operators} -There are many different ways to make expressions of the nine basic +There are many different ways to make expressions of the ten basic types, but most of the operations fit into a fairly simple syntax with four levels of precedence as shown in Figure~\ref{syexpr}. There are primaries\index{primary?\tdescr{primary}}, @@ -1119,12 +1294,18 @@ and}\index{and?\texttt{and}} and {\tt or}\index{or?\texttt{or}}. The {\tt and} operator is a \tdescr{primary binop} and the {\tt or} operator is a \tdescr{secondary binop}. -The basic operations on strings are concatenation\index{concatenation} and -substring construction. +The basic operations on strings are concatenation\index{concatenation}, +substring construction and calculating the length of a string. The \tdescr{tertiary binop} \verb|&|\index{&?\texttt{\&}}\label{Damp} implements concatenation; e.g., $$ \hbox{\verb|"abc" & "de"|} $$ -produces the string \verb|"abcde"|. For substring construction, the +produces the string \verb|"abcde"|. The {\tt +length}\index{length?\texttt{length}}\label{DlengthString} operator +returns the number of characters in a string if the argument is a +\tdescr{string primary}; e.g., +$$ \hbox{\verb|length "abcde"|} $$ +returns \verb|5|. Another application of the {\tt length} operator is +discussed on p.\ \pageref{Dlength}. For substring construction, the \tdescr{of operator} {\tt substring}\index{substring of?\texttt{substring of}}\label{Dsubstr} is used like this: $$ {\tt substring}\, \descr{pair expression} \,{\tt of}\, \descr{string primary} $$ @@ -1268,7 +1449,7 @@ binop}. Thus {\tt 2/3x}\index{parsing irregularities} is two thirds of There are also operators for extracting numeric subfields from pairs, colors, cmykcolors, and even transforms. If {\tt p} is a \tdescr{pair primary}, {\tt xpart p}\index{xpart?\texttt{xpart}}\label{Dxprt} and -{\tt ypart p}\index{ypart}\label{Dyprt} extract its components so that +{\tt ypart p}\index{ypart?\texttt{ypart}}\label{Dyprt} extract its components so that $$ \hbox{\tt (xpart p, ypart p)} $$ is equivalent to~{\tt p} even if {\tt p} is an unknown pair that is being used in a linear equation. Similarly, a color {\tt c} is equivalent @@ -1424,7 +1605,8 @@ numeric, path, transform, color, string, boolean, picture, and pen. The only restriction is that you cannot give explicit numeric subscripts in a variable declaration. Do not give the illegal declaration $$ \hbox{\tt numeric q1, q2, q3;} $$ -use the generic subscript\index{subscript!generic} symbol {\tt []}\index{[]?\texttt{[]}} +use the generic subscript\index{subscript!generic} symbol +{\tt []}\index{arrays}\index{[]?\texttt{[]}!array} instead, to declare the whole array: $$ \hbox{\tt numeric q[];} $$ You can also declare ``multidimensional'' arrays\index{arrays!multidimensional}. @@ -1575,11 +1757,12 @@ that \TeX\ would understand since MetaPost gets height and width information by reading a {\tt tfm}\index{tfm file?{\tt tfm} file}\index{files!tfm?{\tt tfm}} file. (This is explained in {\sl The \TeX book\/} \cite{kn:a}.) It should be possible to use built-in -PostScript fonts, but the names for them are system-dependent. Some -typical ones are {\tt ptmr8r} for Times-Roman, \ttt{pplr8r} for -Palatino, and \ttt{phvr} for Helvetica. The Fontname document, +PostScript\index{PostScript!fonts} fonts, but the names for +them are system-dependent. Some typical ones are {\tt ptmr8r} for +Times-Roman\index{Times-Roman}, \ttt{pplr8r} for Palatino\index{Palatino}, +and \ttt{phvr} for Helvetica\index{Helvetica}. The Fontname document, available at \url{http://tug.org/fontname}, has much more information -about font names and TeX. A \TeX\index{TeX fonts?\TeX\ fonts} font such +about font names and \TeX. A \TeX\index{TeX?\TeX!fonts} font such as {\tt cmr10} is a little dangerous because it does not have a space character or certain ASCII symbols. @@ -1708,6 +1891,7 @@ something like this: && \qquad \dots \end{eqnarray*} +\label{Dtroffmode} On Unix\footnote{Unix is a registered trademark of Unix Systems Laboratories.}\index{Unix\reg} and other Web2C-based systems, the option {\tt -troff} to MetaPost tells the preprocessor that {\tt btex} @@ -1733,7 +1917,7 @@ For historical reasons, MetaPost sets \ttt{prologues} to~1 when the {\tt -troff} option is given on the command line. \item When \ttt{prologues} is 2, the MetaPost output is EPSF and assumes -that the text comes from PostScript fonts +that the text comes from PostScript\index{PostScript!fonts} fonts provided by the ``environment'', such as the document viewer or embedded application using the output. MetaPost will attempt to set up the font encodings correctly, based on \ttt{fontmapfile} and @@ -1749,9 +1933,16 @@ It is worth noting that the default value \ttt{prologues:=0} is sufficient for graphics included in \TeX-based documents. Also, the \ttt{prologues} variable is irrelevant when processing MetaPost files through the \ttindex{mptopdf} utility (part of the \ConTeXt\ distribution), because PDF files are, by nature, -stand-alone. The details on how to include PostScript figures in a paper +stand-alone. Moreover, the value of \ttt{prologues} has no effect on +\MF\ fonts in your MetaPost files, i.\,e., MetaPost never embeds such +fonts. Only output drivers, e.\,g., \ttt{dvips} or pdf\LaTeX\ will +handle those. + +The details on how to include PostScript figures in a paper done in \TeX\ or troff are system-dependent. They can generally be found -in manual pages and other on-line documentation. The manual for the +in manual pages and other on-line documentation, but have a look at +section~\ref{Dteximport} of this manual for some brief instructions that +in many cases should work. The manual for the widely-used Dvips processor is in a file \ttt{dvips.texi}, included in most distributions, and is available online at \url{http://tug.org/texinfohtml/dvips.html}, among many other places and @@ -1774,19 +1965,19 @@ If \ttt{prologues} is set to~2, any used fonts in the output file are automatically re-encoded, and the encoding vector file specified in the fontmap entry will be embedded in the output file. If \ttt{prologues} is set to~3, MetaPost will also attempt to include -(a subset of) the used PostScript fonts. For this to work, it needs to -acquire font map information. +(a subset of) the used PostScript\index{PostScript!fonts} fonts. For +this to work, it needs to acquire font map information. The code is based on the font library used by pdf\TeX. Following in the footsteps of pdf\TeX, there are two new associated primitives: \ttindex{fontmapfile} and \ttindex{fontmapline}. Here is a simple -example, specifying the map file for Latin Modern fonts in \LaTeX\ -(T1) encoding: +example, specifying the map file for Latin Modern fonts in YandY +(\LaTeX\ LY1) encoding: \begin{center}\begin{tabular}{l} \verb|prologues:=2;|\\ -\verb|fontmapfile "ec-public-lm.map";|\\ +\verb|fontmapfile "texnansi-lm.map";|\\ \verb|beginfig(1);|\\ -\verb| draw "Helló, világ" infont "ec-lmr10";|\\ +\verb| draw "Helló, világ" infont "texnansi-lmr10";|\\ \verb|endfig;| \end{tabular}\end{center} @@ -1800,7 +1991,8 @@ inside the figure: \verb| draw "Hello, world" infont "pplbo8r";|\\ \verb|endfig;| \end{tabular}\end{center} -This will attempt to reencode the PostScript font URWPalladioL-Bold +This will attempt to reencode the PostScript font +URWPalladioL-Bold\index{URWPalladioL-Bold}\index{Palatino} whose tfm file is pplbo8r.tfm. The encoding is found in the file 8r.enc, and will be included into the output file. @@ -1831,7 +2023,7 @@ pdftex.map}, depending on whether or not troff mode is enabled. If statement. Again, this is for backward compatibility only. -\subsection{The {\tt infont} operator} +\subsection{The \texttt{infont} operator} \label{Sinfont} Regardless of whether you use \TeX\ or troff, all the real work of @@ -1943,7 +2135,7 @@ example, the {\tt fill} statement in Figure~\ref{fig20} builds a closed path by extending the roughly semicircular path~{\tt p}. This path has a counter-clockwise orientation, but that does not matter because the {\tt fill} statement uses PostScript's\index{PostScript} non-zero -winding\index{winding number} number rule~\cite{ad:red}. +winding\index{winding number} number rule~\cite{ad:red2}. \begin{figure}[htp] $$ \begin{verbatim} @@ -1971,11 +2163,11 @@ values, mapping to four possible color models: $$ \begin{tabular}{|l|l|} Actual input & Remapped meaning\\ -{\tt withcolor} $\descr{rgbcolor} c$ & withrgbcolor $c$\\ -{\tt withcolor} $\descr{cmykcolor} c$ & withcmykcolor $c$\\ -{\tt withcolor} $\descr{numeric} c$ & withgreyscale $c$\\ -{\tt withcolor} $\descr{false}$ & withoutcolor \\ -{\tt withcolor} $\descr{true}$ & $\descr{current default color model}$\\ +{\tt withcolor} $\descr{rgbcolor} c$ & withrgbcolor\index{withrgbcolor?\texttt{withrgbcolor}} $c$\\ +{\tt withcolor} $\descr{cmykcolor} c$ & withcmykcolor\index{withrgbcolor?\texttt{withcmykcolor}} $c$\\ +{\tt withcolor} $\descr{numeric} c$ & withgreyscale\index{withrgbcolor?\texttt{withgreyscale}} $c$\\ +{\tt withcolor} $\descr{false}$ & withoutcolor\index{withrgbcolor?\texttt{withoutcolor}} \\ +{\tt withcolor} $\descr{true}$ & $\descr{current default color model}$\\ \end{tabular} $$ @@ -2442,7 +2634,7 @@ identity} is a no-op. The syntax for transform expressions and transformation operators is given in Figure~\ref{sytrans}. It includes two more options for \tdescr{transformer}:\index{reflectedabout?\texttt{reflectedabout}} -$$ \hbox{\tt reflectededabout(}p, q\hbox{\tt )} $$ +$$ \hbox{\tt reflectedabout(}p, q\hbox{\tt )} $$ reflects about the line defined by points $p$ and $q$; and\index{rotatedaround?\texttt{rotatedaround}} $$ \hbox{\tt rotatedaround(}p,\theta\hbox{\tt )} $$ @@ -2704,12 +2896,12 @@ paths created by polygonal pens. See Section~\ref{sec.pens}, p.\ If you want to attach a special bit of PostScript code, you can use $$ {\tt withprescript} \descr{string expression} -$$ +$$\index{withprescript?\texttt{withprescript}}\label{Dwithpre}% and $$ {\tt withpostcript} \descr{string expression} -$$ -the strings will be written to the output file before and after the +$$\index{withpostscript?\texttt{withpostscript}}\label{Dwithpost}% +The strings will be written to the output file before and after the current object, each beginning on their own line. You can specify multiple {\tt withprescript} or {\tt withpostscript} options if you like. @@ -3118,11 +3310,6 @@ $$ \end{table} -The {\tt image}\index{image?\texttt{image}}\label{Dimage} macro from -Plain MetaPost takes any text as its argument, executes it, and returns -the resulting picture. The value of {\tt currentpicture} is not -affected. - There are two more primitive drawing commands that do not accept any drawing options. One is the {\tt setbounds} command that was discussed in Section~\ref{meas}; the other is the {\tt clip} @@ -3163,8 +3350,11 @@ All the primitive drawing operations would be useless without one last operation called {\tt shipout}. The statement\index{shipout?\texttt{shipout}}\label{Dship} $$ {\tt shipout}\, \descr{picture expression} $$ -This writes out a picture as a PostScript\index{PostScript} file whose -name ends {\tt.}{\it nnn}, where {\tt nnn} is the decimal representation +writes out a picture as a PostScript\index{PostScript} file whose +file name is determined by +{\tt filenametemplate}\index{filenametemplate?\texttt{filenametemplate}} +(see section~\ref{Dfilenametemplate}). By default, the file name ends +{\tt.}{\it nnn}, where {\tt nnn} is the decimal representation of the value of the internal variable\index{internal variables}\index{variables!internal} {\tt charcode}\index{charcode?\texttt{charcode}}\label{Dcharcode}. (The name @@ -3173,6 +3363,118 @@ Normally, {\tt beginfig}\index{beginfig?\texttt{beginfig}} sets {\tt charcode}, and {\tt endfig}\index{endfig?\texttt{endfig}} invokes {\tt shipout}. +\subsection{Directing Output to a Picture Variable} +Sometimes, it might be desirable to save the output of a drawing +operation and re-use them later. This can easily be done with +MetaPost primitives like \ttt{addto}. On the other hand, since the +higher-level drawing commands defined in the Plain macro package +always write to the +\ttt{currentpicture}\index{currentpicture?\texttt{currentpicture}}, +saving their output required to temporarily save \ttt{currentpicture}, +reset it to \ttt{nullpicture}\index{nullpicture?\texttt{nullpicture}}, +execute the drawing operations, save the \ttt{currentpicture} to a +new \ttt{picture} variable and finally restore \ttt{currentpicture} to +the saved state. In MetaPost version~0.60 a new macro +$$ \hbox{\tt image( $\descr{drawing commands}$ )} $$% +\index{image?\texttt{image}}\label{Dimage}% +was introduced that eases this task. It takes as input a sequence of arbitrary +drawing operations and returns a \ttt{picture} variable containing the +corresponding output, without affecting {\tt currentpicture}. + +As an example, in the code of figure~\ref{fig55} an object \ttt{wheel} has +been defined that saves the output of two \ttt{draw} operations as follows: +\begin{figure}[b] +$$ \includegraphics{manfig-55} $$ +\caption{Copying objects with the \ttt{image} operator.} +\label{fig55} +\end{figure} +$$\begin{verbatim} +picture wheel; +wheel := image( + draw fullcircle scaled 2u xscaled .8 rotated 30; + draw fullcircle scaled .15u xscaled .8 rotated 30; +); +\end{verbatim} +$$ +This \ttt{wheel} object is re-used in the definition of another object \ttt{car}. +Figure~\ref{fig55} shows three \ttt{car} objects drawn with two different slant +values. + + +\subsection{Extracting Information from Pictures} +MetaPost pictures are composed of stroked lines, filled outlines, pieces +of typeset text, clipping paths\index{clip?\texttt{clip}}, and +{\tt setbounds}\index{setbounds?\texttt{setbounds}} paths. (A {\tt setbounds} +path gives an artificial bounding box as is needed for \TeX\ output.) +A picture can have many components of each type. They can be accessed via +an iteration of the form +$$ {\tt for}\ \descr{symbolic token}\ {\tt within}\ + \descr{picture expression}\hbox{\tt:}\ \descr{loop text}\ {\tt endfor} +$$\index{for within?\texttt{for within}}\label{Dforwithin}% +The \tdescr{loop text} can be anything that is balanced with respect to +{\tt for} and {\tt endfor}. The \tdescr{symbolic token} is a loop variable that +scans the components of the picture in the order in which they were drawn. The +component for a clipping or {\tt setbounds} path includes everything the path +applies to. Thus if a single clipping or {\tt setbounds} path applies to +everything in the \tdescr{picture expression}, the whole picture could be +thought of as one big component. In order to make the contents of such a picture +accessible, the {\tt for}\ldots{\tt within} iteration ignores the enclosing +clipping or {\tt setbounds} path in this case. + +Once the {\tt for}\ldots{\tt within} iteration has found a picture component, +there are numerous operators for identifying it and extracting relevant +information. The operator +$$ {\tt stroked}\ \descr{primary expression} $$\index{stroked?\texttt{stroked}}\label{Dstroked}% +tests whether the expression is a known picture whose first component is a +stroked line. Similarly, the {\tt filled}\index{filled?\texttt{filled}}\label{Dfilled} +and {\tt textual}\index{textual?\texttt{textual}}\label{Dtextual} operators +return {\tt true} if the first component is a filled outline or a piece of +typeset text. The {\tt clipped}\index{clipped?\texttt{clipped}}\label{Dclipped} +and {\tt bounded}\index{bounded?\texttt{bounded}}\label{Dbounded} operators +test whether the argument is a known picture that starts with a clipping +path or a {\tt setbounds} path. This is true if the first component is +clipped or bounded or if the entire picture is enclosed in a clipping or +{\tt setbounds} path. + +There are also numerous part extraction operators that test the first component +of a picture. If {\tt p} is a picture and {\tt stroked p} is true, +{\tt pathpart p}\index{pathpart?\texttt{pathpart}}\label{Dpathpart} is the +path describing the line that got stroked, +{\tt penpart p}\index{penpart?\texttt{penpart}}\label{Dpenpart} is the pen +that was used, {\tt dashpart p}\index{dashpart?\texttt{dashpart}}\label{Ddashpart} +is the dash pattern, and the color is +$$ \hbox{\tt (redpart p, greenpart p, bluepart p)} $$% +\index{redpart?\texttt{redpart}}\index{greenpart?\texttt{greenpart}}\index{bluepart?\texttt{bluepart}} +If the line is not dashed, {\tt dashpart p} returns an empty picture. + +The same part extraction operators work when {\tt filled p} is true, except +that {\tt dashpart p} is not meaningful in that case. For text components, +{\tt textual p} is true, +{\tt textpart p}\index{textpart?\texttt{textpart}}\label{Dtextpart} +gives the text that got typeset, +{\tt fontpart p}\index{fontpart?\texttt{fontpart}}\label{Dfontpart} +gives the font that was used, and {\tt xpart~p}\index{xpart?\texttt{xpart}}\index{ypart?\texttt{ypart}}\index{xxpart?\texttt{xxpart}}% +\index{xypart?\texttt{xypart}}\index{yxpart?\texttt{yxpart}}\index{yypart?\texttt{yypart}}, +{\tt ypart~p}, {\tt xxpart~p}, {\tt xypart~p}, {\tt yxpart~p}, {\tt yypart~p} +tell how the text has been shifted, rotated, and scaled. The {\tt redpart}, +{\tt greenpart}, and {\tt bluepart} operators also work for text components. + +When {\tt clipped p} or {\tt bounded p} is true, {\tt pathpart p} gives the +clipping or {\tt setbounds} path and the other part extraction operators are +not meaningful. Such non-meaningful part extractions do not generate +errors---they return null values instead: +the trivial path {\tt (0,0)} for {\tt pathpart}, +{\tt nullpen}\index{nullpen?\texttt{nullpen}}\label{Dnlpen} for {\tt penpart}, +an empty picture for {\tt dashpart}, +zero for {\tt redpart}, {\tt greenpart}, {\tt bluepart}, +and the null string for {\tt textpart} or {\tt fontpart}. + +One final operator for extracting information from a picture is +$$ {\tt length}\ \descr{picture primary} $$\index{length?\texttt{length}}\label{DlengthPicture}% +This returns the number of components that a {\tt for}\ldots {\tt within} +iteration would find. + + \section{Macros} \label{macros} @@ -3258,7 +3560,7 @@ The following example illustrates how locality works: && \hbox{\tt endfig;}\\ && \hbox{\tt show x23, y3a;} \end{eqnarray*} -The result of the {\tt show}\index{show} command is +The result of the {\tt show}\index{show?\texttt{show}} command is $$\begin{verbatim} >> 3.1 >> y3a @@ -3290,7 +3592,7 @@ discarded. The main purpose of the {\tt save} statement is to allow macros to use variables without interfering with existing variables or variables in other calls to the same macro. For example, the predefined macro {\tt -whatever}\index{whatever} has the \tdescr{replacement text} +whatever}\index{whatever?\texttt{whatever}} has the \tdescr{replacement text} $$ \hbox{\tt begingroup save ?; ? endgroup} $$ This returns an unknown numeric quantity, but it is no longer called question mark since that name was local to the group. Asking the name @@ -3680,7 +3982,8 @@ $$ {\tt vardef}\, \descr{generic variable} $$ where a \tdescr{generic variable}\index{generic variable?\tdescr{generic variable}} is a variable name with numeric subscripts replaced by the generic subscript\index{subscript!generic} symbol {\tt -[]}\index{[]?\texttt{[]}}. In other words, the name following {\tt +[]}\index{[]?\texttt{[]}!vardef macro?\texttt{vardef} macro}. In other +words, the name following {\tt vardef} obeys exactly the same syntax as the name given in a variable declaration. It is a sequence of tags and generic subscript symbols starting with a tag, where a tag\index{tags} is a symbolic token that is @@ -4395,6 +4698,31 @@ $$ \end{figure} +\section{Reading and Writing Files} +File access was one of the new language features introduced in version~0.60 +of the MetaPost language. A new operator +$$ {\tt readfrom}\ \descr{file name} $$\index{readfrom?\texttt{readfrom}}\label{Dreadfrom}% +returns a string giving the next line of input from the named +file\index{files!reading}. The \tdescr{file name} can be any primary +expression of type string. If the file has ended or cannot be read, the +result is a string consisting of a single null character. The preloaded +{\tt plain} macro package introduces the name +{\tt EOF}\index{EOF?\texttt{EOF}}\label{Deof} for this string. After +{\tt readfrom} has returned {\tt EOF}, additional reads from the same file +cause the file to be reread from the start. + +The opposite of {\tt readfrom} is the command +$$ {\tt write}\ \descr{string expression}\ {\tt to}\ \descr{file name} $$% +\index{write to?\texttt{write to}}\label{Dwrite}% +This writes\index{files!writing} a line of text to the specified output file, +opening the file first if necessary. All such files are +closed\index{files!closing} automatically when the program terminates. They +can also be closed explicitly by using {\tt EOF}\index{EOF?\texttt{EOF}} +as the \tdescr{string expression}. The only way to tell if a {\tt write} +command has succeeded is to close the file and use {\tt readfrom} to look +at it. + + \section{Utility Routines} \index{utility routines} @@ -4436,7 +4764,7 @@ typesets verbatim text. That is, \texttt{btex~s~etex} typesets the literal character `s'; \texttt{TEX(s)} typesets the value of the MetaPost text variable~$s$. -\index{latex?\LaTeX, typesetting labels with} In version 0.9, +\index{LaTeX?\LaTeX!typesetting labels with} In version 0.9, \texttt{TEX.mp} acquired two additional routines to facilitate using \LaTeX\ to typeset labels: \texttt{TEXPRE} and \texttt{TEXPOST}. Their values are remembered, and included before and after (respectively) each @@ -4701,7 +5029,6 @@ treatment of included \TeX\ material. \appendix - \section{Reference Manual} \let\svtopfrac=\topfraction % prepare to restore values at end of this appendix @@ -4747,11 +5074,11 @@ Table~\ref{pvartab} lists predefined variables of other types. Table~\ref{consttab} lists predefined constants. Some of these are implemented as variables whose values are intended to be left unchanged. -Tables \ref{optabA}--\ref{optabD} summarize MetaPost operators and list +Table~\ref{optab} summarizes MetaPost operators and lists the possible argument and result types for each one. A ``--'' entry for the left argument indicates a unary operator; ``--'' entries for both arguments indicate a nullary operator. Operators that take suffix -parameters are not listed in these tables because they are treated as +parameters are not listed in this table because they are treated as ``function-like macros''. The last two tables are Table~\ref{cmdtab} for commands and @@ -4798,7 +5125,7 @@ $$\begin{tabular}{|l|r|l|} \pl\tt bboxmargin& \pageref{Dbbmargin}& extra space allowed by {\tt bbox} (default 2{\tt bp})\\\hline \tt charcode& \pageref{Dcharcode}& - the number of the next character to be output\\\hline + the number of the current figure\\\hline \bx\tt circmargin& \pageref{Dcmargin}& clearance around contents of a circular or oval box\\\hline \tt day& --& @@ -4875,6 +5202,7 @@ $$ \index{time?\texttt{time}}\index{tracingtitles?\texttt{tracingtitles}}\index{year?\texttt{year}} \end{table} + \begin{table}[htp] \caption{Other Predefined Variables} $$\begin{tabular}{|l|l|r|l|} @@ -4902,6 +5230,7 @@ $$ \label{pvartab} \end{table} + \begin{table}[htp] \caption{Predefined Constants} $$\begin{tabular}{|l|l|r|l|} @@ -4934,6 +5263,8 @@ $$\begin{tabular}{|l|l|r|l|} Smallest positive MetaPost number [$1\over65536$]\\\hline \pl\tt evenly& picture& \pageref{Devenly}& Dash pattern for equal length dashes\\\hline +\pl\tt EOF& string& \pageref{Deof}& + Single null character\\\hline \tt false& boolean& \pageref{Dfalse}& The boolean value {\it false\/}\\\hline \pl\tt fullcircle& path& \pageref{Dfcirc}& @@ -4956,6 +5287,8 @@ $$\begin{tabular}{|l|l|r|l|} One millimeter in {\tt bp} units [2.83464]\\\hline \tt mpversion& string& \pageref{Dmpversion}& MetaPost version number\\\hline +\tt nullpen& pen& \pageref{Dnlpen}& + Empty pen\\\hline \tt nullpicture& picture& \pageref{Dnlpic}& Empty picture\\\hline \pl\tt origin& pair& --& @@ -4998,464 +5331,9 @@ $$ \index{unitsquare?\texttt{unitsquare}} \end{table} -\begin{table}[htp] -\caption{Operators (Part 1)} -$$\begin{tabular}{|l|l|l|l|r|l|} -\hline -\multicolumn1{|c}{Name}& \multicolumn3{|c}{Argument/result types}& - \multicolumn1{|c}{Page}& \multicolumn1{|c|}{Explanation}\\ -\cline{2-4} -& Left& Right& Result& & \\ -\hline -\hline -\tt \verb|&|& string& string& string& \pageref{Damp}& - Concatenation---works for paths $l\hbox{\tt\&}r$ if\\ -& path& path& path& & - $r$ starts exactly where the $l$ ends\\\hline -\tt \verb|*|& numeric& (cmyk)color& (cmyk)color& \pageref{Dmldiv}& - Multiplication\\ -& & numeric& numeric& & - \\ -& & pair& pair& & - \\\hline -\tt \verb|*|& (cmyk)color& numeric& (cmyk)color& \pageref{Dmldiv}& - Multiplication\\ -& numeric& & numeric& & - \\ -& pair& & pair& & - \\\hline -\tt \verb|**|& numeric& numeric& numeric& \pageref{Dpow}& - Exponentiation\\\hline -\tt \verb|+|& (cmyk)color& (cmyk)color& (cmyk)color& \pageref{Dadd}& - Addition\\ -& numeric& numeric& numeric& & - \\ -& pair& pair& pair& & - \\\hline -\tt \verb|++|& numeric& numeric& numeric& \pageref{Dpyadd}& - Pythagorean addition $\sqrt{l^2+r^2}$\\\hline -\tt \verb|+-+|& numeric& numeric& numeric& \pageref{Dpysub}& - Pythagorean subtraction $\sqrt{l^2-r^2}$\\\hline -\tt \verb|-|& (cmyk)color& (cmyk)color& (cmyk)color& \pageref{Dadd}& - Subtraction\\ -& numeric& numeric& numeric& & - \\ -& pair& pair& pair& & - \\\hline -\tt \verb|-|& --& (cmyk)color& (cmyk)color& \pageref{Dneg}& - Negation\\ -& & numeric& numeric& & - \\ -& & pair& pair& & - \\\hline -\tt \verb|/|& (cmyk)color& numeric& (cmyk)color& \pageref{Dmldiv}& - Division\\ -& numeric& & numeric& & - \\ -& pair& & pair& & - \\\hline -\tt \verb|< = >|& string& string& boolean& \pageref{Dcmpar}& - Comparison operators\\ -\tt \verb|<= >=|& numeric& numeric& & & - \\ -\tt \verb|<>|& pair& pair& & & - \\ -& (cmyk)color& (cmyk)color& & & - \\ -& transform& transform& & & - \\\hline -\pl\tt \verb|abs|& --& numeric& numeric& \pageref{Dabs}& - Absolute value\\ -& & pair& & & - \\\hline -\tt \verb|and|& boolean& boolean& boolean& \pageref{Dand}& - Logical and\\\hline -\tt \verb|angle|& --& pair& numeric& \pageref{Dangle}& - 2$-$argument arctangent (in degrees)\\\hline -\tt \verb|arclength|& --& path& numeric& \pageref{Darclng}& - Arc length of a path\\\hline -\tt \verb|arctime|& numeric& path& numeric& \pageref{Darctim}& - Time on a path where arclength from\\ -\tt \verb|of|& & & & & - the start reaches a given value\\\hline -\tt \verb|ASCII|& --& string& numeric& --& - ASCII value of first character in string\\\hline -\pl\tt \verb|bbox|& --& picture& path& \pageref{Dbbox}& - A rectangular path for the bounding\\ -& & path& & & - box\\ -& & pen& & & - \\\hline -\tt \verb|blackpart|& --& cmykcolor& numeric& \pageref{Dcmykprt}& - Extract the fourth component\\\hline -\tt \verb|bluepart|& --& color& numeric& \pageref{Drgbprt}& - Extracts the third component\\\hline -\tt \verb|boolean|& --& any& boolean& \pageref{Dboolop}& - Is the expression of type boolean?\\\hline -\tt \verb|bot|& --& numeric& numeric& \pageref{Dbot}& - Bottom of current pen when centered\\ -& & pair& pair& & - at the given coordinate(s)\\\hline -\pl\tt \verb|ceiling|& --& numeric& numeric& \pageref{Dceil}& - Least integer greater than or equal to\\\hline -\pl\tt \verb|center|& --& picture& pair& \pageref{Dcenter}& - Center of the bounding box\\ -& & path& & & - \\ -& & pen& & & - \\\hline -\end{tabular} -$$ -\index{ASCII?\texttt{ASCII}}% -\label{optabA} -\end{table} - -\begin{table}[htp] -\caption{Operators (Part 2)} -$$\begin{tabular}{|l|l|l|l|r|l|} -\hline -\multicolumn1{|c}{Name}& \multicolumn3{|c}{Argument/result types}& - \multicolumn1{|c}{Page}& \multicolumn1{|c|}{Explanation}\\ -\cline{2-4} -& Left& Right& Result& & \\ -\hline -\hline -\tt \verb|char|& --& numeric& string& \pageref{Dchar}& - Character with a given ASCII code\\\hline -\tt \verb|cmykcolor|& --& any& boolean& \pageref{Dccolrop}& - Is the expression of type cmykcolor?\\\hline -\tt \verb|colormodel|& --& image object& numeric& --& - What is the color model of the image object?\\\hline -\tt \verb|color|& --& any& boolean& \pageref{Dcolrop}& - Is the expression of type color?\\\hline -\tt \verb|cosd|& --& numeric& numeric& \pageref{Dcosd}& - Cosine of angle in degrees\\\hline -\pl\tt \verb|cutafter|& path& path& path& \pageref{Dcuta}& - Left argument with part after the\\ -& & & & & - intersection dropped\\\hline -\pl\tt \verb|cutbefore|& path& path& path& \pageref{Dcutb}& - Left argument with part before the\\ -& & & & & - intersection dropped\\\hline -\tt \verb|cyanpart|& --& cmykcolor& numeric& \pageref{Dcmykprt}& - Extract the first component\\\hline -\tt \verb|cycle|& --& path& boolean& \pageref{Dcycop}& - Determines whether a path is cyclic\\\hline -\tt \verb|decimal|& --& numeric& string& \pageref{Ddecop}& - The decimal representation\\\hline -\pl\tt \verb|dir|& --& numeric& pair& \pageref{Ddirop}& - $(\cos\theta,\sin\theta)$ given $\theta$ in degrees\\\hline -\pl\tt \verb|direction|& numeric& path& pair& \pageref{Ddirof}& - The direction of a path at a given\\ -\tt \verb| of|& & & & & - `time'\\\hline -\pl\tt \verb|direction-|& pair& path& numeric& \pageref{Ddpntof}& - Point where a path has a given\\ -\tt \verb|point of|& & & & & - direction\\\hline -\tt \verb|direction-|& pair& path& numeric& \pageref{Ddtimof}& - `Time' when a path has a given\\ -\tt \verb|time of|& & & & & - direction\\\hline -\pl\tt \verb|div|& numeric& numeric& numeric& --& - Integer division $\lfloor l/r\rfloor$\\\hline -\pl\tt \verb|dotprod|& pair& pair& numeric& \pageref{Ddprod}& - vector dot product\\\hline -\tt \verb|floor|& --& numeric& numeric& \pageref{Dfloor}& - Greatest integer less than or equal to\\\hline -\tt \verb|fontsize|& --& string& numeric& \pageref{Dfntsiz}& - The point size of a font\\\hline -\tt \verb|greenpart|& --& color& numeric& \pageref{Drgbprt}& - Extract the second component\\\hline -\tt \verb|greypart|& --& numeric& numeric& --& - Extract the first (only) component\\\hline -\tt \verb|hex|& --& string& numeric& --& - Interpret as a hexadecimal number\\\hline -\tt \verb|infont|& string& string& picture& \pageref{Sinfont}& - Typeset string in given font\\\hline -\pl\tt \verb|intersec-|& path& path& pair& \pageref{Disecpt}& - An intersection point\\ -\tt \verb| tionpoint|& & & & & - \\\hline -\tt \verb|intersec-|& path& path& pair& \pageref{Disectt}& - Times ($t_l,t_r)$ on paths $l$ and $r$\\ -\tt \verb|tiontimes|& & & & & - when the paths intersect\\\hline -\pl\tt \verb|inverse|& --& transform& transform& \pageref{Dinv}& - Invert a transformation\\\hline -\tt \verb|known|& --& any& boolean& \pageref{Dknown}& - Does argument have a known value?\\\hline -\tt \verb|length|& --& path& numeric& \pageref{Dlength}& - Number of arcs in a path\\\hline -\pl\tt \verb|lft|& --& numeric& numeric& \pageref{Dlft}& - Left side of current pen when its\\ -& & pair& pair& & - center is at the given coordinate(s)\\\hline -\tt \verb|llcorner|& --& picture& pair& \pageref{Dcornop}& - Lower-left corner of bounding box\\ -& & path& & & - \\ -& & pen& & & - \\\hline -\tt \verb|lrcorner|& --& picture& pair& \pageref{Dcornop}& - Lower-left corner of bounding box\\ -& & path& & & - \\ -& & pen& & & - \\\hline -\tt \verb|magentapart|& --& cmykcolor& numeric& \pageref{Dcmykprt}& - Extract the second component\\\hline -\tt \verb|makepath|& --& pen& path& \pageref{Dmkpath}& - Cyclic path bounding the pen shape\\\hline -\tt \verb|makepen|& --& path& pen& \pageref{Dmkpen}& - A polygonal pen made from the\\ -& & & & & - convex hull of the path knots\\\hline -\tt \verb|mexp|& --& numeric& numeric& --& - The function $\exp(x/256)$\\\hline -\tt \verb|mlog|& --& numeric& numeric& --& - The function $256\ln(x)$\\\hline -\pl\tt \verb|mod|& --& numeric& numeric& --& - The remainder function $l-r\lfloor l/r\rfloor$\\\hline -\tt \verb|normal-|& --& --& numeric& --& - Choose a random number with\\ -\tt \verb|deviate|& & & & & - mean 0 and standard deviation 1\\\hline -\end{tabular} -$$ -\index{div?\texttt{div}}\index{hex?\texttt{hex}}\index{mexp?\texttt{mexp}}\index{mlog?\texttt{mlog}}% -\index{mod?\texttt{mod}}\index{normaldeviate?\texttt{normaldeviate}}% -\label{optabB} -\end{table} -\begin{table}[htp] -\caption{Operators (Part 3)} -$$\begin{tabular}{|l|l|l|l|r|l|} -\hline -\multicolumn1{|c}{Name}& \multicolumn3{|c}{Argument/result types}& - \multicolumn1{|c}{Page}& \multicolumn1{|c|}{Explanation}\\ -\cline{2-4} -& Left& Right& Result& & \\ -\hline -\hline -\tt \verb|not|& --& boolean& boolean& \pageref{Dnot}& - Logical negation\\\hline -\tt \verb|numeric|& --& any& boolean& \pageref{Dnumop}& - Is the expression of type numeric?\\\hline -\tt \verb|oct|& --& string& numeric& --& - Interpret string as octal number\\\hline -\tt \verb|odd|& --& numeric& boolean& --& - Is the closest integer odd or even?\\\hline -\tt \verb|or|& boolean& boolean& boolean& \pageref{Dor}& - Logical inclusive or\\\hline -\tt \verb|pair|& --& any& boolean& \pageref{Dpairop}& - Is the expression of type pair?\\\hline -\tt \verb|path|& --& any& boolean& \pageref{Dpathop}& - Is the expression of type path?\\\hline -\tt \verb|pen|& --& any& boolean& \pageref{Dpenop}& - Is the expression of type pen?\\\hline -\tt \verb|penoffset|& pair& pen& pair& --& - Point on the pen furthest to the\\ -\tt \verb|of|& & & & & - right of the given direction\\\hline -\tt \verb|picture|& --& any& boolean& \pageref{Dpictop}& - Is the expression of type picture?\\\hline -\tt \verb|point of|& numeric& path& pair& \pageref{Dpntof}& - Point on a path given a time value\\\hline -\tt \verb|postcontrol|& numeric& path& pair& --& - First B\'ezier control point on path\\ -\tt \verb|of|& & & & & - segment starting at the given time\\\hline -\tt \verb|precontrol|& numeric& path& pair& --& - Last B\'ezier control point on path\\ -\tt \verb|of|& & & & & - segment ending at the given time\\\hline -\tt \verb|redpart|& --& color& numeric& \pageref{Drgbprt}& - Extract the first component\\\hline -\tt \verb|reverse|& --& path& path& \pageref{Drevrse}& - `time'-reversed path, beginning\\ -& & & & & - swapped with ending\\\hline -\tt \verb|rgbcolor|& --& any& boolean& \pageref{Drcolrop}& - Is the expression of type color?\\\hline -\tt \verb|rotated|& picture& numeric& picture& \pageref{Dtranop}& - Rotate counterclockwise a given\\ -& path& & path& & - number of degrees\\ -& pair& & pair& & - \\ -& pen& & pen& & - \\ -& transform& & transform& & - \\\hline -\pl\tt \verb|round|& --& numeric& numeric& \pageref{Dround}& - round each component to the\\ -& & pair& pair& & - nearest integer\\\hline -\pl\tt \verb|rt|& --& numeric& numeric& \pageref{Drt}& - Right side of current pen when\\ -& & pair& pair& & - centered at given coordinate(s)\\\hline -\tt \verb|scaled|& picture& numeric& picture& \pageref{Dtranop}& - Scale all coordinates by the\\ -& path& & path& & - given amount\\ -& pair& & pair& & - \\ -& pen& & pen& & - \\ -& transform& & transform& & - \\\hline -\tt \verb|scantokens|& --& string& token sequence& \pageref{Dscantokens}& - Converts a string to a token or \\ -& & & & &token sequence. Provides string\\ -& & & & &to numeric conversion, etc. - \\\hline -\tt \verb|shifted|& picture& pair& picture& \pageref{Dtranop}& - Add the given shift amount to\\ -& path& & path& & - each pair of coordinates\\ -& pair& & pair& & - \\ -& pen& & pen& & - \\ -& transform& & transform& & - \\\hline -\tt \verb|sind|& --& numeric& numeric& \pageref{Dsind}& - Sine of an angle in degrees\\\hline -\tt \verb|slanted|& picture& numeric& picture& \pageref{Dtranop}& - Apply the slanting transformation\\ -& path& & path& & - that maps $(x,y)$ into $(x+sy,y)$,\\ -& pair& & pair& & - where $s$ is the numeric argument\\ -& pen& & pen& & - \\ -& transform& & transform& & - \\\hline -\tt \verb|sqrt|& --& numeric& numeric& \pageref{Dsqrt}& - Square root\\\hline -\tt \verb|str|& --& suffix& string& \pageref{Dstr}& - String representation for a suffix\\\hline -\end{tabular} -$$ -\index{oct?\texttt{oct}}\index{odd?\texttt{odd}}\index{penoffset?\texttt{penoffset}}\index{postcontrol?\texttt{postcontrol}}% -\index{precontrol?\texttt{precontrol}}% -\label{optabC} -\end{table} - -\begin{table}[htp] -\caption{Operators (Part 4)} -$$\begin{tabular}{|l|l|l|l|r|l|} -\hline -\multicolumn1{|c}{Name}& \multicolumn3{|c}{Argument/result types}& - \multicolumn1{|c}{Page}& \multicolumn1{|c|}{Explanation}\\ -\cline{2-4} -& Left& Right& Result& & \\ -\hline -\hline -\tt \verb|string|& --& any& boolean& \pageref{Dstrgop}& - Is the expression of type string?\\\hline -\tt \verb|subpath|& pair& path& path& \pageref{Dsubpth}& - Portion of a path for given range\\ -\tt \verb|of|& & & & & - of time values\\\hline -\tt \verb|substring|& pair& string& string& \pageref{Dsubstr}& - Substring bounded by given indices\\ -\tt \verb|of|& & & & & - \\\hline -\pl\tt \verb|top|& --& numeric& numeric& \pageref{Dtop}& - Top of current pen when centered\\ -& & pair& pair& & - at the given coordinate(s)\\\hline -\tt \verb|transform|& --& any& boolean& \pageref{Dtrnfop}& - Is the argument of type transform?\\\hline -\tt \verb|transformed|& picture& transform& picture& \pageref{Dtrfrmd}& - Apply the given transform to all\\ -& path& & path& & - coordinates\\ -& pair& & pair& & - \\ -& pen& & pen& & - \\ -& transform& & transform& & - \\\hline -\tt \verb|ulcorner|& --& picture& pair& \pageref{Dcornop}& - Upper-left corner of bounding box\\ -& & path& & & - \\ -& & pen& & & - \\\hline -\tt \verb|uniform-|& --& numeric& numeric& --& - Random number between zero and\\ -\tt \verb|deviate|& & & & & - the value of the argument\\\hline -\pl\tt \verb|unitvector|& --& pair& pair& \pageref{Duvec}& - Rescale a vector so its length is 1\\\hline -\tt \verb|unknown|& --& any& boolean& \pageref{Dunknwn}& - Is the value unknown?\\\hline -\tt \verb|urcorner|& --& picture& pair& \pageref{Dcornop}& - Upper-left corner of bounding box\\ -& & path& & & - \\ -& & pen& & & - \\\hline -\pl\tt \verb|whatever|& --& --& numeric& \pageref{Dwhatev}& - Create a new anonymous unknown\\\hline -\tt \verb|xpart|& --& pair& number& \pageref{Dxprt}& - $x$ or $t_x$ component\\ -& & transform& & & - \\\hline -\tt \verb|xscaled|& picture& numeric& picture& \pageref{Dtranop}& - Scale all $x$ coordinates by the\\ -& path& & path& & - given amount\\ -& pair& & pair& & - \\ -& pen& & pen& & - \\ -& transform& & transform& & - \\\hline -\tt \verb|xxpart|& --& transform& number& \pageref{Dtrprt}& - $t_{xx}$ entry in transformation matrix\\\hline -\tt \verb|xypart|& --& transform& number& \pageref{Dtrprt}& - $t_{xy}$ entry in transformation matrix\\\hline -\tt \verb|yellowpart|& --& cmykcolor& numeric& \pageref{Dcmykprt}& - Extract the third component\\\hline -\tt \verb|ypart|& --& pair& number& \pageref{Dyprt}& - $y$ or $t_y$ component\\ -& & transform& & & - \\\hline -\tt \verb|yscaled|& picture& numeric& picture& \pageref{Dtranop}& - Scale all $y$ coordinates by the\\ -& path& & path& & - given amount\\ -& pair& & pair& & - \\ -& pen& & pen& & - \\ -& transform& & transform& & - \\\hline -\tt \verb|yxpart|& --& transform& number& \pageref{Dtrprt}& - $t_{yx}$ entry in transformation matrix\\\hline -\tt \verb|yypart|& --& transform& number& \pageref{Dtrprt}& - $t_{yy}$ entry in transformation matrix\\\hline -\tt \verb|zscaled|& picture& pair& picture& \pageref{Dtranop}& - Rotate and scale all coordinates so\\ -& path& & path& & - that $(1,0)$ is mapped into the\\ -& pair& & pair& & - given pair; i.e., do complex\\ -& pen& & pen& & - multiplication.\\ -& transform& & transform& & - \\\hline -\end{tabular} -$$ -\index{uniformdeviate?\texttt{uniformdeviate}}% -\label{optabD} -\end{table} +\clearpage +\LTXtable{\textwidth}{mpman-optab} \begin{table}[htp] \caption{Commands} @@ -5476,6 +5354,8 @@ $$\begin{tabular}{|l|r|l|} Draw a line with an arrowhead at the end\\\hline \pl\tt \verb|drawdblarrow|& \pageref{Ddrwdar}& Draw a line with arrowheads at both ends\\\hline +\tt \verb|filenametemplate|& \pageref{Dfilenametemplate}& + Set output file name pattern\\\hline \pl\tt \verb|fill|& \pageref{Dfill}& Fill inside a cyclic path\\\hline \pl\tt \verb|filldraw|& \pageref{Dfildrw}& @@ -5516,12 +5396,15 @@ $$\begin{tabular}{|l|r|l|} Erase inside a cyclic path\\\hline \pl\tt \verb|unfilldraw|& \pageref{Dunfdrw}& Erase a cyclic path and its inside\\\hline +\tt \verb|write to|& \pageref{Dwrite}& + Write string to file\\\hline \end{tabular} $$ \index{let?\texttt{let}}% \label{cmdtab} \end{table} + \begin{table}[htp] \caption{Function-Like Macros} $$\begin{tabular}{|l|l|l|r|l|} @@ -5682,18 +5565,20 @@ $\tt \qquad \;|\; zscaled \descr{pair primary}$\\ $\tt \qquad \;|\; reflectedabout\hbox{\tt (}\descr{pair expression}\hbox{\tt ,} \descr{pair expression}\hbox{\tt )}$\\ $\tt \qquad \;|\; rotatedaround\hbox{\tt (}\descr{pair expression}\hbox{\tt ,} \descr{numeric expression}\hbox{\tt )}$\\ $\tt $\\ -$\tt \descr{nullary op} \rightarrow false \;|\; normaldeviate \;|\; nullpicture \;|\; pencircle$\\ +$\tt \descr{nullary op} \rightarrow false \;|\; normaldeviate \;|\; nullpen \;|\; nullpicture \;|\; pencircle$\\ $\tt \qquad \;|\; true \;|\; whatever$\\ $\tt \descr{unary op} \rightarrow \descr{type}$\\ -$\tt \qquad \;|\; abs \;|\; angle \;|\; arclength \;|\; ASCII \;|\; bbox \;|\; blackpart \;|\; bluepart \;|\; bot \;|\; ceiling$\\ -$\tt \qquad \;|\; center \;|\; char \;|\; cosd \;|\; cyanpart \;|\; cycle \;|\; decimal \;|\; dir \;|\; floor \;|\; fontsize$\\ +$\tt \qquad \;|\; abs \;|\; angle \;|\; arclength \;|\; ASCII \;|\; bbox \;|\; blackpart \;|\; bluepart \;|\; bot \;|\; bounded$\\ +$\tt \qquad \;|\; ceiling \;|\; center \;|\; char \;|\; clipped \;|\; colormodel \;|\; cosd \;|\; cyanpart \;|\; cycle$\\ +$\tt \qquad \;|\; dashpart \;|\; decimal \;|\; dir \;|\; floor \;|\; filled \;|\; fontpart \;|\; fontsize$\\ $\tt \qquad \;|\; greenpart \;|\; greypart \;|\; hex \;|\; inverse \;|\; known \;|\; length \;|\; lft \;|\; llcorner$\\ $\tt \qquad \;|\; lrcorner\;|\; magentapart \;|\; makepath \;|\; makepen \;|\; mexp \;|\; mlog \;|\; not \;|\; oct \;|\; odd$\\ -$\tt \qquad \;|\; redpart \;|\; reverse \;|\; round \;|\; rt \;|\; sind \;|\; sqrt \;|\; top \;|\; ulcorner$\\ +$\tt \qquad \;|\; pathpart \;|\; penpart \;|\; readfrom \;|\; redpart \;|\; reverse \;|\; round \;|\; rt \;|\; sind \;|\; sqrt$\\ +$\tt \qquad \;|\; stroked \;|\; textpart \;|\; textual \;|\; top \;|\; ulcorner$\\ $\tt \qquad \;|\; uniformdeviate \;|\; unitvector \;|\; unknown \;|\; urcorner \;|\; xpart \;|\; xxpart$\\ $\tt \qquad \;|\; xypart \;|\; yellowpart \;|\; ypart \;|\; yxpart \;|\; yypart$\\ $\tt \descr{type} \rightarrow boolean \;|\; cmykcolor \;|\; color \;|\; numeric \;|\; pair$\\ -$\tt \qquad \;|\; path \;|\; pen \;|\; picture \;|\; string \;|\; transform$\\ +$\tt \qquad \;|\; path \;|\; pen \;|\; picture \;|\; rgbcolor \;|\; string \;|\; transform$\\ $\tt \descr{primary binop} \rightarrow \hbox{\tt *} \;|\; \hbox{\tt /} \;|\; \hbox{\tt **} \;|\; and$\\ $\tt \qquad \;|\; dotprod \;|\; div \;|\; infont \;|\; mod$\\ $\tt \descr{secondary binop} \rightarrow + \;|\; - \;|\; ++ \;|\; +-+ \;|\; or$\\ @@ -5710,9 +5595,9 @@ $\tt \qquad \;|\; \descr{suffix parameter}$\\ $\tt \descr{subscript} \rightarrow \descr{number} \;|\; \hbox{\tt [}\descr{numeric expression}\hbox{\tt ]}$\\ $\tt $\\ $\tt \descr{internal variable} \rightarrow ahangle \;|\; ahlength \;|\; bboxmargin$\\ -$\tt \qquad \;|\; charcode \;|\; day \;|\; defaultpen \;|\; defaultscale \;|\; labeloffset$\\ -$\tt \qquad \;|\; linecap \;|\; linejoin \;|\; miterlimit \;|\; month \;|\; pausing$\\ -$\tt \qquad \;|\; prologues \;|\; showstopping \;|\; time \;|\; tracingoutput$\\ +$\tt \qquad \;|\; charcode \;|\; day \;|\; defaultcolormodel \;|\; defaultpen \;|\; defaultscale$\\ +$\tt \qquad \;|\; labeloffset \;|\; linecap \;|\; linejoin \;|\; miterlimit \;|\; month$\\ +$\tt \qquad \;|\; pausing \;|\; prologues \;|\; showstopping \;|\; time \;|\; tracingoutput$\\ $\tt \qquad \;|\; tracingcapsules \;|\; tracingchoices \;|\; tracingcommands$\\ $\tt \qquad \;|\; tracingequations \;|\; tracinglostchars \;|\; tracingmacros$\\ $\tt \qquad \;|\; tracingonline \;|\; tracingrestores \;|\; tracingspecs$\\ @@ -5840,9 +5725,11 @@ $\tt \qquad \;|\; save \descr{symbolic token list}$\\ $\tt \qquad \;|\; setbounds \descr{picture variable} to \descr{path expression}$\\ $\tt \qquad \;|\; shipout \descr{picture expression}$\\ $\tt \qquad \;|\; special \descr{string expression}$\\ +$\tt \qquad \;|\; write \descr{string expression} to \descr{string expression}$\\ $\tt \qquad \;|\; \descr{addto command}$\\ $\tt \qquad \;|\; \descr{drawing command}$\\ $\tt \qquad \;|\; \descr{font metric command}$\\ +$\tt \qquad \;|\; \descr{message command}$\\ $\tt \qquad \;|\; \descr{show command}$\\ $\tt \qquad \;|\; \descr{tracing command}$\\ $\tt $\\ @@ -5871,6 +5758,11 @@ $\tt \qquad \;|\; \descr{fill type} \descr{path expression} \descr{option list}$ $\tt \descr{fill type} \rightarrow fill \;|\; draw \;|\; filldraw \;|\; unfill \;|\; undraw \;|\; unfilldraw$\\ $\tt \qquad \;|\; drawarrow \;|\; drawdblarrow \;|\; cutdraw$\\ $\tt $\\ +$\tt \descr{message command} \rightarrow errhelp \descr{string expression}$\\ +$\tt \qquad \;|\; errmessage \descr{string expression}$\\ +$\tt \qquad \;|\; filenametemplate \descr{string expression}$\\ +$\tt \qquad \;|\; message \descr{string expression}$\\ +$\tt $\\ $\tt \descr{tracing command} \rightarrow tracingall \;|\; loggingall \;|\; tracingnone$ \end{ctabbing} \caption{The syntax for commands} @@ -5894,6 +5786,7 @@ $\tt $\\ $\tt \descr{loop} \rightarrow \descr{loop header}\hbox{\tt :} \descr{loop text} endfor$\\ $\tt \descr{loop header} \rightarrow for \descr{symbolic token} \hbox{\tt =} \descr{progression}$\\ $\tt \qquad \;|\; for \descr{symbolic token} \hbox{\tt =} \descr{for list}$\\ +$\tt \qquad \;|\; for \descr{symbolic token} \hbox{\tt within} \descr{picture expression}$\\ $\tt \qquad \;|\; forsuffixes \descr{symbolic token} \hbox{\tt =} \descr{suffix list}$\\ $\tt \qquad \;|\; forever$\\ $\tt \descr{progression} \rightarrow \descr{numeric expression} upto \descr{numeric expression}$\\ @@ -5973,9 +5866,9 @@ The analog of a \MF\ command line like $$ \hbox{\verb|mf '\mode=lowres; mag=1.2; input cmr10'|} $$ is $$ \hbox{\verb|mpost '&mfplain \mode=lowres; mag=1.2; input cmr10'|} $$ -The result is a set of PostScript files, one for each character in the -font. Some editing would be required in order to merge them into a -downloadable Type~3 PostScript font \cite{ad:red}. +The result is a set of PostScript\index{PostScript} files, one for each +character in the font. Some editing would be required in order to +merge them into a downloadable Type~3 PostScript font~\cite{ad:red2}. \begin{table}[htp] $$ @@ -6035,7 +5928,7 @@ MetaPost definitions. These include {\tt displaying}, {\tt currentwindow}, \verb|screen_rows|, and \verb|screen_cols| which depend on \MF's ability to display images on the computer screen. In addition, \verb|pixels_per_inch| is irrelevant since MetaPost uses fixed units of -PostScript points. +PostScript\index{PostScript!point}\index{point!PostScript} points. The reason why some macros and internal variables\index{internal variables}\index{variables!internal} are not meaningful in MetaPost is @@ -6057,8 +5950,16 @@ MetaPost. Both languages allow statements of the form\index{special?\texttt{special}}\label{Dspecl} $$ {\tt special}\, \descr{string expression} \hbox{\tt;} $$ but \MF\ copies the string into its ``generic font'' output file, while -MetaPost interprets the string as a sequence of PostScript commands that are -to be placed at the beginning of the next output file. +MetaPost interprets the string as a sequence of PostScript\index{PostScript} +commands that are to be placed at the beginning of the next output file. + +In this regard, it is worth mentioning that rules in \TeX\ material +included via {\tt btex..etex} in MetaPost are rounded to the correct +number of pixels according to PostScript\index{PostScript!conversion rules} +conversion rules~\cite{ad:red2}. In \MF, rules are not generated +directly, but simply included in specials and interpreted later by +other programs, such as {\tt gftodvi}\index{gftodvi?\ttt{gftodvi}}, +so there is no special conversion. All the other differences between \MF\ and MetaPost are features found only in MetaPost. These are listed in Table~\ref{mponly}. The only @@ -6081,58 +5982,123 @@ troff\index{troff} commands in {\tt mpx}\index{files!mpx?{\tt mpx}} files. It should be of no concern to users since {\tt mpx} files are generated automatically. -\begin{table}[htp] -$$ -\renewcommand{\FancyVerbFormatLine}[1]{\hbox{#1}\strut} -\begin{tabular}{|l|} \hline -\multicolumn 1{|c|} -{MetaPost primitives not found in \MF} \\ \hline -$\begin{verbatim} -blackpart greenpart setbounds -bluepart greypart tracinglostchars -btex infont troffmode -clip linecap truecorners -cmykcolor linejoin ulcorner -color llcorner urcorner -colormodel lrcorner verbatimtex -cyanpart magentapart withcmykcolor -dashed miterlimit withcolor -defaultcolormodel mpprocset withgreyscale -etex mpxbreak withoutcolor -filenametemplate prologues withpostscript -fontmapfile redpart withprescript -fontmapline restoreclipcolor withrgbcolor -fontsize rgbcolor yellowpart -\end{verbatim} -$ \\ \hline -\multicolumn 1{|c|} -{Variables and Macros defined only in Plain MetaPost}\\ \hline -$\begin{verbatim} -ahangle cutbefore extra_beginfig -ahlength cuttings extra_endfig -background dashpattern green -bbox defaultfont image -bboxmargin defaultpen label -beginfig defaultscale labeloffset -beveled dotlabel mitered -black dotlabels red -blue drawarrow rounded -buildcycle drawdblarrow squared -butt drawoptions thelabel -center endfig white -cutafter evenly -\end{verbatim} -$ \\ \hline +\begin{table} +\centering +\begin{tabular}{|c|}\hline +MetaPost primitives not found in \MF\\\hline +\begin{minipage}[b]{.75\linewidth}\ttfamily +\begin{multicols}{3} +blackpart\\ +bluepart\\ +bounded\\ +btex\\ +clip\\ +clipped\\ +cmykcolor\\ +color\\ +colormodel\\ +cyanpart\\ +dashed\\ +dashpart\\ +defaultcolormodel\\ +etex\\ +filenametemplate\\ +filled\\ +fontmapfile\\ +fontmapline\\ +fontpart\\ +fontsize\\ +for within\\ +greenpart\\ +greypart\\ +infont\\ +linecap\\ +linejoin\\ +llcorner\\ +lrcorner\\ +magentapart\\ +miterlimit\\ +mpprocset\\ +mpxbreak\\ +pathpart\\ +penpart\\ +prologues\\ +readfrom\\ +redpart\\ +restoreclipcolor\\ +rgbcolor\\ +setbounds\\ +stroked\\ +textpart\\ +textual\\ +tracinglostchars\\ +troffmode\\ +truecorners\\ +ulcorner\\ +urcorner\\ +verbatimtex\\ +withcmykcolor\\ +withcolor\\ +withgreyscale\\ +withoutcolor\\ +withpostscript\\ +withprescript\\ +withrgbcolor\\ +write to\\ +yellowpart +\end{multicols} +\end{minipage}\\\hline + +Variables and Macros defined only in Plain MetaPost\\\hline +\begin{minipage}[b]{.75\linewidth}\ttfamily +\begin{multicols}{3} +ahangle\\ +ahlength\\ +background\\ +bbox\\ +bboxmargin\\ +beginfig\\ +beveled\\ +black\\ +blue\\ +buildcycle\\ +butt\\ +center\\ +cutafter\\ +cutbefore\\ +cuttings\\ +dashpattern\\ +defaultfont\\ +defaultpen\\ +defaultscale\\ +dotlabel\\ +dotlabels\\ +drawarrow\\ +drawdblarrow\\ +drawoptions\\ +endfig\\ +EOF\\ +evenly\\ +extra\_beginfig\\ +extra\_endfig\\ +green\\ +image\\ +label\\ +labeloffset\\ +mitered\\ +red\\ +rounded\\ +squared\\ +thelabel\\ +white +\end{multicols} +\end{minipage}\\\hline \end{tabular} -\renewcommand{\FancyVerbFormatLine}[1]{#1} -$$ \caption{Macros and internal variables defined in MetaPost but not \MF.} \label{mponly} \end{table} - - \bibliographystyle{plain} \bibliography{mpman} diff --git a/Master/texmf-dist/fonts/map/dvips/groff/groff-updmap.map b/Master/texmf-dist/fonts/map/dvips/groff/troff-updmap.map index ec2f9ccf213..0296ed52900 100644 --- a/Master/texmf-dist/fonts/map/dvips/groff/groff-updmap.map +++ b/Master/texmf-dist/fonts/map/dvips/groff/troff-updmap.map @@ -1,4 +1,4 @@ -% groff-updmap.map. Public domain. +% troff-updmap.map. Public domain. % % This map file is just the same as troff.map, except that the entries % for psyr, psyro, and pzdr are removed. Why? Because those tfm names diff --git a/Master/texmf-dist/fonts/map/dvips/groff/groff-mp.map b/Master/texmf-dist/fonts/map/dvips/groff/troff.map index dc85aa2706c..a7c50b45291 100644 --- a/Master/texmf-dist/fonts/map/dvips/groff/groff-mp.map +++ b/Master/texmf-dist/fonts/map/dvips/groff/troff.map @@ -1,4 +1,4 @@ -% groff-updmap.map. Public domain. +% troff.map. Public domain. % MetaPost uses this in troff mode (which these days means groff). % pagd8g AvantGarde-Demi " groffEncoding ReEncodeFont " <groff.enc |