summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2009-05-27 13:57:45 +0000
committerTaco Hoekwater <taco@elvenkind.com>2009-05-27 13:57:45 +0000
commit30d91185abefb047f73a3cf6f7c69b13fa2391f6 (patch)
tree46cf97531b63e9d73085cd7fa83ed798bc95d318 /Master
parenta6de62371f5f16b69c8acb1302df944de36db154 (diff)
updated manual sources
git-svn-id: svn://tug.org/texlive/trunk@13495 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/metapost/base/source/Makefile46
-rw-r--r--Master/texmf-dist/doc/metapost/base/source/README4
-rw-r--r--Master/texmf-dist/doc/metapost/base/source/TODO32
-rw-r--r--Master/texmf-dist/doc/metapost/base/source/mpboxes.mp7
-rw-r--r--Master/texmf-dist/doc/metapost/base/source/mpboxes.tex16
-rw-r--r--Master/texmf-dist/doc/metapost/base/source/mpgraph.mp7
-rw-r--r--Master/texmf-dist/doc/metapost/base/source/mpgraph.tex8
-rw-r--r--Master/texmf-dist/doc/metapost/base/source/mplibapi.tex1101
-rw-r--r--Master/texmf-dist/doc/metapost/base/source/mpman-app-legacy.tex342
-rw-r--r--Master/texmf-dist/doc/metapost/base/source/mpman-app-optab.tex155
-rw-r--r--Master/texmf-dist/doc/metapost/base/source/mpman-app-refman.tex951
-rw-r--r--Master/texmf-dist/doc/metapost/base/source/mpman.bib15
-rw-r--r--Master/texmf-dist/doc/metapost/base/source/mpman.mp858
-rw-r--r--Master/texmf-dist/doc/metapost/base/source/mpman.tex2150
14 files changed, 4222 insertions, 1470 deletions
diff --git a/Master/texmf-dist/doc/metapost/base/source/Makefile b/Master/texmf-dist/doc/metapost/base/source/Makefile
index db5531f9aa9..21eaebfcf74 100644
--- a/Master/texmf-dist/doc/metapost/base/source/Makefile
+++ b/Master/texmf-dist/doc/metapost/base/source/Makefile
@@ -7,17 +7,18 @@ pdflatex = pdflatex
dvips = dvips
bibtex = bibtex
mpost = mpost -tex=tex
+mkindex = makeindex -c -s mpman.ist
all: pdf
-pdf: mpman.pdf mpintro.pdf mpgraph.pdf mpboxes.pdf grdemo.pdf
-ps: mpman.ps mpintro.ps mpgraph.ps mpboxes.ps
+pdf: mpman.pdf mpgraph.pdf mpboxes.pdf
+ps: mpman.ps mpgraph.ps mpboxes.ps
mpboxes.pdf: mpboxes.tex mpboxes.bib mpboxes.mp
$(mpost) mpboxes
$(pdflatex) mpboxes
$(bibtex) mpboxes
$(pdflatex) mpboxes
- makeindex -s mpman.ist mpboxes
+ $(mkindex) mpboxes
$(pdflatex) mpboxes
mpgraph.pdf: mpgraph.tex mpgraph.bib mpgraph.mp
@@ -27,23 +28,25 @@ mpgraph.pdf: mpgraph.tex mpgraph.bib mpgraph.mp
$(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-optab.tex mpman.bib mpman.ist manfig.mp
- $(mpost) manfig
+mpman.pdf: mpman.tex mpman-app-legacy.tex mpman-app-optab.tex mpman-app-refman.tex mpman.bib mpman.ist mpman.mp
+ $(mpost) mpman
$(pdflatex) mpman
$(bibtex) mpman
$(pdflatex) mpman
$(pdflatex) mpman
- makeindex -s mpman.ist mpman
+ $(mkindex) mpman
$(pdflatex) mpman
+mpboxes.ps: mpboxes.tex mpboxes.bib mpboxes.mp
+ $(mpost) mpboxes
+ $(latex) mpboxes
+ $(bibtex) mpboxes
+ $(latex) mpboxes
+ $(latex) mpboxes
+ $(mkindex) mpboxes
+ $(latex) mpboxes
+ $(dvips) mpboxes
+
mpgraph.ps: mpgraph.tex mpgraph.bib mpgraph.mp
$(mpost) mpgraph
$(latex) mpgraph
@@ -52,22 +55,13 @@ mpgraph.ps: mpgraph.tex mpgraph.bib mpgraph.mp
$(latex) mpgraph
$(dvips) mpgraph
-mpintro.ps: mpintro.tex mpintro.bib examples.mp manfig.mp
- $(mpost) examples
- $(mpost) manfig
- $(latex) mpintro
- $(bibtex) mpintro
- $(latex) mpintro
- $(latex) mpintro
- $(dvips) mpintro
-
-mpman.ps: mpman.tex mpman-optab.tex mpman.bib mpman.ist manfig.mp
- $(mpost) manfig
+mpman.ps: mpman.tex mpman-app-legacy.tex mpman-app-optab.tex mpman-app-refman.tex mpman.bib mpman.ist mpman.mp
+ $(mpost) mpman
$(latex) mpman
$(bibtex) mpman
$(latex) mpman
$(latex) mpman
- makeindex -s mpman.ist mpman
+ $(mkindex) mpman
$(latex) mpman
$(dvips) mpman
diff --git a/Master/texmf-dist/doc/metapost/base/source/README b/Master/texmf-dist/doc/metapost/base/source/README
index 757b9b604f1..61cdd102fc8 100644
--- a/Master/texmf-dist/doc/metapost/base/source/README
+++ b/Master/texmf-dist/doc/metapost/base/source/README
@@ -29,7 +29,6 @@ countries.d
ctabbing.sty
demo.ms
energy.d
-examples.mp
figs.1
figs.mp
grdemo-doc.ms
@@ -40,7 +39,6 @@ grdemo.mp
grdemo.ms
grdemo.pdf
lead.d
-manfig.mp
matmul.d
mp.1
mpboxes.bib
@@ -50,10 +48,12 @@ mpgraph.bib
mpgraph.mp
mpgraph.tex
mpintro.bib
+mpintro.mp
mpintro.tex
mpman-optab.tex
mpman.bib
mpman.ist
+mpman.mp
mpman.tex
timepop.d
diff --git a/Master/texmf-dist/doc/metapost/base/source/TODO b/Master/texmf-dist/doc/metapost/base/source/TODO
index c80faee287e..4aea80f9d41 100644
--- a/Master/texmf-dist/doc/metapost/base/source/TODO
+++ b/Master/texmf-dist/doc/metapost/base/source/TODO
@@ -32,13 +32,9 @@ mp-implementors list or alternatively the metapost list.
*****************************
mpman.tex
-* Revise introduction.
-* (SH) Revise figure fig0 (TeX-MetaPost-workflow).
-* Add a sub-section discussing colours in section 9.
-* (SH) Colour cars and change code example in section 9.9.
-* Discuss difference between "draw <pic> withpen" and
- "label(<pic>, ...) withpen" (when label bug is fixed).
-* Rename examples.mp -> mpintro.mp and manfig.mp -> mpman.mp.
+* Describe environment variables.
+* Add note on postcontrol and precontrol when discussing control points.
+* Add description of interaction mode commands.
@@ -47,11 +43,19 @@ mpman.tex
*** Mid Term Issues ***
*****************************
-* Add decent title graphics.
-* Review presentation of primitives and plain macros in appendix A.
-* Build reference manual automatically from mp.web (as a separate manual?).
-* Make manual sources compatible with preview mode (Emacs).
-* Re-enable (or remove) SVN keyword substitution (for complete repository).
+* Revise introduction.
+* Move prologues discussion to section 3.
+* More information and examples on alternatives for calling TeX
+ or LaTeX from within MetaPost.
+* (SH) Revise (and add more) flow charts for MetaPost workflow.
+* Information on using MetaPost from within LaTeX (emp), ConTeXt
+ and LuaTeX.
+* Why is verbatimtex\end{document}etex "safer", cf. sec. 13.1?
+* Discuss difference between "draw <pic> withpen" and
+ "label(<pic>, ...) withpen" (when label bug is fixed).
+* Add a sub-section discussing colours in section 9.
+* (SH) Colour cars and change code example in section 9.9.
+* Describe mpware in section "Legacy information".
@@ -60,6 +64,10 @@ mpman.tex
*** Long Term Issues ***
*****************************
+* Add decent title graphics.
+* Review presentation of primitives and plain macros in appendix A.
+* Build reference manual automatically from mp.web (as a separate manual?).
+* Make manual sources compatible with preview mode (Emacs).
* Make manual sources LaTeX2e conform.
* Make manual sources look nice in Emacs (AUCTeX font-locking).
* Review overall layout of the manuals (type area, float placement,
diff --git a/Master/texmf-dist/doc/metapost/base/source/mpboxes.mp b/Master/texmf-dist/doc/metapost/base/source/mpboxes.mp
index 6e56ce0c211..10ec530dbe4 100644
--- a/Master/texmf-dist/doc/metapost/base/source/mpboxes.mp
+++ b/Master/texmf-dist/doc/metapost/base/source/mpboxes.mp
@@ -2,7 +2,12 @@
input boxes
-filenametemplate "%j-%c.mps";
+if scantokens(mpversion) < 1.200:
+ filenametemplate
+else:
+ outputtemplate :=
+fi
+"%j-%c.mps";
%%% This redefinition of dotlabel draws dots as a closed path
%%% which are rendered more smoothly in Adobe Reader.
diff --git a/Master/texmf-dist/doc/metapost/base/source/mpboxes.tex b/Master/texmf-dist/doc/metapost/base/source/mpboxes.tex
index f520f74c4e3..a167df8e267 100644
--- a/Master/texmf-dist/doc/metapost/base/source/mpboxes.tex
+++ b/Master/texmf-dist/doc/metapost/base/source/mpboxes.tex
@@ -163,7 +163,7 @@ defaultdx}\index{defaultdx?\texttt{defaultdx}}\label{Ddefaultdx} and
\index{variables!box|)}
\begin{figure}[htp]
-$$ \includegraphics{mpboxes-48} $$
+$$ \includegraphics{mpboxes-48.mps} $$
\caption[How a {\tt boxit} picture relates to the associated variables]
{The relationship between the picture given to {\tt boxit} and the
associated variables. The picture is indicated by a gray rectangle.}
@@ -233,7 +233,7 @@ drawarrow subpath (0,.7) of (z.ptr..{left}ndc3.c) dashed evenly;
label.rt(btex \strut ndblock etex, z.ptr); endfig;
\end{verbatim}
$}
-\atop \vcenter{\vskip8pt\hbox{\includegraphics{mpboxes-49}}}
+\atop \vcenter{\vskip8pt\hbox{\includegraphics{mpboxes-49.mps}}}
$$
\caption{MetaPost code and the corresponding figure}
\label{fig49}
@@ -327,7 +327,7 @@ centered in an oval as can be seen from the Figure~\ref{fig50}.%
\index{variables!box|)}
\begin{figure}[htp]
-$$ \includegraphics{mpboxes-50} $$
+$$ \includegraphics{mpboxes-50.mps} $$
\caption[How a {\tt circleit} picture relates to the associated variables]
{The relationship between the picture given to {\tt circleit} and the
associated variables. The picture is indicated by a gray rectangle.}
@@ -365,7 +365,7 @@ drawshadowed(a,b);
drawarrow a.s -- b.n;
endfig;
\end{verbatim}
-\qquad \mathcenter{\includegraphics{mpboxes-51}} $$
+\qquad \mathcenter{\includegraphics{mpboxes-51.mps}} $$
\caption[MetaPost code and the resulting figure.] {MetaPost code and
the resulting figure. Note that the {\tt drawshadowed} macro
used here is not part of the {\tt boxes.mp} macro package.}
@@ -427,7 +427,7 @@ label.urt(btex$b$etex, cuta(ee,cc) ee.c{(cc.c-ee.c)rotated-15}..cc.c);
endfig;
\end{verbatim}
$}
-\atop \vcenter{\vskip8pt\hbox{\includegraphics{mpboxes-52}}}
+\atop \vcenter{\vskip8pt\hbox{\includegraphics{mpboxes-52.mps}}}
$$
\caption{MetaPost code and the corresponding figure}
\label{fig52}
@@ -564,3 +564,9 @@ defaultdy\index{defaultdy?\texttt{defaultdy}}& \pageref{Ddefaultdy}&
% - I request that it remain clear that I am the author of
% "A User's Manual for MetaPost" and "Drawing Graphs with MetaPost".
% - I request to be consulted before significant changes are made.
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-PDF-mode: t
+%%% TeX-master: t
+%%% End:
diff --git a/Master/texmf-dist/doc/metapost/base/source/mpgraph.mp b/Master/texmf-dist/doc/metapost/base/source/mpgraph.mp
index 03790065c73..2c94edfe549 100644
--- a/Master/texmf-dist/doc/metapost/base/source/mpgraph.mp
+++ b/Master/texmf-dist/doc/metapost/base/source/mpgraph.mp
@@ -2,7 +2,12 @@
input graph
-filenametemplate "%j-%c.mps";
+if scantokens(mpversion) < 1.200:
+ filenametemplate
+else:
+ outputtemplate :=
+fi
+"%j-%c.mps";
%if false: %% Begin skipping already debugged figures
%fi input sarith %% End skipping of already debugged figures
diff --git a/Master/texmf-dist/doc/metapost/base/source/mpgraph.tex b/Master/texmf-dist/doc/metapost/base/source/mpgraph.tex
index ea606e06e0f..759c6e85061 100644
--- a/Master/texmf-dist/doc/metapost/base/source/mpgraph.tex
+++ b/Master/texmf-dist/doc/metapost/base/source/mpgraph.tex
@@ -1,4 +1,4 @@
-% $Id: mpgraph.tex 444 2008-03-30 10:28:13Z stephanhennig $
+% $Id: mpgraph.tex 870 2009-03-06 11:04:56Z stephanhennig $
% MetaPost graph doc, by John Hobby. License at end.
\listfiles
\RequirePackage{ifpdf}
@@ -1036,3 +1036,9 @@ It is necessary to {\tt input sarith} before using the following macros:
% - I request that it remain clear that I am the author of
% "A User's Manual for MetaPost" and "Drawing Graphs with MetaPost".
% - I request to be consulted before significant changes are made.
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-PDF-mode: t
+%%% TeX-master: t
+%%% End:
diff --git a/Master/texmf-dist/doc/metapost/base/source/mplibapi.tex b/Master/texmf-dist/doc/metapost/base/source/mplibapi.tex
new file mode 100644
index 00000000000..a18e5e01fb0
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/base/source/mplibapi.tex
@@ -0,0 +1,1101 @@
+
+\def\MPLIB{MPlib}
+\def\MP{MetaPost}
+\def\POSTSCRIPT{PostScript}
+\def\PS{PostScript}
+\def\TFM{{\sc tfm}}
+\def\LUA{Lua}
+
+\def\luatex#1{#1}
+
+\setupinteraction[state=start] % don't forget this line!
+\placebookmarks[section,subsection,subsubsection][section]
+% \setupinteractionscreen[option=bookmark]
+
+\definefontsynonym[TitleFont][Sans]
+\definefontsynonym[SubTitleFont][Sans]
+
+\def\StartTitlePage%
+ {\bgroup%\startstandardmakeup
+ \setupalign[middle]
+ \hbox{}\vfil
+ \let\\=\crlf}
+
+\def\StopTitlePage%
+ {\vfil
+ \page\egroup%\stopstandardmakeup
+ }
+
+\usetypescript[palatino]
+\switchtobodyfont[palatino,10pt]
+
+\nonknuthmode
+
+\def\ctypedef#1#2#3{\subsubsection[#2]{\type{#1#2#3}}\bookmark{#2}}
+\def\cenumeration#1{\subsubsection{\type{#1}}\bookmark{#1}}
+\def\cfunction#1#2#3{\subsubsection[#2]{\type{#1#2#3}}\bookmark{#2}}
+
+
+\starttext
+
+\StartTitlePage
+\centerline{\definedfont[TitleFont at 50pt]{\MPLIB}}
+\blank[3*line]
+\centerline{\definedfont[SubTitleFont at 24pt]{API documentation}}
+\blank[3*line]
+\centerline{Taco Hoekwater, July 2008}
+\StopTitlePage
+
+\section{Table of contents}
+
+\placecontent[criterium=all,level=subsection]
+
+\page
+
+\section{Introduction}
+
+This document describes the API to \MPLIB, allowing you to use
+\MPLIB\ in your own applications. One such application is writing
+bindings to interface with other programming languages. The
+bindings to the \LUA\ scripting language is part of the \MPLIB\
+distribution and also covered by this manual.
+
+This is a first draft of both this document as well as the API, so
+there may be errors or omissions in this document or strangenesses in
+the API. If you believe something can be improved, please do not
+hesitate to let us know. The contact email address is {\tt
+metapost@tug.org}.
+
+The C paragraphs in this document assume you understand C code, the
+Lua paragraphs assume you understand Lua code, and familiarity with
+\MP\ is assumed throughout.
+
+\subsection{Simple \MPLIB\ use}
+
+There are two different approaches possible when running \MPLIB. The first
+method is most suitable for programs that function as a command-line
+frontend. It uses \quote{normal} \MP\ interface with I/O to and from files,
+and needs very little setup to run. On the other hand, it also gives
+almost no chance to control the \MPLIB\ behaviour.
+
+Here is a C language example of how to do this:
+
+
+\starttyping
+#include <stdlib.h>
+#include "mplib.h"
+int main (int argc, char **argv) {
+ MP mp;
+ MP_options *opt = mp_options();
+ opt->command_line = argv[1];
+ mp = mp_initialize(opt);
+ if (mp) {
+ int history = mp_run(mp);
+ mp_finish(mp);
+ exit (history);
+ } else {
+ exit (EXIT_FAILURE);
+ }
+}
+\stoptyping
+
+This example will run in \quote{inimpost} mode.
+
+\subsection{Embedded \MPLIB\ use}
+
+The second method does not run a file, but instead repeatedly executes
+chunks of \MP\ language input that are passed to the library as
+strings, with the output redirected to internal buffers instead of
+directly to files.
+
+Here is an example of how this second approach works, now using the
+\LUA\ bindings:
+
+\starttyping
+local mplib = require('mplib')
+local mp = mplib.new ({ ini_version = false,
+ mem_name = 'plain' })
+if mp then
+ local l = mp:execute([[beginfig(1);
+ fill fullcircle scaled 20;
+ endfig;
+ ]])
+ if l and l.fig and l.fig[1] then
+ print (l.fig[1]:postscript())
+ end
+ mp:finish();
+end
+\stoptyping
+
+This example loads a previously generated \quote{plain} mem file.
+
+
+\section{C API for core \MPLIB}
+
+All of the types, structures, enumerations and functions that are
+described in this section are defined in the header file \type{mplib.h}.
+
+\subsection{Structures}
+
+\ctypedef{}{MP_options}{}
+
+This is a structure that contains the configurable parameters for a new \MPLIB\ instance. Because \MP\ differentiates
+between \type{-ini} and \type{non-ini} modes, there are three types of settings: Those that apply in both cases, and
+those that apply in only one of those cases.
+
+\starttabulate[|l|l|l|p|]
+\NC int \NC ini_version \NC 1 \NC set this to zero if you want to load a mem file.\NC \NR
+\NC int \NC error_line \NC 79 \NC maximal length of error message lines\NC \NR
+\NC int \NC half_error_line \NC 50 \NC halfway break point for error contexts\NC\NR
+\NC int \NC max_print_line \NC 100 \NC maximal length of file output\NC \NR
+\NC unsigned \NC hash_size \NC 16384 \NC size of the internal hash (always a multiple of 2).
+ ignored in \type{non-ini} mode, read from mem file\NC \NR
+\NC int \NC param_size \NC 150 \NC number of simultaneously active macro parameters.
+ ignored in \type{non-ini} mode, read from mem file\NC \NR
+\NC int \NC max_in_open \NC 10 \NC maximum level of \type{input} nesting.
+ ignored in \type{non-ini} mode, read from mem file\NC \NR
+\NC int \NC main_memory \NC 5000 \NC size of the main memory array in 8-byte words;
+ in \type{non-ini} mode only used if larger than the
+ value stored in the mem file\NC\NR
+\NC void * \NC userdata \NC NULL \NC for your personal use only, not used by the library\NC \NR
+\NC char * \NC banner \NC NULL \NC string to use instead of default banner\NC \NR
+\NC int \NC print_found_names\NC 0 \NC controls whether the asked name or the actual found
+ name of the file is used in messages\NC \NR
+\NC int \NC file_line_error_style\NC 0 \NC when this option is nonzero, the library will use \type{file:line:error}
+ style formatting for error messages that occur while reading
+ from input files\NC \NR
+\NC char * \NC command_line \NC NULL \NC input file name and rest of command line;
+ only used by \type{mp_run} interface\NC \NR
+\NC int \NC interaction \NC 0 \NC explicit \type{mp_interaction_mode} (see below)\NC \NR
+\NC int \NC noninteractive \NC 0 \NC set this nonzero to suppress user interaction,
+ only sensible if you want to use \type{mp_execute}\NC \NR
+\NC int \NC random_seed \NC 0 \NC set this nonzero to force a specific random seed\NC \NR
+\NC int \NC troff_mode \NC 0 \NC set this nonzero to initialize \quote{troffmode} \NC \NR
+\NC char * \NC mem_name \NC NULL \NC explicit mem name to use instead of \type{plain.mem}.
+ ignored in \type{-ini} mode.\NC \NR
+\NC char * \NC job_name \NC NULL \NC explicit job name to use instead of first input file\NC \NR
+\NC mp_file_finder \NC find_file \NC NULL \NC function called for finding files \NC \NR
+\NC mp_editor_cmd \NC run_editor \NC NULL \NC function called after \quote{E} error response\NC \NR
+\NC mp_makempx_cmd \NC run_make_mpx \NC NULL \NC function called for the creation of mpx files\NC \NR
+\stoptabulate
+
+To create an \type{MP_options} structure, you have to use the \type{mp_options()} function.
+
+\ctypedef{}{MP}{}
+
+This type is an opaque pointer to a \MPLIB\ instance, it is what you
+have pass along as the first argument to (almost) all the \MPLIB\
+functions. The actual C structure it points to has hundreds of fields,
+but you should not use any of those directly. All confuration is done
+via the \type{MP_options} structure, and there are accessor functions
+for the fields that can be read out.
+
+\ctypedef{}{mp_run_data}{}
+
+When the \MPLIB\ instance is not interactive, any output is redirect
+to this structure. There are a few string output streams, and a
+linked list of output images.
+
+\starttabulate[|l|l|p|]
+\NC mp_stream \NC term_out \NC holds the terminal output \NC \NR
+\NC mp_stream \NC error_out \NC holds error messages \NC \NR
+\NC mp_stream \NC log_out \NC holds the log output \NC \NR
+\NC mp_edge_object *\NC edges \NC linked list of generated pictures \NC \NR
+\stoptabulate
+
+\type{term_out} is equivalent to \type{stdout} in interactive use, and
+\type{error_out} is equivalent to \type{stderr}. The \type{error_out}
+is currently only used for memory allocation errors, the \MP\ error
+messages are written to \type{term_out} (and are often duplicated to
+\type{log_out} as well).
+
+You need to include \type{mplibps.h} to be able to actually make use this list of images,
+see the next section for the details on \type{mp_edge_object} lists.
+
+See next paragraph for \type{mp_stream}.
+
+\ctypedef{}{mp_stream}{}
+
+This contains the data for a stream as well as some internal
+bookkeeping variables. The fields that are of interest to you are:
+
+\starttabulate[|l|l|p|]
+\NC size_t \NC size \NC the internal buffer size\NC \NR
+\NC char * \NC data \NC the actual data. \NC \NR
+\stoptabulate
+
+There is nothing in the stream unless the \type{size} field is
+nonzero. There will not be embedded zeroes in \type{data}.
+
+If \type{size} is nonzero, \type{strlen(data)} is guaranteed to be
+less than that, and may be as low as zero (if \MPLIB\ has written an
+empty string).
+
+\subsection{Function prototype typedefs}
+
+The following three function prototypes define functions that you can
+pass to \MPLIB\ insert the \type{MP_options} structure.
+
+\ctypedef{char * }{(*mp_file_finder)}{ (MP, const char*, const char*, int)}
+
+\MPLIB\ calls this function whenever it needs to find a file. If you
+do not set up the matching option field (\type{MP_options.find_file}),
+\MPLIB\ will only be able to find files in the current directory.
+
+The three function arguments are the requested file name, the file
+mode (either \type{"r"} or \type{"w"}), and the file type (an
+\type{mp_filetype}, see below).
+
+The return value is a new string indicating the disk file name to be
+used, or NULL if the named file can not be found. If the mode is
+\type{"w"}, it is usually best to simply return a copy of the first
+argument.
+
+
+\ctypedef{void }{(*mp_editor_cmd)}{(MP, char*, int)}
+
+This function is executed when a user has pressed \quote{E} as reply to an
+\MP\ error, so it will only ever be called when \MPLIB\ in interactive mode.
+The function arguments are the file name and the line number. When
+this function is called, any open files are already closed.
+
+\ctypedef{int }{(*mp_makempx_cmd)}{(MP, char*, char *)}
+
+This function is executed when there is a need to start generating an
+\type{mpx} file because (the first time a \type{btex} command was
+encountered in the current input file).
+
+The first arguments is the input file name. This is the name that was given
+in the \MP\ language, so it may not be the same as name of the actual
+file that is being used, depending on how you your
+\type{mp_file_finder} function behaves. The second argument is the
+requested output name for mpx commands.
+
+A zero return value indicates success, everything else indicates
+failure to create a proper \type{mpx} file and will result in an \MP\ error.
+
+\subsection{Enumerations}
+
+\cenumeration{mp_filetype}
+
+The \type{mp_file_finder} receives an \type{int} argument that is one of the following types:
+
+\starttabulate[|l|p|]
+\NC mp_filetype_program \NC Metapost language code (r)\NC \NR
+\NC mp_filetype_log \NC Log output (w)\NC \NR
+\NC mp_filetype_postscript \NC PostScript output (w)\NC \NR
+\NC mp_filetype_memfile \NC Mem file (r+w)\NC \NR
+\NC mp_filetype_metrics \NC \TeX\ font metric file (r+w)\NC \NR
+\NC mp_filetype_fontmap \NC Font map file (r)\NC \NR
+\NC mp_filetype_font \NC Font PFB file (r)\NC \NR
+\NC mp_filetype_encoding \NC Font encoding file (r)\NC \NR
+\NC mp_filetype_text \NC \type{readfrom} and \type{write} files (r+w)\NC \NR
+\stoptabulate
+
+\cenumeration{mp_interaction_mode}
+
+When \type{noninteractive} is zero, \MPLIB\ normally starts in a mode where it reports every error,
+stops and asks the user for input. This initial mode can be overruled by using one of the following:
+
+\starttabulate[|l|p|]
+\NC mp_batch_mode \NC as with \type{batchmode} \NC \NR
+\NC mp_nonstop_mode \NC as with \type{nonstopmode} \NC \NR
+\NC mp_scroll_mode \NC as with \type{scrollmode} \NC \NR
+\NC mp_error_stop_mode \NC as with \type{errorstopmode} \NC \NR
+\stoptabulate
+
+\cenumeration{mp_history_state}
+
+These are set depending on the current state of the interpreter.
+
+\starttabulate[|l|p|]
+\NC mp_spotless \NC still clean as a whistle \NC \NR
+\NC mp_warning_issued \NC a warning was issued or something was \type{show}-ed \NC \NR
+\NC mp_error_message_issued \NC an error has been reported \NC \NR
+\NC mp_fatal_eror_stop \NC termination was premature due to error(s) \NC \NR
+\NC mp_system_error_stop \NC termination was premature due to disaster
+ (out of system memory) \NC \NR
+\stoptabulate
+
+
+\cenumeration{mp_color_model}
+
+Graphical objects always have a color model attached to them.
+
+\starttabulate[|l|p|]
+\NC mp_no_model \NC as with \type{withoutcolor} \NC \NR
+\NC mp_grey_model \NC as with \type{withgreycolor} \NC \NR
+\NC mp_rgb_model \NC as with \type{withrgbcolor} \NC \NR
+\NC mp_cmyk_model \NC as with \type{withcmykcolor} \NC \NR
+\stoptabulate
+
+
+\cenumeration{mp_knot_type}
+
+Knots can have left and right types depending on their current
+status. By the time you see them in the output, they are usually
+either \type{mp_explicit} or \type{mp_endpoint}, but here is the full
+list:
+
+\starttabulate[|l|p|]
+\NC mp_endpoint \NC \NC \NR
+\NC mp_explicit \NC \NC \NR
+\NC mp_given \NC \NC \NR
+\NC mp_curl \NC \NC \NR
+\NC mp_open \NC \NC \NR
+\NC mp_end_cycle \NC \NC \NR
+\stoptabulate
+
+\cenumeration{mp_knot_originator}
+
+Knots can originate from two sources: they can be explicitly given by
+the user, or they can be created by the \MPLIB\ program code (for
+example as result of the \type{makepath} operator).
+
+\starttabulate[|l|p|]
+\NC mp_program_code \NC \NC \NR
+\NC mp_metapost_user \NC \NC \NR
+\stoptabulate
+
+
+\cenumeration{mp_graphical_object_code}
+
+There are eight different graphical object types.
+
+\starttabulate[|l|p|]
+\NC mp_fill_code \NC \type{addto contour} \NC \NR
+\NC mp_stroked_code \NC \type{addto doublepath} \NC \NR
+\NC mp_text_code \NC \type{addto also} (via \type{infont})\NC \NR
+\NC mp_start_clip_code \NC \type{clip} \NC \NR
+\NC mp_start_bounds_code \NC \NC \NR
+\NC mp_stop_clip_code \NC \type{setbounds} \NC \NR
+\NC mp_stop_bounds_code \NC \NC \NR
+\NC mp_special_code \NC \type{special} \NC \NR
+\stoptabulate
+
+
+\subsection{Functions}
+
+\cfunction{char *}{mp_metapost_version}{(void)}
+
+Returns a copy of the \MPLIB\ version string.
+
+\cfunction{MP_options *}{mp_options}{(void)}
+
+Returns a properly initialized option structure, or \type{NULL} in case of allocation errors.
+
+\cfunction{MP }{mp_initialize}{(MP_options *opt)}
+
+Returns a pointer to a new \MPLIB\ instance, or \type{NULL} if initialisation failed.
+
+String options are copied, so you can free any of those (and the \type{opt} structure)
+immediately after the call to this function.
+
+\cfunction{int }{mp_status}{(MP mp)}
+
+Returns the current value of the interpreter error state, as a \type{mp_history_state}.
+This function is useful after \type{mp_initialize}.
+
+\cfunction{int }{mp_run}{(MP mp)}
+
+Runs the \MPLIB\ instance using the \type{command_line} and other items from the
+\type{MP_options}. After the call to \type{mp_run}, the \MPLIB\ instance should be
+closed off by calling \type{mp_finish}.
+
+The return value is the current \type{mp_history_state}
+
+\cfunction{void *}{mp_userdata}{(MP mp)}
+
+Simply returns the pointer that was passed along as \type{userdata} in
+the \type{MP_options} struct.
+
+\cfunction{int }{mp_troff_mode}{(MP mp)}
+
+Returns the value of \type{troff_mode} as copied from the
+\type{MP_options} struct.
+
+\cfunction{mp_run_data *}{mp_rundata}{(MP mp)}
+
+Returns the information collected during the previous call to \type{mp_execute}.
+
+\cfunction{int }{mp_execute}{(MP mp, char *s, size_t l)}
+
+Executes string \type{s} with length \type{l} in the \MPLIB\
+instance. This call can be repeated as often as is needed. The return
+value is the current \type{mp_history_state}. To get at the produced
+results, call \type {mp_rundata}.
+
+\cfunction{void }{mp_finish}{(MP mp)}
+
+This finishes off the use of the \MPLIB\ instance: it closes all files
+and frees all the memory allocated by this instance.
+
+\cfunction{double }{mp_get_char_dimension}{(MP mp,char*fname,int n,int t)}
+
+This is a helper function that returns one of the dimensions of glyph
+\type{n} in font \type{fname} as a double in PostScript (AFM)
+units. The requested item \type{t} can be \type{'w'} (width),
+\type{'h'} (height), or \type{'d'} (depth).
+
+\cfunction{int }{mp_memory_usage}{(MP mp)}
+
+Returns the current memory usage of this instance.
+
+\cfunction{int }{mp_hash_usage}{(MP mp)}
+
+Returns the current hash usage of this instance.
+
+\cfunction{int }{mp_param_usage}{(MP mp)}
+
+Returns the current simultaneous macro parameter usage of this instance.
+
+\cfunction{int }{mp_open_usage}{(MP mp)}
+
+Returns the current \type{input} levels of this instance.
+
+\section{C API for graphical backend functions}
+
+These are all defined in \type{mplibps.h}
+
+Unless otherwise stated, the \type{int} fields that express \MP\ values
+should be interpreted as scaled points: the 32bits are divided into an
+integer part and a fraction part so that the value $65536$ equals
+1~\PS\ point (of which there are exactly 72 in an inch).
+
+
+\subsection{Structures}
+
+The structures in this section are used by the items in the body of
+the \type{edges} field of an \type{mp_rundata} structure. They are
+presented here in a bottom-up manner.
+
+\ctypedef {}{mp_knot}{}
+
+Each \MPLIB\ path (a sequence of \MP\ points) is represented as a linked list
+of structures of the type \type{mp_knot}.
+
+\starttabulate[|l|l|p|]
+\NC struct mp_knot * \NC next \NC the next knot, or NULL\NC \NR
+\NC mp_knot_type \NC left_type \NC the \type{mp_knot_type} for the left side \NC \NR
+\NC mp_knot_type \NC right_type \NC the \type{mp_knot_type} for the right side \NC \NR
+\NC signed int \NC x_coord \NC $x$\NC \NR
+\NC signed int \NC y_coord \NC $y$\NC \NR
+\NC signed int \NC left_x \NC $x$ of the left (incoming) control point\NC \NR
+\NC signed int \NC left_y \NC $y$ of the left (incoming) control point\NC \NR
+\NC signed int \NC right_x \NC $x$ of the right (outgoing) control point\NC \NR
+\NC signed int \NC right_y \NC $y$ of the right (outgoing) control point\NC \NR
+\NC mp_knot_originator \NC originator \NC the \type{mp_knot_originator} \NC \NR
+\stoptabulate
+
+\ctypedef {}{mp_color}{}
+
+The graphical object that can be colored, have two fields to define
+the color: one for the color model and one for the color values. The
+structure for the color values is defined as follows:
+
+\starttabulate[|l|l|p|]
+\NC int \NC a_val \NC see below, values are in scaled points\NC \NR
+\NC int \NC b_val \NC --\NC \NR
+\NC int \NC c_val \NC --\NC \NR
+\NC int \NC d_val \NC --\NC \NR
+\stoptabulate
+
+All graphical objects that have \type{mp_color} fields also have
+\type{mp_color_model} fields. The color model decides the meaning of
+the four data fields:
+
+\starttabulate[|l|c|c|c|c|]
+\NC color model value \NC a_val \NC b_val \NC c_val \NC d_val \NC \FR
+\NC mp_no_model \NC -- \NC -- \NC -- \NC -- \NC \NR
+\NC mp_grey_model \NC grey \NC -- \NC -- \NC -- \NC \NR
+\NC mp_rgb_model \NC red \NC green \NC blue \NC \NC \NR
+\NC mp_cmyk_model \NC cyan \NC magenta \NC yellow\NC black \NC \NR
+\stoptabulate
+
+\ctypedef {}{mp_dash_object}{}
+
+Dash lists are represented like this:
+
+\starttabulate[|l|l|p|]
+\NC int * \NC array \NC an array of dash lengths, terminated by $-1$.
+ the values are in scaled points\NC \NR
+\NC int \NC offset\NC the dash array offset (as in PostScript) \NC \NR
+\stoptabulate
+
+\ctypedef {}{mp_graphic_object}{}
+
+Now follow the structure definitions of the objects that can appear
+inside a figure (this is called an \quote{edge structure} in the
+internal WEB documentation).
+
+There are eight different graphical object types, but there are seven
+different C structures. Type \type{mp_graphic_object} represents the
+base line of graphical object types. It has only two fields:
+
+\starttabulate[|l|l|p|]
+\NC mp_graphical_object_code \NC type \NC \NC \NR
+\NC struct mp_graphic_object * \NC next \NC next object or NULL \NC \NR
+\stoptabulate
+
+Because every graphical object has at least these two types, the body
+of a picture is represented as a linked list of
+\type{mp_graphic_object} items. Each object in turn can then be
+typecast to the proper type depending on its \type{type}.
+
+The two \quote{missing} objects in the explanations below are the ones
+that match \type{mp_stop_clip_code} and \type{mp_stop_bounds_code}:
+these have no extra fields besides \type{type} and \type{next}.
+
+\ctypedef {}{mp_fill_object}{}
+
+Contains the following fields on top of the ones defined by \type{mp_graphic_object}:
+
+\starttabulate[|l|l|p|]
+\NC char * \NC pre_script \NC this is the result of \type{withprescript} \NC \NR
+\NC char * \NC post_script \NC this is the result of \type{withpostscript}\NC \NR
+\NC mp_color \NC color \NC the color value of this object\NC \NR
+\NC mp_color_model \NC color_model \NC the color model\NC \NR
+\NC unsigned char \NC ljoin \NC the line join style; values have the same meaning
+ as in \PS: 0 for mitered, 1 for round, 2 for beveled.\NC \NR
+\NC mp_knot * \NC path_p \NC the (always cyclic) path\NC \NR
+\NC mp_knot * \NC htap_p \NC a possible reversed path (see below)\NC \NR
+\NC mp_knot * \NC pen_p \NC a possible pen (see below)\NC \NR
+\NC int \NC miterlim \NC the miter limit\NC \NR
+\stoptabulate
+
+Even though this object is called an \type{mp_fill_object}, it can be the result of both
+\type{fill} and \type{filldraw} in the \MP\ input. This means that there can be a pen
+involved as well. The final output should behave as follows:
+
+\startitemize
+\item If there is no \type{pen_p}; simply fill \type{path_p}.
+\item If there is a one-knot pen (\type{pen_p->next} = \type{pen_p}) then fill \type{path_p}
+and also draw \type{path_p} with the \type{pen_p}. Do not forget to take \type{ljoin} and
+\type{miterlim} into account when drawing with the pen.
+\item If there is a more complex pen (\type{pen_p->next} != \type{pen_p}) then its path
+has already been preprocessed for you. fill \type{path_p} and \type{htap_p}.
+\stopitemize
+
+\ctypedef {}{mp_stroked_object}{}
+
+Contains the following fields on top of the ones defined by \type{mp_graphic_object}:
+
+\starttabulate[|l|l|p|]
+\NC char * \NC pre_script \NC this is the result of \type{withprescript} \NC \NR
+\NC char * \NC post_script \NC this is the result of \type{withpostscript} \NC \NR
+\NC mp_color \NC color \NC color value \NC \NR
+\NC mp_color_model \NC color_model \NC color model \NC \NR
+\NC unsigned char \NC ljoin \NC the line join style \NC \NR
+\NC unsigned char \NC lcap \NC the line cap style; values have the same meaning
+ as in \PS: 0 for butt ends, 1 for round ends, 2 for projecting ends.\NC \NR
+\NC mp_knot * \NC path_p \NC the path \NC \NR
+\NC mp_knot * \NC pen_p \NC the pen \NC \NR
+\NC int \NC miterlim \NC miter limit \NC \NR
+\NC mp_dash_object * \NC dash_p \NC a possible dash list\NC \NR
+\stoptabulate
+
+\ctypedef {}{mp_text_object}{}
+
+Contains the following fields on top of the ones defined by \type{mp_graphic_object}:
+
+\starttabulate[|l|l|p|]
+\NC char * \NC pre_script \NC this is the result of \type{withprescript}\NC \NR
+\NC char * \NC post_script\NC this is the result of \type{withpostscript}\NC \NR
+\NC mp_color \NC color \NC color value \NC \NR
+\NC mp_color_model \NC color_model\NC color model \NC \NR
+\NC char * \NC text_p \NC string to be placed \NC \NR
+\NC char * \NC font_name \NC the \MP\ font name\NC \NR
+\NC unsigned int \NC font_dsize \NC size of the font\NC \NR
+\NC int \NC width \NC width of the picture resulting from the string\NC \NR
+\NC int \NC height \NC height\NC \NR
+\NC int \NC depth \NC depth\NC \NR
+\NC int \NC tx \NC transformation component\NC \NR
+\NC int \NC ty \NC transformation component\NC \NR
+\NC int \NC txx \NC transformation component\NC \NR
+\NC int \NC tyx \NC transformation component\NC \NR
+\NC int \NC txy \NC transformation component\NC \NR
+\NC int \NC tyy \NC transformation component\NC \NR
+\stoptabulate
+
+All fonts are loaded by \MPLIB\ at the design size (but not all fonts have the same design
+size). If text is to be scaled, this happens via the transformation components.
+
+\ctypedef {}{mp_clip_object}{}
+
+Contains the following field on top of the ones defined by \type{mp_graphic_object}:
+
+\starttabulate[|l|l|p|]
+\NC mp_knot * \NC path_p \NC defines the clipping path that is in effect until
+ the object with the matching \type{mp_stop_clip_code} is encountered\NC \NR
+\stoptabulate
+
+\ctypedef {}{mp_bounds_object}{}
+
+Contains the following field on top of the ones defined by \type{mp_graphic_object}:
+
+\starttabulate[|l|l|p|]
+\NC mp_knot * \NC path_p \NC the path that was used for boundary calculation \NC \NR
+\stoptabulate
+
+This object can be ignored when output is generated, it only has effect on the boudingbox
+of the following objects and that has been taken into account already.
+
+\ctypedef {}{mp_special_object}{}
+
+This represents the output generated by a \MP\ \type{special} command. It
+contains the following field on top of the ones defined by \type{mp_graphic_object}:
+
+\starttabulate[|l|l|p|]
+\NC char *\NC pre_script \NC the special string\NC \NR
+\stoptabulate
+
+Each \type{special} command generates one object. All of the relevant
+\type{mp_special_object}s for a figure are linked together at the start
+of that figure.
+
+\ctypedef {}{mp_edge_object}{}
+
+\starttabulate[|l|l|p|]
+\NC mp_edge_object * \NC next \NC points to the next figure (or NULL)\NC \NR
+\NC mp_graphic_object * \NC body \NC a linked list of objects in this figure \NC \NR
+\NC char * \NC filename \NC this would have been the used filename if a \PS\ file
+ would have been generated\NC \NR
+\NC MP \NC parent \NC a pointer to the instance that created
+ this figure\NC \NR
+\NC int \NC minx \NC lower-left $x$ of the bounding box\NC \NR
+\NC int \NC miny \NC lower-left $y$ of the bounding box\NC \NR
+\NC int \NC maxx \NC upper right $x$ of the bounding box\NC \NR
+\NC int \NC maxy \NC upper right $y$ of the bounding box\NC \NR
+\NC int \NC width \NC value of \type{charwd};
+this would become the \TFM\ width (but without the potential rounding correction for \TFM\ file format)\NC \NR
+\NC int \NC height \NC similar for height (\type{charht})\NC \NR
+\NC int \NC depth \NC similar for depth (\type{chardp})\NC \NR
+\NC int \NC ital_corr \NC similar for italic correction (\type{charic})\NC \NR
+\NC int \NC charcode \NC Value of \type{charcode} (rounded, but not
+ modulated for \TFM's 256 values yet)\NC \NR
+\stoptabulate
+
+\subsection{Functions}
+
+\cfunction{int }{mp_ps_ship_out}{(mp_edge_object*hh,int prologues,int procset)}
+
+If you have an \type{mp_edge_object}, you can call this function. It will
+generate the \PS\ output for the figure and save it internally. A subsequent call to
+\type{mp_rundata} will find the generated text in the \type{ps_out} field.
+
+Returns zero for success.
+
+\cfunction{void }{mp_gr_toss_objects}{(mp_edge_object*hh)}
+
+This frees a single \type{mp_edge_object} and its \type{mp_graphic_object} contents.
+
+\cfunction{void }{mp_gr_toss_object}{(mp_graphic_object*p)}
+
+This frees a single \type{mp_graphic_object} object.
+
+\cfunction{mp_graphic_object *}{mp_gr_copy_object}{(MP mp,mp_graphic_object*p)}
+
+This creates a deep copy of a \type{mp_graphic_object} object.
+
+\section{C API for label generation (a.k.a. makempx)}
+
+The following are all defined in \type{mpxout.h}.
+
+\subsection {Structures}
+
+\ctypedef {}{MPX}{}
+
+An opaque pointer that is passed on to the file_finder.
+
+\ctypedef {}{mpx_options}{}
+
+This structure holds the option fields for \type{mpx} generation.
+You have to fill in all fields except \type{mptexpre}, that
+one defaults to \type{mptexpre.tex}
+
+
+\starttabulate[|l|l|p|]
+\NC mpx_modes \NC mode \NC \NC \NR
+\NC char * \NC cmd \NC the command (or sequence of commands) to run\NC \NR
+\NC char * \NC mptexpre \NC prepended to the generated \TeX\ file\NC \NR
+\NC char * \NC mpname \NC input file name \NC \NR
+\NC char * \NC mpxname \NC output file name\NC \NR
+\NC char * \NC banner \NC string to be printed to the generated to-be-typeset file\NC \NR
+\NC int \NC debug \NC When nonzero, \type{mp_makempx} outputs some debug information and do not delete temp files\NC \NR
+\NC mpx_file_finder \NC find_file \NC \NC \NR
+\stoptabulate
+
+\subsection{Function prototype typedefs}
+
+\ctypedef{char * }{(*mpx_file_finder)}{ (MPX, const char*, const char*, int)}
+
+The return value is a new string indicating the disk file to be used.
+The arguments are the file name, the file mode (either \type{"r"} or \type{"w"}),
+and the file type (an \type{mpx_filetype}, see below). If the mode is \type{"w"},
+it is usually best to simply return a copy of the first argument.
+
+\subsection{Enumerations}
+
+\cenumeration{mpx_modes}
+
+\starttabulate[|l|p|]
+\NC mpx_tex_mode \NC \NC \NR
+\NC mpx_troff_mode \NC \NC \NR
+\stoptabulate
+
+\cenumeration{mpx_filetype}
+
+\starttabulate[|l|p|]
+\NC mpx_tfm_format \NC \TeX\ or Troff ffont metric file \NC \NR
+\NC mpx_vf_format \NC \TeX\ virtual font file \NC \NR
+\NC mpx_trfontmap_format \NC Troff font map \NC \NR
+\NC mpx_trcharadj_format \NC Troff character shift information \NC \NR
+\NC mpx_desc_format \NC Troff DESC file \NC \NR
+\NC mpx_fontdesc_format \NC Troff FONTDESC file \NC \NR
+\NC mpx_specchar_format \NC Troff special character definition\NC \NR
+\stoptabulate
+
+\subsection{Functions}
+
+\cfunction{int }{mpx_makempx}{(mpx_options *mpxopt)}
+
+A return value of zero is success, non-zero values indicate errors.
+
+\page
+
+\section{Lua API}
+
+The \MP\ library interface registers itself in the table \type{mplib}.
+
+\subsection{\luatex{mplib.version}}
+
+Returns the \MPLIB\ version.
+
+\starttyping
+<string> s = mplib.version()
+\stoptyping
+
+\subsection{\luatex{mplib.new}}
+
+To create a new metapost instance, call
+
+\starttyping
+<mpinstance> mp = mplib.new({...})
+\stoptyping
+
+This creates the \type{mp} instance object. The argument hash can have a number of
+different fields, as follows:
+
+\starttabulate[|lT|l|p|p|]
+\NC \ssbf name \NC \bf type \NC \bf description \NC \bf default \NC\NR
+\NC error_line \NC number \NC error line width \NC 79 \NC\NR
+\NC print_line \NC number \NC line length in ps output \NC 100\NC\NR
+\NC main_memory \NC number \NC total memory size \NC 5000\NC\NR
+\NC hash_size \NC number \NC hash size \NC 16384 \NC\NR
+\NC param_size \NC number \NC max. active macro parameters\NC 150\NC\NR
+\NC max_in_open \NC number \NC max. input file nestings \NC 10\NC\NR
+\NC random_seed \NC number \NC the initial random seed \NC variable\NC\NR
+\NC interaction \NC string \NC the interaction mode, one of
+\type {batch}, \type {nonstop}, \type {scroll}, \type {errorstop} \NC \type {errorstop}\NC\NR
+\NC ini_version \NC boolean \NC the --ini switch \NC true \NC\NR
+\NC mem_name \NC string \NC \type {--mem} \NC \type {plain} \NC\NR
+\NC job_name \NC string \NC \type {--jobname} \NC \type {mpout} \NC\NR
+\NC find_file \NC function \NC a function to find files \NC only local files\NC\NR
+\stoptabulate
+
+The \type{find_file} function should be of this form:
+
+\starttyping
+<string> found = finder (<string> name, <string> mode, <string> type)
+\stoptyping
+
+with:
+
+\starttabulate[|lT|l|p|]
+\NC name \NC the requested file \NC \NR
+\NC mode \NC the file mode: \type {r} or \type {w} \NC \NR
+\NC type \NC the kind of file, one of: \type {mp}, \type {mem}, \type {tfm}, \type {map}, \type {pfb}, \type {enc} \NC \NR
+\stoptabulate
+
+Return either the full pathname of the found file, or \type{nil} if
+the file cannot be found.
+
+\subsection{\luatex{mp:statistics}}
+
+You can request statistics with:
+
+\starttyping
+<table> stats = mp:statistics()
+\stoptyping
+
+This function returns the vital statistics for an \MPLIB\ instance. There are four
+fields, giving the maximum number of used items in each of the four
+statically allocated object classes:
+
+\starttabulate[|lT|l|p|]
+\NC main_memory \NC number \NC memory size \NC\NR
+\NC hash_size \NC number \NC hash size\NC\NR
+\NC param_size \NC number \NC simultaneous macro parameters\NC\NR
+\NC max_in_open \NC number \NC input file nesting levels\NC\NR
+\stoptabulate
+
+\subsection{\luatex{mp:execute}}
+
+You can ask the \METAPOST\ interpreter to run a chunk of code by calling
+
+\starttyping
+local rettable = mp:execute('metapost language chunk')
+\stoptyping
+
+for various bits of Metapost language input. Be sure to check the
+\type{rettable.status} (see below) because when a fatal \METAPOST\
+error occurs the \MPLIB\ instance will become unusable thereafter.
+
+Generally speaking, it is best to keep your chunks small, but beware
+that all chunks have to obey proper syntax, like each of them is a
+small file. For instance, you cannot split a single statement over
+multiple chunks.
+
+In contrast with the normal standalone \type{mpost} command, there is
+{\em no\/} implied \quote{input} at the start of the first chunk.
+
+\subsection{\luatex{mp:finish}}
+
+\starttyping
+local rettable = mp:finish()
+\stoptyping
+
+If for some reason you want to stop using an \MPLIB\ instance while
+processing is not yet actually done, you can call \type{mp:finish}.
+Eventually, used memory will be freed and open files will be closed by
+the \LUA\ garbage collector, but an explicit \type{mp:finish} is the
+only way to capture the final part of the output streams.
+
+\subsection{Result table}
+
+The return value of \type{mp:execute} and \type{mp:finish} is a table
+with a few possible keys (only \type {status} is always guaranteed to be present).
+
+\starttabulate[|l|l|p|]
+\NC log \NC string \NC output to the \quote {log} stream \NC \NR
+\NC term \NC string \NC output to the \quote {term} stream \NC \NR
+\NC error \NC string \NC output to the \quote {error} stream (only used for \quote {out of memory})\NC \NR
+\NC status \NC number \NC the return value: 0=good, 1=warning, 2=errors, 3=fatal error \NC \NR
+\NC fig \NC table \NC an array of generated figures (if any)\NC \NR
+\stoptabulate
+
+When \type{status} equals~3, you should stop using this \MPLIB\ instance
+immediately, it is no longer capable of processing input.
+
+If it is present, each of the entries in the \type{fig} array is a
+userdata representing a figure object, and each of those has a number of
+object methods you can call:
+
+\starttabulate[|l|l|p|]
+\NC boundingbox \NC function \NC returns the bounding box, as an array of 4 values\NC \NR
+\NC postscript \NC function \NC return a string that is the ps output of the \type{fig} \NC \NR
+\NC svg \NC function \NC return a string that is the svg output of the \type{fig} \NC \NR
+\NC objects \NC function \NC returns the actual array of graphic objects in this \type{fig} \NC \NR
+\NC copy_objects \NC function \NC returns a deep copy of the array of graphic objects in this \type{fig} \NC \NR
+\NC filename \NC function \NC the filename this \type{fig}'s \POSTSCRIPT\ output
+ would have written to in standalone mode\NC \NR
+\NC width \NC function \NC the \type{charwd} value \NC \NR
+\NC height \NC function \NC the \type{charht} value \NC \NR
+\NC depth \NC function \NC the \type{chardp} value \NC \NR
+\NC italcorr \NC function \NC the \type{charic} value \NC \NR
+\NC charcode \NC function \NC the (rounded) \type{charcode} value \NC \NR
+\stoptabulate
+
+{\bf NOTE:} you can call \type{fig:objects()} only once for any one \type{fig} object!
+
+When the boundingbox represents a \quote {negated rectangle}, i.e.\ when the first set
+of coordinates is larger than the second set, the picture is empty.
+
+Graphical objects come in various types that each have a different list of
+accessible values. The types are: \type{fill}, \type{outline}, \type{text},
+\type{start_clip}, \type{stop_clip}, \type{start_bounds}, \type{stop_bounds}, \type{special}.
+
+There is helper function (\type{mplib.fields(obj)}) to get the list of
+accessible values for a particular object, but you can just as easily
+use the tables given below).
+
+All graphical objects have a field \type{type} that gives the object
+type as a string value, that not explicit mentioned in the tables. In
+the following, \type{number}s are \POSTSCRIPT\ points represented as
+a floating point number, unless stated otherwise. Field values that
+are of \type{table} are explained in the next section.
+
+\subsubsection{fill}
+
+\starttabulate[|l|l|p|]
+\NC path \NC table \NC the list of knots \NC \NR
+\NC htap \NC table \NC the list of knots for the reversed trajectory \NC \NR
+\NC pen \NC table \NC knots of the pen \NC \NR
+\NC color \NC table \NC the object's color \NC \NR
+\NC linejoin \NC number \NC line join style (bare number)\NC \NR
+\NC miterlimit \NC number \NC miter limit\NC \NR
+\NC prescript \NC string \NC the prescript text \NC \NR
+\NC postscript \NC string \NC the postscript text \NC \NR
+\stoptabulate
+
+The entries \type{htap} and \type{pen} are optional.
+
+There is helper function (\type{mplib.pen_info(obj)}) that returns
+a table containing a bunch of vital characteristics of the used pen
+(all values are floats):
+
+\starttabulate[|l|l|p|]
+\NC width \NC number \NC width of the pen\NC \NR
+\NC rx \NC number \NC $x$ scale \NC \NR
+\NC sx \NC number \NC $xy$ multiplier \NC \NR
+\NC sy \NC number \NC $yx$ multiplier \NC \NR
+\NC ry \NC number \NC $y$ scale \NC \NR
+\NC tx \NC number \NC $x$ offset \NC \NR
+\NC ty \NC number \NC $y$ offset \NC \NR
+\stoptabulate
+
+\subsubsection{outline}
+
+\starttabulate[|l|l|p|]
+\NC path \NC table \NC the list of knots \NC \NR
+\NC pen \NC table \NC knots of the pen \NC \NR
+\NC color \NC table \NC the object's color \NC \NR
+\NC linejoin \NC number \NC line join style (bare number)\NC \NR
+\NC miterlimit \NC number \NC miter limit \NC \NR
+\NC linecap \NC number \NC line cap style (bare number)\NC \NR
+\NC dash \NC table \NC representation of a dash list\NC \NR
+\NC prescript \NC string \NC the prescript text \NC \NR
+\NC postscript \NC string \NC the postscript text \NC \NR
+\stoptabulate
+
+The entry \type{dash} is optional.
+
+\subsubsection{text}
+
+\starttabulate[|l|l|p|]
+\NC text \NC string \NC the text \NC \NR
+\NC font \NC string \NC font tfm name \NC \NR
+\NC dsize \NC number \NC font size\NC \NR
+\NC color \NC table \NC the object's color \NC \NR
+\NC width \NC number \NC \NC \NR
+\NC height \NC number \NC \NC \NR
+\NC depth \NC number \NC \NC \NR
+\NC transform \NC table \NC a text transformation \NC \NR
+\NC prescript \NC string \NC the prescript text \NC \NR
+\NC postscript \NC string \NC the postscript text \NC \NR
+\stoptabulate
+
+\subsubsection{special}
+
+\starttabulate[|l|l|p|]
+\NC prescript \NC string \NC special text \NC \NR
+\stoptabulate
+
+\subsubsection{start_bounds, start_clip}
+
+\starttabulate[|l|l|p|]
+\NC path \NC table \NC the list of knots \NC \NR
+\stoptabulate
+
+\subsubsection{stop_bounds, stop_clip}
+
+Here are no fields available.
+
+\subsection{Subsidiary table formats}
+
+\subsubsection{Paths and pens}
+
+Paths and pens (that are really just a special type of paths as far as
+\MPLIB\ is concerned) are represented by an array where each entry
+is a table that represents a knot.
+
+\starttabulate[|lT|l|p|]
+\NC left_type \NC string \NC when present: 'endpoint', but ususally absent \NC \NR
+\NC right_type \NC string \NC like \type{left_type}\NC \NR
+\NC x_coord \NC number \NC $x$ coordinate of this knot\NC \NR
+\NC y_coord \NC number \NC $y$ coordinate of this knot\NC \NR
+\NC left_x \NC number \NC $x$ coordinate of the precontrol point of this knot\NC \NR
+\NC left_y \NC number \NC $y$ coordinate of the precontrol point of this knot\NC \NR
+\NC right_x \NC number \NC $x$ coordinate of the postcontrol point of this knot\NC \NR
+\NC right_y \NC number \NC $y$ coordinate of the postcontrol point of this knot\NC \NR
+\stoptabulate
+
+There is one special case: pens that are (possibly transformed)
+ellipses have an extra string-valued key \type{type} with value
+\type{elliptical} besides the array part containing the knot list.
+
+\subsubsection{Colors}
+
+A color is an integer array with 0, 1, 3 or 4 values:
+
+\starttabulate[|l|l|p|]
+\NC 0 \NC marking only \NC no values \NC\NR
+\NC 1 \NC greyscale \NC one value in the range (0,1), \quote {black} is 0 \NC\NR
+\NC 3 \NC RGB \NC three values in the range (0,1), \quote {black} is 0,0,0 \NC\NR
+\NC 4 \NC CMYK \NC four values in the range (0,1), \quote {black} is 0,0,0,1 \NC\NR
+\stoptabulate
+
+If the color model of the internal object was \type{unitialized}, then
+it was initialized to the values representing \quote {black} in the colorspace
+\type{defaultcolormodel} that was in effect at the time of the \type{shipout}.
+
+\subsubsection{Transforms}
+
+Each transform is a six-item array.
+
+\starttabulate[|l|l|p|]
+\NC 1 \NC number \NC represents x \NC\NR
+\NC 2 \NC number \NC represents y \NC\NR
+\NC 3 \NC number \NC represents xx \NC\NR
+\NC 4 \NC number \NC represents yx \NC\NR
+\NC 5 \NC number \NC represents xy \NC\NR
+\NC 6 \NC number \NC represents yy \NC\NR
+\stoptabulate
+
+Note that the translation (index 1 and 2) comes first. This differs
+from the ordering in \POSTSCRIPT, where the translation comes last.
+
+\subsubsection{Dashes}
+
+Each \type{dash} is two-item hash, using the same model as \POSTSCRIPT\
+for the representation of the dashlist. \type{dashes} is an array of
+\quote {on} and \quote {off}, values, and \type{offset} is the phase of the pattern.
+
+\starttabulate[|l|l|p|]
+\NC dashes \NC hash \NC an array of on-off numbers \NC\NR
+\NC offset \NC number \NC the starting offset value \NC\NR
+\stoptabulate
+
+\subsection{Character size information}
+
+These functions find the size of a glyph in a defined font. The
+\type{fontname} is the same name as the argument to \type{infont};
+the \type{char} is a glyph id in the range 0 to 255; the returned
+\type{w} is in AFM units.
+
+\subsubsection{\luatex{mp.char_width}}
+
+\starttyping
+<number> w = mp.char_width(<string> fontname, <number> char)
+\stoptyping
+
+\subsubsection{\luatex{mp.char_height}}
+
+\starttyping
+<number> w = mp.char_height(<string> fontname, <number> char)
+\stoptyping
+
+\subsubsection{\luatex{mp.char_depth}}
+
+\starttyping
+<number> w = mp.char_depth(<string> fontname, <number> char)
+\stoptyping
+
+
+\stoptext
+
+
+
+
+
+
diff --git a/Master/texmf-dist/doc/metapost/base/source/mpman-app-legacy.tex b/Master/texmf-dist/doc/metapost/base/source/mpman-app-legacy.tex
new file mode 100644
index 00000000000..02531611d72
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/base/source/mpman-app-legacy.tex
@@ -0,0 +1,342 @@
+\section{Legacy information}
+\label{legacy}
+
+\subsection{MetaPost Versus \MF}
+\label{MPvsMF}
+
+Since the \MF\index{metafont?\MF} and MetaPost languages have so much in
+common, expert users of \MF\ will want to skip most of the explanations
+in this document and concentrate on concepts that are unique to
+MetaPost. The comparisons in this appendix are intended to help experts
+that are familiar with {\sl The\ \MF book} as well as other users that
+want to benefit from Knuth's more detailed explanations \cite{kn:c}.
+
+Since \MF\ is intended for making \TeX\ fonts, it has a number of
+primitives for generating the {\tt tfm}\index{tfm file?{\tt tfm}
+file}\index{files!tfm?{\tt tfm}} files that \TeX\ needs for character
+dimensions, spacing information, ligatures\index{ligatures} and
+kerning\index{kerning}. MetaPost can also be used for generating fonts,
+and it also has \MF's primitives for making {\tt tfm} files. These are
+listed in Table~\ref{tfmprim}. Explanations can be found in the \MF\
+documentation \cite{kn:c,kn:mf3}.
+
+\begin{table}[htp]
+$$\begin{tabular}{|l|l|} \hline
+commands& {\tt charlist}, {\tt extensible},
+ {\tt fontdimen}, {\tt headerbyte} \\
+ & {\tt kern}, {\tt ligtable} \\ \hline
+ligtable operators& \verb!::!, \verb!=:!, \verb!=:|!, \verb!=:|>!,
+ \verb!|=:!, \verb!|=:>!, \\
+ & \verb!|=:|!, \verb!|=:|>!, \verb!|=:|>>!,
+ \verb!||:! \\ \hline
+internal variables\index{internal variables}\index{variables!internal}&
+ {\tt boundarychar}, {\tt chardp},
+ {\tt charext}, {\tt charht}, \\
+ & {\tt charic}, {\tt charwd},
+ {\tt designsize}, {\tt fontmaking} \\ \hline
+other operators& {\tt charexists} \\ \hline
+\end{tabular}
+$$
+\caption{MetaPost primitives for making {\tt tfm} files.}
+\label{tfmprim}
+\end{table}
+
+Even though MetaPost has the primitives for generating fonts, many of
+the font-making primitives and internal variables that are part of Plain
+\MF\index{metafont?\MF} are not defined in Plain MetaPost\index{Plain
+macros}. Instead, there is a separate macro package called {\tt
+mfplain}\index{mfplain?\texttt{mfplain}} that defines the macros
+required to allow MetaPost to process Knuth's Computer Modern fonts as
+shown in Table~\ref{mfponly} \cite{kn:e}. To load these macros, put
+``\verb|&mfplain|'' before the name of the input file. This can be done
+at the {\tt **} prompt after invoking the MetaPost interpreter with no
+arguments, or on a command line that looks something like
+this:\footnote{Command line syntax is system dependent. Quotes are
+needed on most Unix systems to protect special characters like
+{\tt\&}.}
+$$ \hbox{\verb|mpost '&mfplain' cmr10|} $$
+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\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]
+$$
+\renewcommand{\FancyVerbFormatLine}[1]{\hbox{#1}\strut}
+\begin{tabular}{|l|} \hline
+\multicolumn 1{|c|}
+{Defined in the {\tt mfplain} package} \\ \hline
+\begin{verbatim}
+beginchar font_identifier
+blacker font_normal_shrink
+capsule_def font_normal_space
+change_width font_normal_stretch
+define_blacker_pixels font_quad
+define_corrected_pixels font_size
+define_good_x_pixels font_slant
+define_good_y_pixels font_x_height
+define_horizontal_corrected_pixels italcorr
+define_pixels labelfont
+define_whole_blacker_pixels makebox
+define_whole_pixels makegrid
+define_whole_vertical_blacker_pixels maketicks
+define_whole_vertical_pixels mode_def
+endchar mode_setup
+extra_beginchar o_correction
+extra_endchar proofrule
+extra_setup proofrulethickness
+font_coding_scheme rulepen
+font_extra_space smode
+\end{verbatim}
+ \\ \hline
+\multicolumn 1{|c|}
+{Defined as no-ops in the {\tt mfplain} package}\\ \hline
+\begin{verbatim}
+cullit proofoffset
+currenttransform screenchars
+gfcorners screenrule
+grayfont screenstrokes
+hround showit
+imagerules slantfont
+lowres_fix titlefont
+nodisplays unitpixel
+notransforms vround
+openit
+\end{verbatim}
+ \\ \hline
+\end{tabular}
+\renewcommand{\FancyVerbFormatLine}[1]{#1}
+$$
+\caption{Macros and internal variables defined only in the {\tt mfplain}
+package.}
+\label{mfponly}
+\end{table}
+
+
+\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\\
+closefrom\\
+cmykcolor\\
+color\\
+colormodel\\
+cyanpart\\
+dashed\\
+dashpart\\
+defaultcolormodel\\
+etex\\
+filenametemplate\\
+filled\\
+fontmapfile\\
+fontmapline\\
+fontpart\\
+fontsize\\
+for within\\
+glyph of\\
+greenpart\\
+greypart\\
+hour\\
+infont\\
+jobname\\
+linecap\\
+linejoin\\
+llcorner\\
+lrcorner\\
+magentapart\\
+minute\\
+miterlimit\\
+mpprocset\\
+mpxbreak\\
+outputformat\\
+outputtemplate\\
+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\\
+colorpart\\
+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}
+\caption{Macros and internal variables defined in MetaPost but not \MF.}
+\label{mponly}
+\end{table}
+
+Another limitation of the {\tt mfplain} package is that certain internal
+variables from Plain \MF\index{metafont?\MF} cannot be given reasonable
+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\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
+that \MF\ primitive commands {\tt cull}, {\tt display}, {\tt
+openwindow}, {\tt numspecial} and {\tt totalweight} are not implemented
+in MetaPost. Also not implemented are a number of internal variables as
+well as the \tdescr{drawing option} {\tt withweight}. Here is a
+complete listing of the internal variables whose primitive meanings in
+\MF\ do not make sense in MetaPost:
+$$\begin{verbatim}
+autorounding fillin proofing tracingpens xoffset
+chardx granularity smoothing turningcheck yoffset
+chardy hppp tracingedges vppp
+\end{verbatim}
+$$
+
+There is also one \MF\ primitive that has a slightly different meaning in
+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\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
+commands listed in this table that the preceding sections do not discuss
+are
+\verb|extra_beginfig|\index{extra_beginfig?\texttt{extra\_beginfig}}\label{Dxbfig},
+\verb|extra_endfig|\index{extra_endfig?\texttt{extra\_endfig}}\label{Dxefig},
+and {\tt mpxbreak}. The first two are strings that contain extra
+commands to be processed by {\tt
+beginfig}\index{beginfig?\texttt{beginfig}} and {\tt
+endfig}\index{endfig?\texttt{endfig}} just as \verb|extra_beginchar| and
+\verb|extra_endchar| are processed by {\tt beginchar} and {\tt endchar}.
+(The file {\tt boxes.mp}\index{boxes.mp?\texttt{boxes.mp}} uses these
+features).
+
+The other new feature listed in Table~\ref{mponly} not listed in the
+index is {\tt mpxbreak}\index{mpxbreak?\texttt{mpxbreak}}. This is used
+to separate blocks of translated \TeX\index{TeX?\TeX} or
+troff\index{troff} commands in {\tt mpx}\index{mpx file?{\tt mpx}
+ file}\index{files!mpx?{\tt mpx}} files. It should be of no concern to
+users since {\tt mpx} files are generated automatically.
+
+\subsection{File name templates}
+\label{Dfilenametemplate}
+
+The output file naming template mechanism introduced in MetaPost
+version~1.000 originally used a primitive called
+\ttindex{filenametemplate}, as opposed to the internal string variable
+\ttt{outputtemplate}\index{outputtemplate?\texttt{outputtemplate}}
+described in section~\ref{Doutputtemplate}. This primitive took a
+string argument with the same syntax as \ttt{outputtemplate}, except
+that it didn't know about the \verb|%{...}| escape sequence for
+evaluating internal variables, e.g.,:
+
+$$\begin{verbatim}
+filenametemplate "%j-%c.mps";
+\end{verbatim}
+$$
+
+The \verb|filenametemplate| primitive has been deprecated since the
+introduction of \verb|outputtemplate| (version~1.200), but is still
+supported. If you happen to need writing future-proof source files,
+that at the same time are backwards compatible to MetaPost versions
+between 1.000 and~1.200, this output filename template declaration might
+help:
+
+$$\begin{verbatim}
+if scantokens(mpversion) < 1.200:
+ filenametemplate
+else:
+ outputtemplate :=
+fi
+"%j-%c.mps";
+\end{verbatim}
+$$
+
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-PDF-mode: t
+%%% TeX-master: "mpman"
+%%% End:
diff --git a/Master/texmf-dist/doc/metapost/base/source/mpman-app-optab.tex b/Master/texmf-dist/doc/metapost/base/source/mpman-app-optab.tex
new file mode 100644
index 00000000000..d0da5811299
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/base/source/mpman-app-optab.tex
@@ -0,0 +1,155 @@
+%%% Two notes on column specification:
+%%% (i) Column widths are manually chosen as small as possible to allow
+%%% for a wider last X column.
+%%% (ii) In the first column \linepenalty=100 prefers shorter paragraphs
+%%% (less lines), where plain \raggedright were indifferent and
+%%% sometimes caused a dangling line, e.g., for 'directionpoint of'
+%%% or 'directiontime of'.
+\begin{longtable}{|>{\raggedright\linepenalty=100\ttfamily}p{.793in}*{3}{|>{\raggedright}p{.715in}}|>{\raggedleft}p{1.5em}|>{\raggedright\arraybackslash}X|}
+\caption{\strut Operators}\label{optab}\\
+\hline
+Name& \multicolumn3{c|}{Argument/result types}& \makebox[.2in][c]{Page}& Explanation\\\cline{2-4}
+& \multicolumn1{c|}{Left}& \multicolumn1{c|}{Right}& \multicolumn1{c|}{Result}& & \\
+\hline
+\hline
+\endfirsthead
+\caption[]{\strut Operators \emph{(continued)}}\\
+\hline
+Name& \multicolumn3{c|}{Argument/result types}& \makebox[.2in][c]{Page}& Explanation\\\cline{2-4}
+& \multicolumn1{c|}{Left}& \multicolumn1{c|}{Right}& \multicolumn1{c|}{Result}& & \\
+\hline
+\hline
+\endhead
+\&\index{&?\texttt{\&}}& string\par path& string\par path & string\par path& \pageref{Damp}& Concatenation---works for paths $l\hbox{\tt\&}r$ if $r$ starts exactly where the $l$ ends\\\hline
+*\index{*?\texttt{*}}& numeric& (cmyk)color\par numeric\par pair& (cmyk)color\par numeric\par pair& \pageref{Dmldiv}& Multiplication\\\hline
+*\index{*?\texttt{*}}& (cmyk)color\par numeric\par pair& numeric& (cmyk)color\par numeric\par pair& \pageref{Dmldiv}& Multiplication\\\hline
+**\index{**?\texttt{**}}& numeric& numeric& numeric& \pageref{Dpow}& Exponentiation\\\hline
++\index{+?\texttt{+}}& (cmyk)color\par numeric\par pair& (cmyk)color\par numeric\par pair& (cmyk)color\par numeric\par pair& \pageref{Dadd}& Addition\\\hline
+++\index{++?\texttt{++}}& numeric& numeric& numeric& \pageref{Dpyadd}& Pythagorean addition $\sqrt{l^2+r^2}$\\\hline
++-+\index{+-+?\texttt{+-+}}& numeric& numeric& numeric& \pageref{Dpysub}& Pythagorean subtraction $\sqrt{l^2-r^2}$\\\hline
+-\index{-?\texttt{-}}& (cmyk)color\par numeric\par pair& (cmyk)color\par numeric\par pair& (cmyk)color\par numeric\par pair& \pageref{Dadd}& Subtraction\\\hline
+-\index{-?\texttt{-}}& --& (cmyk)color\par numeric\par pair& (cmyk)color\par numeric\par pair& \pageref{Dneg}& Negation\\\hline
+/\index{/?\texttt{/}}& (cmyk)color\par numeric\par pair& numeric& (cmyk)color\par numeric\par pair& \pageref{Dmldiv}& Division\\\hline
+<\index{<?\texttt{<}} =\index{=?\texttt{=}} >\index{>?\texttt{>}}\par <=\index{<=?\texttt{<=}} >=\index{>=?\texttt{>=}}\par <>\index{<>?\texttt{<>}}& string\par numeric\par pair\par (cmyk)color\par transform& string\par numeric\par pair\par (cmyk)color\par transform& boolean& \pageref{Dcmpar}& Comparison operators\\\hline
+\pl abs\index{abs?\texttt{abs}}& --& numeric\par pair& numeric& \pageref{Dabs}& Absolute value\par Euclidean length $\sqrt{(\mbox{\ttfamily xpart\ } r)^2+(\mbox{\ttfamily ypart\ } r)^2}$\\\hline
+and\index{and?\texttt{and}}& boolean& boolean& boolean& \pageref{Dand}& Logical and\\\hline
+angle\index{angle?\texttt{angle}}& --& pair& numeric& \pageref{Dangle}& 2$-$argument arctangent (in degrees)\\\hline
+arclength\index{arclength?\texttt{arclength}}& --& path& numeric& \pageref{Darclng}& Arc length of a path\\\hline
+arctime of\index{arctime of?\texttt{arctime of}}& numeric& path& numeric& \pageref{Darctim}& Time on a path where arc length from the start reaches a given value\\\hline
+ASCII\index{ASCII?\texttt{ASCII}}& --& string& numeric& --& ASCII value of first character in string\\\hline
+\pl bbox\index{bbox?\texttt{bbox}}& --& picture\par path\par pen& path& \pageref{Dbbox}& A rectangular path for the bounding box\\\hline
+blackpart\index{blackpart?\texttt{blackpart}}& --& cmykcolor& numeric& \pageref{Dcmykprt}& Extract the fourth component\\\hline
+bluepart\index{bluepart?\texttt{bluepart}}& --& color& numeric& \pageref{Drgbprt}& Extract the third component\\\hline
+boolean\index{boolean?\texttt{boolean}}& --& any& boolean& \pageref{Dboolop}& Is the expression of type boolean?\\\hline
+\pl bot\index{bot?\texttt{bot}}& --& numeric\par pair& numeric\par pair& \pageref{Dbot}& Bottom of current pen when centered at the given coordinate(s)\\\hline
+bounded\index{bounded?\texttt{bounded}}& --& any& boolean& \pageref{Dbounded}& Is argument a picture with a bounding box?\\\hline
+\pl ceiling\index{ceiling?\texttt{ceiling}}& --& numeric& numeric& \pageref{Dceil}& Least integer greater than or equal to\\\hline
+\pl center\index{center?\texttt{center}}& --& picture\par path\par pen& pair& \pageref{Dcenter}& Center of the bounding box\\\hline
+char\index{char?\texttt{char}}& --& numeric& string& \pageref{Dchar}& Character with a given ASCII code\\\hline
+clipped\index{clipped?\texttt{clipped}}& --& any& boolean& \pageref{Dclipped}& Is argument a clipped picture?\\\hline
+cmykcolor\index{cmykcolor?\texttt{cmykcolor}}& --& any& boolean& \pageref{Dccolrop}& Is the expression of type cmykcolor?\\\hline
+color\index{color?\texttt{color}}& --& any& boolean& \pageref{Dcolrop}& Is the expression of type color?\\\hline
+colormodel\index{colormodel?\texttt{colormodel}}& --& image object& numeric& \pageref{Dcolormodel}& What is the color model of the image object?\\\hline
+\pl colorpart\index{colorpart?\texttt{colorpart}}& --& image object&
+(cmyk)color\par numeric\par boolean& \pageref{Dcolorpart}& What is the
+color of the image object?\\\hline
+cosd\index{cosd?\texttt{cosd}}& --& numeric& numeric& \pageref{Dcosd}& Cosine of angle in degrees\\\hline
+\pl cutafter\index{cutafter?\texttt{cutafter}}& path& path& path& \pageref{Dcuta}& Left argument with part after the intersection dropped\\\hline
+\pl cutbefore\index{cutbefore?\texttt{cutbefore}}& path& path& path& \pageref{Dcutb}& Left argument with part before the intersection dropped\\\hline
+cyanpart\index{cyanpart?\texttt{cyanpart}}& --& cmykcolor& numeric& \pageref{Dcmykprt}& Extract the first component\\\hline
+cycle\index{cycle?\texttt{cycle}}& --& path& boolean& \pageref{Dcycop}& Determines whether a path is cyclic\\\hline
+dashpart\index{dashpart?\texttt{dashpart}}& --& picture& picture& \pageref{Ddashpart}& Dash pattern of a path in a stroked picture\\\hline
+decimal\index{decimal?\texttt{decimal}}& --& numeric& string& \pageref{Ddecop}& The decimal representation\\\hline
+\pl dir\index{dir?\texttt{dir}}& --& numeric& pair& \pageref{Ddirop}& $(\cos\theta,\sin\theta)$ given $\theta$ in degrees\\\hline
+\pl direction of\index{direction of?\texttt{direction of}}& numeric& path& pair& \pageref{Ddirof}& The direction of a path at a given `time'\\\hline
+\pl direction\-point of\index{directionpoint of?\texttt{directionpoint of}}& pair& path& numeric& \pageref{Ddpntof}& Point where a path has a given direction\\\hline
+direction\-time of\index{directiontime of?\texttt{directiontime of}}& pair& path& numeric& \pageref{Ddtimof}& `Time' when a path has a given direction\\\hline
+\pl div\index{div?\texttt{div}}& numeric& numeric& numeric& --& Integer division $\lfloor l/r\rfloor$\\\hline
+\pl dotprod\index{dotprod?\texttt{dotprod}}& pair& pair& numeric& \pageref{Ddprod}& vector dot product\\\hline
+filled\index{filled?\texttt{filled}}& --& any& boolean& \pageref{Dfilled}& Is argument a filled outline?\\\hline
+floor\index{floor?\texttt{floor}}& --& numeric& numeric& \pageref{Dfloor}& Greatest integer less than or equal to\\\hline
+fontpart\index{fontpart?\texttt{fontpart}}& --& picture& string& \pageref{Dfontpart}& Font of a textual picture component\\\hline
+fontsize\index{fontsize?\texttt{fontsize}}& --& string& numeric& \pageref{Dfntsiz}& The point size of a font\\\hline
+glyph of\index{glyph?\texttt{glyph}}& numeric\par string& string& picture&
+\pageref{Dglyph}& Convert a glyph of a font to contours\\\hline
+greenpart\index{greenpart?\texttt{greenpart}}& --& color& numeric& \pageref{Drgbprt}& Extract the second component\\\hline
+greypart\index{greypart?\texttt{greypart}}& --& numeric& numeric& \pageref{Dgreyprt}& Extract the first (only) component\\\hline
+hex\index{hex?\texttt{hex}}& --& string& numeric& --& Interpret as a hexadecimal number\\\hline
+infont\index{infont?\texttt{infont}}& string& string& picture& \pageref{Sinfont}& Typeset string in given font\\\hline
+\pl intersec\-tionpoint\index{intersectionpoint?\texttt{intersectionpoint}}& path& path& pair& \pageref{Disecpt}& An intersection point\\\hline
+intersec\-tiontimes\index{intersectiontimes?\texttt{intersectiontimes}}& path& path& pair& \pageref{Disectt}& Times ($t_l,t_r)$ on paths $l$ and $r$ when the paths intersect\\\hline
+\pl inverse\index{inverse?\texttt{inverse}}& --& transform& transform& \pageref{Dinv}& Invert a transformation\\\hline
+known\index{known?\texttt{known}}& --& any& boolean& \pageref{Dknown}& Does argument have a known value?\\\hline
+length\index{length?\texttt{length}}& --& path\par string\par picture& numeric& \pageref{Dlength}\par \pageref{DlengthString}\par \pageref{DlengthPicture}& Number of components (arcs, characters, strokes, \ldots) in the argument\\\hline
+\pl lft\index{lft?\texttt{lft}}& --& numeric\par pair& numeric\par pair& \pageref{Dlft}& Left side of current pen when its center is at the given coordinate(s)\\\hline
+llcorner\index{llcorner?\texttt{llcorner}}& --& picture\par path\par pen& pair& \pageref{Dcornop}& Lower-left corner of bounding box\\\hline
+lrcorner\index{lrcorner?\texttt{lrcorner}}& --& picture\par path\par pen& pair& \pageref{Dcornop}& Lower-right corner of bounding box\\\hline
+magentapart\index{magentapart?\texttt{magentapart}}& --& cmykcolor& numeric& \pageref{Dcmykprt}& Extract the second component\\\hline
+makepath\index{makepath?\texttt{makepath}}& --& pen& path& \pageref{Dmkpath}& Cyclic path bounding the pen shape\\\hline
+makepen\index{makepen?\texttt{makepen}}& --& path& pen& \pageref{Dmkpen}& A polygonal pen made from the convex hull of the path knots\\\hline
+mexp\index{mexp?\texttt{mexp}}& --& numeric& numeric& --& The function $\exp(x/256)$\\\hline
+mlog\index{mlog?\texttt{mlog}}& --& numeric& numeric& --& The function $256\ln(x)$\\\hline
+\pl mod\index{mod?\texttt{mod}}& --& numeric& numeric& --& The remainder function $l-r\lfloor l/r\rfloor$\\\hline
+normal\-deviate\index{normaldeviate?\texttt{normaldeviate}}& --& --& numeric& --& Choose a random number with mean~0 and standard deviation~1\\\hline
+not\index{not?\texttt{not}}& --& boolean& boolean& \pageref{Dnot}& Logical negation\\\hline
+numeric\index{numeric?\texttt{numeric}}& --& any& boolean& \pageref{Dnumop}& Is the expression of type numeric?\\\hline
+oct\index{oct?\texttt{oct}}& --& string& numeric& --& Interpret string as octal number\\\hline
+odd\index{odd?\texttt{odd}}& --& numeric& boolean& --& Is the closest integer odd or even?\\\hline
+or\index{or?\texttt{or}}& boolean& boolean& boolean& \pageref{Dor}& Logical inclusive or\\\hline
+pair\index{pair?\texttt{pair}}& --& any& boolean& \pageref{Dpairop}& Is the expression of type pair?\\\hline
+path\index{path?\texttt{path}}& --& any& boolean& \pageref{Dpathop}& Is the expression of type path?\\\hline
+pathpart\index{pathpart?\texttt{pathpart}}& --& picture& path& \pageref{Dpathpart}& Path of a stroked picture component\\\hline
+pen\index{pen?\texttt{pen}}& --& any& boolean& \pageref{Dpenop}& Is the expression of type pen?\\\hline
+penoffset of\index{penoffset of?\texttt{penoffset of}}& pair& pen& pair& --& Point on the pen furthest to the right of the given direction\\\hline
+penpart\index{penpart?\texttt{penpart}}& --& picture& pen& \pageref{Dpenpart}& Pen of a stroked picture component\\\hline
+picture\index{picture?\texttt{picture}}& --& any& boolean& \pageref{Dpictop}& Is the expression of type picture?\\\hline
+point of\index{point of?\texttt{point of}}& numeric& path& pair& \pageref{Dpntof}& Point on a path given a time value\\\hline
+postcontrol of\index{postcontrol?\texttt{postcontrol}}& numeric& path& pair& --& First B\'ezier control point on path segment starting at the given time\\\hline
+precontrol of\index{precontrol?\texttt{precontrol}}& numeric& path& pair& --& Last B\'ezier control point on path segment ending at the given time\\\hline
+readfrom\index{readfrom?\texttt{readfrom}}& --& string& string& \pageref{Dreadfrom}& Read a line from file\\\hline
+redpart\index{redpart?\texttt{redpart}}& --& color& numeric& \pageref{Drgbprt}& Extract the first component\\\hline
+reverse\index{reverse?\texttt{reverse}}& --& path& path& \pageref{Drevrse}& `time'-reversed path, beginning swapped with ending\\\hline
+rgbcolor\index{rgbcolor?\texttt{rgbcolor}}& --& any& boolean& \pageref{Drcolrop}& Is the expression of type color?\\\hline
+rotated\index{rotated?\texttt{rotated}}& picture\par path\par pair\par pen\par transform& numeric& picture\par path\par pair\par pen\par transform& \pageref{Dtranop}& Rotate counterclockwise a given number of degrees\\\hline
+\pl round\index{round?\texttt{round}}& --& numeric\par pair& numeric\par pair& \pageref{Dround}& round each component to the nearest integer\\\hline
+\pl rt\index{rt?\texttt{rt}}& --& numeric\par pair& numeric\par pair& \pageref{Drt}& Right side of current pen when centered at given coordinate(s)\\\hline
+scaled\index{scaled?\texttt{scaled}}& picture\par path\par pair\par pen\par transform& numeric& picture\par path\par pair\par pen\par transform& \pageref{Dtranop}& Scale all coordinates by the given amount\\\hline
+scantokens\index{scantokens?\texttt{scantokens}}& --& string& token sequence& \pageref{Dscantokens}& Converts a string to a token or token sequence. Provides string to numeric conversion, etc.\\\hline
+shifted\index{shifted?\texttt{shifted}}& picture\par path\par pair\par pen\par transform& pair& picture\par path\par pair\par pen\par transform& \pageref{Dtranop}& Add the given shift amount to each pair of coordinates\\\hline
+sind\index{sind?\texttt{sind}}& --& numeric& numeric& \pageref{Dsind}& Sine of an angle in degrees\\\hline
+slanted\index{slanted?\texttt{slanted}}& picture\par path\par pair\par pen\par transform& numeric& picture\par path\par pair\par pen\par transform& \pageref{Dtranop}& Apply the slanting transformation that maps $(x,y)$ into $(x+sy,y)$, where~$s$ is the numeric argument\\\hline
+sqrt\index{sqrt?\texttt{sqrt}}& --& numeric& numeric& \pageref{Dsqrt}& Square root\\\hline
+str\index{str?\texttt{str}}& --& suffix& string& \pageref{Dstr}& String representation for a suffix\\\hline
+string\index{string?\texttt{string}}& --& any& boolean& \pageref{Dstrgop}& Is the expression of type string?\\\hline
+stroked\index{stroked?\texttt{stroked}}& --& any& boolean& \pageref{Dstroked}& Is argument a stroked line?\\\hline
+subpath of\index{subpath?\texttt{subpath}}& pair& path& path& \pageref{Dsubpth}& Portion of a path for given range of time values\\\hline
+substring of\index{substring
+of?\texttt{substring of}}& pair& string& string& \pageref{Dsubstr}& Substring bounded by given indices\\\hline
+textpart\index{textpart?\texttt{textpart}}& --& picture& string& \pageref{Dtextpart}& Text of a textual picture component\\\hline
+textual\index{textual?\texttt{textual}}& --& any& boolean& \pageref{Dtextual}& Is argument typeset text?\\\hline
+\pl top\index{top?\texttt{top}}& --& numeric\par pair& numeric\par pair& \pageref{Dtop}& Top of current pen when centered at the given coordinate(s)\\\hline
+transform\index{transform?\texttt{transform}}& --& any& boolean& \pageref{Dtrnfop}& Is the argument of type transform?\\\hline
+transformed\index{transformed?\texttt{transformed}}& picture\par path\par pair\par pen\par transform& transform& picture\par path\par pair\par pen\par transform& \pageref{Dtrfrmd}& Apply the given transform to all coordinates\\\hline
+ulcorner\index{ulcorner?\texttt{ulcorner}}& --& picture\par path\par pen& pair& \pageref{Dcornop}& Upper-left corner of bounding box\\\hline
+uniform\-deviate\index{uniformdeviate?\texttt{uniformdeviate}}& --& numeric& numeric& --& Random number between zero and the value of the argument\\\hline
+\pl unitvector\index{unitvector?\texttt{unitvector}}& --& pair& pair& \pageref{Duvec}& Rescale a vector so its length is~1\\\hline
+unknown\index{unknown?\texttt{unknown}}& --& any& boolean& \pageref{Dunknwn}& Is the value unknown?\\\hline
+urcorner\index{urcorner?\texttt{urcorner}}& --& picture\par path\par pen& pair& \pageref{Dcornop}& Upper-right corner of bounding box\\\hline
+\pl whatever\index{whatever?\texttt{whatever}}& --& --& numeric& \pageref{Dwhatev}& Create a new anonymous unknown\\\hline
+xpart\index{xpart?\texttt{xpart}}& --& pair\par transform& number& \pageref{Dxprt}& $x$ or $t_x$ component\\\hline
+xscaled\index{xscaled?\texttt{xscaled}}& picture\par path\par pair\par pen\par transform& numeric& picture\par path\par pair\par pen\par transform& \pageref{Dtranop}& Scale all $x$ coordinates by the given amount\\\hline
+xxpart\index{xxpart?\texttt{xxpart}}& --& transform& number& \pageref{Dtrprt}& $t_{xx}$ entry in transformation matrix\\\hline
+xypart\index{xypart?\texttt{xypart}}& --& transform& number& \pageref{Dtrprt}& $t_{xy}$ entry in transformation matrix\\\hline
+yellowpart\index{yellowpart?\texttt{yellowpart}}& --& cmykcolor& numeric& \pageref{Dcmykprt}& Extract the third component\\\hline
+ypart\index{ypart?\texttt{ypart}}& --& pair\par transform& number& \pageref{Dyprt}& $y$ or $t_y$ component\\\hline
+yscaled\index{yscaled?\texttt{yscaled}}& picture\par path\par pair\par pen\par transform& numeric& picture\par path\par pair\par pen\par transform& \pageref{Dtranop}& Scale all $y$ coordinates by the given amount\\\hline
+yxpart\index{yxpart?\texttt{yxpart}}& --& transform& number& \pageref{Dtrprt}& $t_{yx}$ entry in transformation matrix\\\hline
+yypart\index{yypart?\texttt{yypart}}& --& transform& number& \pageref{Dtrprt}& $t_{yy}$ entry in transformation matrix\\\hline
+zscaled\index{zscaled?\texttt{zscaled}}& picture\par path\par pair\par pen\par transform& pair& picture\par path\par pair\par pen\par transform& \pageref{Dtranop}& Rotate and scale all coordinates so that $(1,0)$ is mapped into the given pair; i.e., do complex multiplication.\\\hline
+\end{longtable}
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-PDF-mode: t
+%%% TeX-master: "mpman"
+%%% End:
diff --git a/Master/texmf-dist/doc/metapost/base/source/mpman-app-refman.tex b/Master/texmf-dist/doc/metapost/base/source/mpman-app-refman.tex
new file mode 100644
index 00000000000..4eba05ddc38
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/base/source/mpman-app-refman.tex
@@ -0,0 +1,951 @@
+\section{Reference Manual}
+\label{refman}
+
+\begingroup
+\renewcommand\topfraction{1.0}% Allow *lots* of figures and tables.
+\renewcommand\textfraction{0.0}
+\setcounter{topnumber}{10}
+\setcounter{totalnumber}{10}
+
+\subsection{The MetaPost language}
+\label{refman:lang}
+
+Tables \ref{ivartab}--\ref{pseudotab} summarize the built-in features of
+Plain MetaPost. Features from the Plain\index{Plain macros} macro
+package are marked by \pl\ symbols. The distinction between primitives
+and plain macros can be ignored by the casual user.
+
+The tables in this appendix give the name of each feature, the page
+number where it is explained, and a short description. A few features
+are not explained elsewhere and have no page number listed. These
+features exist primarily for compatibility with \MF\index{metafont?\MF}
+and are intended to be self-explanatory. Certain other features from
+\MF\ are omitted entirely because they are of limited interest to the
+MetaPost users and/or would require long explanations. All of these are
+documented in {\sl The \MF book} \cite{kn:c} as explained in
+Appendix~\ref{MPvsMF}.
+
+Tables~\ref{ivartab} and~\ref{isvartab} list internal variables that
+take on numeric and string values. 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.
+
+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 this table because they are treated as
+``function-like macros''.
+
+The last two tables are Table~\ref{cmdtab} for commands and
+Table~\ref{pseudotab} macros that behave like functions or procedures.
+Such macros take parenthesized argument lists and/or suffix parameters,
+returning either a value whose type is listed in the table, or nothing.
+The latter case is for macros that behave like procedures. Their return
+values are listed as ``--''.
+
+The figures in this appendix present the syntax of the MetaPost language
+starting with expressions in Figures \ref{syexpr1}--\ref{sypseudo}.
+Although the productions sometimes specify types for expressions, primaries,
+secondaries, and tertiaries, no attempt is made to give separate syntaxes
+for \tdescr{numeric expression}, \tdescr{pair expression}, etc.
+The simplicity of the productions in Figure~\ref{sytypexpr} is due to this
+lack of type information. Type information
+can be found in Tables \ref{ivartab}--\ref{pseudotab}.
+
+Figures \ref{syprog}, \ref{sycmds1} and~\ref{sycmds2} give the syntax
+for MetaPost programs, including statements and commands. They do not
+mention loops\index{loops} and {\tt if}\index{if?\texttt{if}} tests
+because these constructions do not behave like statements. The syntax
+given in Figures \ref{syexpr1}--\ref{sycondloop} applies to the result
+of expanding all conditionals and loops. Conditionals and loops do have
+a syntax, but they deal with almost arbitrary sequences of tokens.
+Figure~\ref{sycondloop} specifies conditionals in terms of
+\tdescr{balanced tokens} and loops in terms of \tdescr{loop text}, where
+\tdescr{balanced tokens} is any sequence of tokens balanced with respect
+to {\tt if} and {\tt fi}, and \tdescr{loop text} is a sequence of tokens
+balanced with respect to {\tt for}, {\tt forsuffixes}, {\tt forever},
+and {\tt endfor}.
+
+\begin{table}[htp]
+\caption{Internal variables with numeric values}
+$$\begin{tabular}{|l|r|l|}
+\hline
+\multicolumn1{|c}{Name}& \multicolumn1{|c}{Page}& \multicolumn1{|c|}{Explanation}\\
+\hline
+\hline
+\pl\tt ahangle& \pageref{Dahangle}&
+ angle for arrowheads in degrees (default: 45)\\\hline
+\pl\tt ahlength& \pageref{Dahlength}&
+ size of arrowheads (default: 4{\tt bp})\\\hline
+\pl\tt bboxmargin& \pageref{Dbbmargin}&
+ extra space allowed by {\tt bbox} (default 2{\tt bp})\\\hline
+\tt charcode& \pageref{Dcharcode}&
+ the number of the current figure\\\hline
+\tt day& --&
+ the current day of the month\\\hline
+\tt defaultcolormodel& \pageref{Ddefaultcolormodel}&
+ the initial color model (default: 5, rgb)\\\hline
+\pl\tt defaultpen& \pageref{Ddefaultpen}&
+ numeric index used by {\tt pickup} to select default pen\\\hline
+\pl\tt defaultscale& \pageref{Ddfscale}&
+ font scale factor for label strings (default 1)\\\hline
+\tt hour& --&
+ the hour of the day this job started\\\hline
+\pl\tt labeloffset& \pageref{Dlaboff}&
+ offset distance for labels (default 3{\tt bp})\\\hline
+\tt linecap& \pageref{Dlinecap}&
+ 0 for butt, 1 for round, 2 for square\\\hline
+\tt linejoin& \pageref{Dlinejoin}&
+ 0 for mitered, 1 for round, 2 for beveled\\\hline
+\tt minute& --&
+ the minute of the hour this job started\\\hline
+\tt miterlimit& \pageref{Dmiterlim}&
+ controls miter length as in PostScript\\\hline
+\tt month& --&
+ the current month (e.g, 3 $\equiv$ March)\\\hline
+\tt mpprocset& --&
+ \vtop{\hbox{set this to~1 if you want to include a PostScript
+dictionary}\hbox{of abbreviations in the output}}\\\hline
+\tt pausing& --&
+ ${}>0$ to display lines on the terminal before they are read\\\hline
+\tt prologues& \pageref{Dprologues}&
+ ${}>0$ to output conforming PostScript using built-in fonts\\\hline
+\tt restoreclipcolor& --&
+ restore the graphics state after clip operations (default: 1)\\\hline
+\tt showstopping& --&
+ ${}>0$ to stop after each {\tt show} command\\\hline
+\tt time& --&
+ the number of minutes past midnight when this job started\\\hline
+\tt tracingcapsules& \pageref{Dtcapsules}&
+ ${}>0$ to show capsules too\\\hline
+\tt tracingchoices& \pageref{Dtchoices}&
+ ${}>0$ to show the control points chosen for paths\\\hline
+\tt tracingcommands& \pageref{Dtcommands}&
+ ${}>0$ to show commands and operations as they are performed\\\hline
+\tt tracingequations& \pageref{Dtequations}&
+ ${}>0$ to show each variable when it becomes known\\\hline
+\tt tracinglostchars& \pageref{Dtlostchars}&
+ ${}>0$ to show characters that aren't {\tt infont}\\\hline
+\tt tracingmacros& \pageref{Dtmacros}&
+ ${}>0$ to show macros before they are expanded\\\hline
+\tt tracingonline& \pageref{Dtonline}&
+ ${}>0$ to show long diagnostics on the terminal\\\hline
+\tt tracingoutput& \pageref{Dtoutput}&
+ ${}>0$ to show digitized edges as they are output\\\hline
+\tt tracingrestores& \pageref{Dtrestores}&
+ ${}>0$ to show when a variable or internal is restored\\\hline
+\tt tracingspecs& \pageref{Dtspecs}&
+ ${}>0$ to show path subdivision when using a polygonal a pen\\\hline
+\tt tracingstats& \pageref{Dtstats}&
+ ${}>0$ to show memory usage at end of job\\\hline
+\tt tracingtitles& --&
+ ${}>0$ to show titles online when they appear\\\hline
+\tt troffmode& \pageref{Dtroffmode}&
+ set to~1 if a {\tt -troff} or {\tt -T} option was given\\\hline
+\tt truecorners& \pageref{Dtruecorn}&
+ ${}>0$ to make {\tt llcorner} etc. ignore {\tt setbounds}\\\hline
+\tt warningcheck& \pageref{Dwarncheck}&
+ controls error message when variable value is large\\\hline
+\tt year& --&
+ the current year (e.g., 1992)\\\hline
+\end{tabular}
+$$
+\label{ivartab}%
+\index{day?\texttt{day}}\index{hour?\texttt{hour}}\index{minute?\texttt{minute}}\index{month?\texttt{month}}\index{pausing?\texttt{pausing}}\index{showstopping?\texttt{showstopping}}%
+\index{time?\texttt{time}}\index{tracingtitles?\texttt{tracingtitles}}\index{year?\texttt{year}}
+\end{table}
+
+
+\begin{table}[htp]
+\caption{Internal string variables}
+$$\begin{tabular}{|l|r|l|}
+\hline
+\multicolumn1{|c}{Name}& \multicolumn1{|c}{Page}& \multicolumn1{|c|}{Explanation}\\
+\hline
+\hline
+\tt jobname& --&
+ The name of this job\\\hline
+\tt outputformat& \pageref{Doutputformat}&
+ Output backend to be used (default: ``eps'')\\\hline
+\tt outputtemplate& \pageref{Doutputtemplate}&
+ Output filename template (default: ``\%j.\%c'')\\\hline
+\end{tabular}
+$$
+\label{isvartab}
+\index{jobname?\texttt{jobname}}
+\end{table}
+
+
+\begin{table}[htp]
+\caption{Other Predefined Variables}
+$$\begin{tabular}{|l|l|r|l|}
+\hline
+\multicolumn1{|c}{Name}& \multicolumn1{|c}{Type}& \multicolumn1{|c}{Page}&
+ \multicolumn1{|c|}{Explanation}\\
+\hline
+\hline
+\pl\tt background& color& \pageref{Dbground}&
+ Color for {\tt unfill} and {\tt undraw} (usually white)\\\hline
+\pl\tt currentpen& pen& \pageref{Dcurpen}&
+ Last pen picked up (for use by the {\tt draw} command)\\\hline
+\pl\tt currentpicture& picture& \pageref{Dcurpic}&
+ Accumulate results of {\tt draw} and {\tt fill} commands\\\hline
+\pl\tt cuttings& path& \pageref{Dcuttings}&
+ subpath cut off by last {\tt cutbefore} or {\tt cutafter}\\\hline
+\pl\tt defaultfont& string& \pageref{Ddffont}&
+ Font used by label commands for typesetting strings\\\hline
+\pl\tt extra\_beginfig& string& \pageref{Dxbfig}&
+ Commands for {\tt beginfig} to scan\\\hline
+\pl\tt extra\_endfig& string& \pageref{Dxefig}&
+ Commands for {\tt endfig} to scan\\\hline
+\end{tabular}
+$$
+\label{pvartab}
+\end{table}
+
+
+\begin{table}[htp]
+\caption{Predefined Constants}
+$$\begin{tabular}{|l|l|r|l|}
+\hline
+\multicolumn1{|c}{Name}& \multicolumn1{|c}{Type}& \multicolumn1{|c}{Page}&
+ \multicolumn1{|c|}{Explanation}\\
+\hline
+\hline
+\pl\tt beveled& numeric& \pageref{Dbvled}&
+ {\tt linejoin} value for beveled joins [2]\\\hline
+\pl\tt black& color& \pageref{Dblack}&
+ Equivalent to {\tt (0,0,0)}\\\hline
+\pl\tt blue& color& \pageref{Dblue}&
+ Equivalent to {\tt (0,0,1)}\\\hline
+\pl\tt bp& numeric& \pageref{Dbp}&
+ One PostScript point in {\tt bp} units [1]\\\hline
+\pl\tt butt& numeric& \pageref{Dbutt}&
+ {\tt linecap} value for butt end caps [0]\\\hline
+\pl\tt cc& numeric& --&
+ One cicero in {\tt bp} units [12.79213]\\\hline
+\pl\tt cm& numeric& \pageref{Dcm}&
+ One centimeter in {\tt bp} units [28.34645]\\\hline
+\pl\tt dd& numeric& --&
+ One didot point in {\tt bp} units [1.06601]\\\hline
+\pl\tt ditto& string& --&
+ The {\tt "} character as a string of length 1\\\hline
+\pl\tt down& pair& \pageref{Ddown}&
+ Downward direction vector $(0,-1)$\\\hline
+\pl\tt epsilon& numeric& --&
+ 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}&
+ Circle of diameter 1 centered on $(0,0)$\\\hline
+\pl\tt green& color& \pageref{Dgreen}&
+ Equivalent to {\tt (0,1,0)}\\\hline
+\pl\tt halfcircle& path& \pageref{Dhcirc}&
+ Upper half of a circle of diameter 1\\\hline
+\pl\tt identity& transform& \pageref{Dident}&
+ Identity transformation\\\hline
+\pl\tt in& numeric& \pageref{Din}&
+ One inch in {\tt bp} units [72]\\\hline
+\pl\tt infinity& numeric& \pageref{Dinf}&
+ Large positive value [4095.99998]\\\hline
+\pl\tt left& pair& \pageref{Dleft}&
+ Leftward direction $(-1,0)$\\\hline
+\pl\tt mitered& numeric& \pageref{Dmitred}&
+ {\tt linejoin} value for mitered joins [0]\\\hline
+\pl\tt mm& numeric& \pageref{Dmm}&
+ 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& --&
+ The pair $(0,0)$\\\hline
+\pl\tt pc& numeric& --&
+ One pica in {\tt bp} units [11.95517]\\\hline
+\tt pencircle& pen& \pageref{Dpncirc}&
+ Circular pen of diameter 1\\\hline
+\pl\tt pensquare& pen& \pageref{Dpnsqr}&
+ square pen of height 1 and width 1\\\hline
+\pl\tt pt& numeric& \pageref{Dpt}&
+ One printer's point in {\tt bp} units [0.99626]\\\hline
+\pl\tt quartercircle& path& --&
+ First quadrant of a circle of diameter 1\\\hline
+\pl\tt red& color& \pageref{Dred}&
+ Equivalent to {\tt (1,0,0)}\\\hline
+\pl\tt right& pair& \pageref{Dright}&
+ Rightward direction $(1,0)$\\\hline
+\pl\tt rounded& numeric& \pageref{Drnded}&
+ {\tt linecap} and {\tt linejoin} value for round joins\\
+\tt & & &
+ and end caps [1]\\\hline
+\pl\tt squared& numeric& \pageref{Dsqred}&
+ {\tt linecap} value for square end caps [2]\\\hline
+\tt true& boolean& \pageref{Dtrue}&
+ The boolean value {\tt true}\\\hline
+\pl\tt unitsquare& path& --&
+ The path \verb|(0,0)--(1,0)--(1,1)--(0,1)--cycle|\\\hline
+\pl\tt up& pair& \pageref{Dup}&
+ Upward direction $(0,1)$\\\hline
+\pl\tt white& color& \pageref{Dwhite}&
+ Equivalent to {\tt (1,1,1)}\\\hline
+\pl\tt withdots& picture& \pageref{Dwdots}&
+ Dash pattern that produces dotted lines\\\hline
+\end{tabular}
+$$
+\label{consttab}%
+\index{cc?\texttt{cc}}\index{dd?\texttt{dd}}\index{ditto?\texttt{ditto}}\index{epsilon?\texttt{epsilon}}%
+\index{origin?\texttt{origin}}\index{pc?\texttt{pc}}\index{quartercircle?\texttt{quartercircle}}%
+\index{unitsquare?\texttt{unitsquare}}
+\end{table}
+
+
+\clearpage
+\LTXtable{\textwidth}{mpman-app-optab}
+
+\begin{table}[htp]
+\caption{Commands}
+$$\begin{tabular}{|l|r|l|}
+\hline
+\multicolumn1{|c}{Name}& \multicolumn1{|c}{Page}& \multicolumn1{|c|}{Explanation}\\
+\hline
+\hline
+\tt \verb|addto|& \pageref{sydraw}&
+ Low-level command for drawing and filling\\\hline
+\tt \verb|clip|& \pageref{Dclip}&
+ Applies a clipping path to a picture\\\hline
+\tt \verb|closefrom|& \pageref{Dclosefrom}&
+ Close a file opened by {\tt readfrom}\\\hline
+\pl\tt \verb|cutdraw|& \pageref{Dctdraw}&
+ Draw with butt end caps\\\hline
+\tt \verb|dashed|& \pageref{Ddashed}&
+ Apply dash pattern to drawing command\\\hline
+\pl\tt \verb|draw|& \pageref{curves}&
+ Draw a line or a picture\\\hline
+\pl\tt \verb|drawarrow|& \pageref{Ddrwarr}&
+ 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|errhelp|& \pageref{Derrhelp}&
+ Declare help message for interactive mode\\\hline
+\tt \verb|errmessage|& \pageref{Derrmessage}&
+ Show error message on the terminal and enter interactive
+ mode\\\hline
+\tt \verb|filenametemplate|& \pageref{Dfilenametemplate}&
+ Set output file name pattern (deprecated, see
+ \verb|outputtemplate|)\\\hline
+\pl\tt \verb|fill|& \pageref{Dfill}&
+ Fill inside a cyclic path\\\hline
+\pl\tt \verb|filldraw|& \pageref{Dfildrw}&
+ Draw a cyclic path and fill inside it\\\hline
+\tt \verb|fontmapfile|& \pageref{Dfontmapfile}&
+ read font map entries from file\\\hline
+\tt \verb|fontmapline|& \pageref{Dfontmapline}&
+ declare a font map entry\\\hline
+\tt \verb|interim|& \pageref{Dinterm}&
+ Make a local change to an internal variable\\\hline
+\tt \verb|let|& --&
+ Assign one symbolic token the meaning of another\\\hline
+\pl\tt \verb|loggingall|& \pageref{Dlogall}&
+ Turn on all tracing (log file only)\\\hline
+\tt \verb|message|& \pageref{Dmessage}&
+ Show message string on the terminal\\\hline
+\tt \verb|newinternal|& \pageref{Dnewint}&
+ Declare new internal variables\\\hline
+\pl\tt \verb|pickup|& \pageref{Dpickup}&
+ Specify new pen for line drawing\\\hline
+\tt \verb|save|& \pageref{Dsave}&
+ Make variables local\\\hline
+\tt \verb|setbounds|& \pageref{Dsetbnd}&
+ Make a picture lie about its bounding box\\\hline
+\tt \verb|shipout|& \pageref{Dship}&
+ Low-level command to output a figure\\\hline
+\tt \verb|show|& \pageref{Dshow}&
+ print out expressions symbolically\\\hline
+\tt \verb|showdependencies|& \pageref{Dshdep}&
+ print out all unsolved equations\\\hline
+\tt \verb|showtoken|& \pageref{Dshtok}&
+ print an explanation of what a token is\\\hline
+\tt \verb|showvariable|& \pageref{Dshvar}&
+ print variables symbolically\\\hline
+\tt \verb|special|& \pageref{Dspecl}&
+ print a string directly in the PostScript output file\\\hline
+\pl\tt \verb|tracingall|& \pageref{Dtall}&
+ Turn on all tracing\\\hline
+\pl\tt \verb|tracingnone|& \pageref{Dtnone}&
+ Turn off all tracing\\\hline
+\pl\tt \verb|undraw|& \pageref{Dundraw}&
+ Erase a line or a picture\\\hline
+\pl\tt \verb|unfill|& \pageref{Dunfill}&
+ Erase inside a cyclic path\\\hline
+\pl\tt \verb|unfilldraw|& \pageref{Dunfdrw}&
+ Erase a cyclic path and its inside\\\hline
+\tt \verb|withcmykcolor|& \pageref{Dwithcmykcolor}&
+ Apply CMYK color to drawing command\\\hline
+\tt \verb|withcolor|& \pageref{Dwithcolor}&
+ Apply generic color specification to drawing command\\\hline
+\tt \verb|withgreyscale|& \pageref{Dwithgreyscale}&
+ Apply greyscale color to drawing command\\\hline
+\tt \verb|withoutcolor|& \pageref{Dwithoutcolor}&
+ Don't apply any color specification to drawing command\\\hline
+\tt \verb|withpen|& \pageref{sec.pens}&
+ Apply pen to drawing operation\\\hline
+\tt \verb|withpostscript|& \pageref{Dwithpost}&
+ End raw PostScript code\\\hline
+\tt \verb|withprescript|& \pageref{Dwithpre}&
+ Begin raw PostScript code\\\hline
+\tt \verb|withrgbcolor|& \pageref{Dwithrgbcolor}&
+ Apply RGB color to drawing command\\\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|}
+\hline
+\multicolumn1{|c}{Name}& \multicolumn1{|c}{Arguments}&
+ \multicolumn1{|c}{Result}& \multicolumn1{|c}{Page}&
+ \multicolumn1{|c|}{Explanation}\\
+\hline
+\hline
+\pl\tt \verb|buildcycle|& list of paths& path& \pageref{buildcy}&
+ Build a cyclic path\\\hline
+\pl\tt \verb|dashpattern|& on/off distances& picture& \pageref{Ddshpat}&
+ Create a pattern for dashed lines\\\hline
+\pl\tt \verb|decr|& numeric variable& numeric& \pageref{Dincr}&
+ Decrement and return new value\\\hline
+\pl\tt \verb|dotlabel|& suffix, picture, pair& --& \pageref{Ddotlab}&
+ Mark point and draw picture nearby\\\hline
+\pl\tt \verb|dotlabel|& suffix, string, pair& --& \pageref{Ddotlab}&
+ Mark point and place text nearby\\\hline
+\pl\tt \verb|dotlabels|& suffix, point numbers& --& \pageref{Ddotlbs}&
+ Mark {\tt z} points with their numbers\\\hline
+\pl\tt \verb|drawdot|& pair& --& \pageref{Ddrawdot}&
+ Draw a dot at the given point\\\hline
+\pl\tt \verb|drawoptions|& drawing options& --& \pageref{Ddropts}&
+ Set options for drawing commands\\\hline
+\pl\tt \verb|image|& string& picture& \pageref{Dimage}&
+ Return picture from text\\\hline
+\pl\tt \verb|incr|& numeric variable& numeric& \pageref{Dincr}&
+ Increment and return new value\\\hline
+\pl\tt \verb|label|& suffix, picture, pair& --& \pageref{Dlabel}&
+ Draw picture near given point\\\hline
+\pl\tt \verb|label|& suffix, string, pair& --& \pageref{Dlabel}&
+ Place text near given point\\\hline
+\pl\tt \verb|labels|& suffix, point numbers& --& \pageref{Dlabels}&
+ Draw {\tt z} point numbers; no dots\\\hline
+\pl\tt \verb|max|& list of numerics& numeric& --&
+ Find the maximum\\\hline
+\pl\tt \verb|max|& list of strings& string& --&
+ Find the lexicographically last string\\\hline
+\pl\tt \verb|min|& list of numerics& numeric& --&
+ Find the minimum\\\hline
+\pl\tt \verb|min|& list of strings& string& --&
+ Find the lexicographically first string\\\hline
+\pl\tt \verb|thelabel|& suffix, picture, pair& picture& \pageref{Dthelab}&
+ Picture shifted as if to label a point\\\hline
+\pl\tt \verb|thelabel|& suffix, string, pair& picture& \pageref{Dthelab}&
+ Text positioned as if to label a point\\\hline
+\pl\tt \verb|z|& suffix& pair& \pageref{Dzconv}&
+ The pair ${\tt x}\descr{suffix},{\tt y}\descr{suffix})$\\\hline
+\end{tabular}
+$$
+\index{min?\texttt{min}}\index{max?\texttt{max}}%
+\label{pseudotab}
+\end{table}
+
+\clearpage
+
+\begin{figure}[htp]
+\begin{ctabbing}
+$\tt \descr{atom} \rightarrow \descr{variable} \;|\; \descr{argument}$\\
+$\tt \qquad \;|\; \descr{number or fraction}$\\
+$\tt \qquad \;|\; \descr{internal variable}$\\
+$\tt \qquad \;|\; \hbox{\tt (}\descr{expression}\hbox{\tt )}$\\
+$\tt \qquad \;|\; begingroup \descr{statement list} \descr{expression} endgroup$\\
+$\tt \qquad \;|\; \descr{nullary op}$\\
+$\tt \qquad \;|\; btex \descr{typesetting commands} etex$\\
+$\tt \qquad \;|\; \descr{pseudo function}$\\
+$\tt \descr{primary} \rightarrow \descr{atom}$\\
+$\tt \qquad \;|\; \hbox{\tt (}\descr{numeric expression}\hbox{\tt ,} \descr{numeric expression}\hbox{\tt )}$\\
+$\tt \qquad \;|\; \hbox{\tt (}\descr{numeric expression}\hbox{\tt ,} \descr{numeric expression}\hbox{\tt ,} \descr{numeric expression}\hbox{\tt )}$\\
+$\tt \qquad \;|\; \descr{of operator} \descr{expression} of \descr{primary}$\\
+$\tt \qquad \;|\; \descr{unary op} \descr{primary}$\\
+$\tt \qquad \;|\; str \descr{suffix}$\\
+$\tt \qquad \;|\; z \descr{suffix}$\\
+$\tt \qquad \;|\; \descr{numeric atom}\hbox{\tt [}\descr{expression}\hbox{\tt ,}\descr{expression}\hbox{\tt ]}$\\
+$\tt \qquad \;|\; \descr{scalar multiplication op} \descr{primary}$\\
+$\tt \descr{secondary} \rightarrow \descr{primary}$\\
+$\tt \qquad \;|\; \descr{secondary} \descr{primary binop} \descr{primary}$\\
+$\tt \qquad \;|\; \descr{secondary} \descr{transformer}$\\
+$\tt \descr{tertiary} \rightarrow \descr{secondary}$\\
+$\tt \qquad \;|\; \descr{tertiary} \descr{secondary binop} \descr{secondary}$\\
+$\tt \descr{subexpression} \rightarrow \descr{tertiary}$\\
+$\tt \qquad \;|\; \descr{path expression} \descr{path join} \descr{path knot}$\\
+$\tt \descr{expression} \rightarrow \descr{subexpression}$\\
+$\tt \qquad \;|\; \descr{expression} \descr{tertiary binop} \descr{tertiary}$\\
+$\tt \qquad \;|\; \descr{path subexpression} \descr{direction specifier}$\\
+$\tt \qquad \;|\; \descr{path subexpression} \descr{path join} cycle$\\
+$\tt $\\
+$\tt \descr{path knot} \rightarrow \descr{tertiary}$\\
+$\tt \descr{path join} \rightarrow \verb|--|$\\
+$\tt \qquad \;|\; \descr{direction specifier} \descr{basic path join} \descr{direction specifier}$\\
+$\tt \descr{direction specifier} \rightarrow \descr{empty}$\\
+$\tt \qquad \;|\; \verb|{|curl \descr{numeric expression}\verb|}|$\\
+$\tt \qquad \;|\; \verb|{|\descr{pair expression}\verb|}|$\\
+$\tt \qquad \;|\; \verb|{|\descr{numeric expression}\hbox{\tt ,}\descr{numeric expression}\verb|}|$\\
+$\tt \descr{basic path join} \rightarrow \hbox{\tt ..} \;|\; \hbox{\tt ...} \;|\; \hbox{\tt ..}\descr{tension}\hbox{\tt ..} \;|\; \hbox{\tt ..}\descr{controls}\hbox{\tt ..}$\\
+$\tt \descr{tension} \rightarrow tension \descr{numeric primary}$\\
+$\tt \qquad \;|\; tension \descr{numeric primary} and \descr{numeric primary}$\\
+$\tt \descr{controls} \rightarrow controls \descr{pair primary}$\\
+$\tt \qquad \;|\; controls \descr{pair primary} and \descr{pair primary}$\\
+$\tt $\\
+$\tt \descr{argument} \rightarrow \descr{symbolic token}$\\
+$\tt \descr{number or fraction} \rightarrow \descr{number}\hbox{\tt /}\descr{number}$\\
+$\tt \qquad \;|\; \descr{number not followed by `\hbox{\tt /}\tdescr{number}'}$\\
+$\tt \descr{scalar multiplication op} \rightarrow + \;|\; -$\\
+$\tt \qquad \;|\; \descr{`\tdescr{number or fraction}' not followed by `\tdescr{add op}\tdescr{number}'}$
+\end{ctabbing}
+\caption{Part 1 of the syntax for expressions}
+\index{expression?\tdescr{expression}}\index{nullary op?\tdescr{nullary op}}\index{of operator?\tdescr{of operator}}%
+\index{path knot?\tdescr{path knot}}\index{primary?\tdescr{primary}}\index{primary binop?\tdescr{primary binop}}%
+\index{secondary?\tdescr{secondary}}\index{secondary binop?\tdescr{secondary binop}}\index{suffix?\tdescr{suffix}}%
+\index{tertiary?\tdescr{tertiary}}\index{tertiary binop?\tdescr{tertiary binop}}\index{unary op?\tdescr{unary op}}%
+\label{syexpr1}
+\end{figure}
+
+\begin{figure}[htp]
+\begin{ctabbing}
+$\tt \descr{transformer} \rightarrow rotated \descr{numeric primary}$\\
+$\tt \qquad \;|\; scaled \descr{numeric primary}$\\
+$\tt \qquad \;|\; shifted \descr{pair primary}$\\
+$\tt \qquad \;|\; slanted \descr{numeric primary}$\\
+$\tt \qquad \;|\; transformed \descr{transform primary}$\\
+$\tt \qquad \;|\; xscaled \descr{numeric primary}$\\
+$\tt \qquad \;|\; yscaled \descr{numeric primary}$\\
+$\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 \;|\; nullpen \;|\; nullpicture \;|\; pencircle$\\
+$\tt \qquad \;|\; true \;|\; whatever$\\
+$\tt \descr{unary op} \rightarrow \descr{type}$\\
+$\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 \;|\; 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 \;|\; rgbcolor \;|\; string \;|\; transform$\\
+$\tt \descr{internal type} \rightarrow numeric \;|\; string$\\
+$\tt \descr{primary binop} \rightarrow \hbox{\tt *} \;|\; \hbox{\tt /} \;|\; \hbox{\tt **} \;|\; and$\\
+$\tt \qquad \;|\; dotprod \;|\; div \;|\; infont \;|\; mod$\\
+$\tt \descr{secondary binop} \rightarrow + \;|\; - \;|\; ++ \;|\; +-+ \;|\; or$\\
+$\tt \qquad \;|\; intersectionpoint \;|\; intersectiontimes$\\
+$\tt \descr{tertiary binop} \rightarrow \hbox{\tt \&} \;|\; \hbox{\verb|<|} \;|\; \hbox{\verb|<=|} \;|\; \hbox{\verb|<>|} \;|\; \hbox{\tt =} \;|\; \hbox{\verb|>|} \;|\; \hbox{\verb|>=|}$\\
+$\tt \qquad \;|\; cutafter \;|\; cutbefore$\\
+$\tt \descr{of operator} \rightarrow arctime \;|\; direction \;|\; directiontime \;|\; directionpoint$\\
+$\tt \qquad \;|\; glyph \;|\; penoffset \;|\; point \;|\; postcontrol \;|\; precontrol$\\
+$\tt \qquad \;|\; subpath \;|\; substring$\\
+$\tt $\\
+$\tt \descr{variable} \rightarrow \descr{tag}\descr{suffix}$\\
+$\tt \descr{suffix} \rightarrow \descr{empty} \;|\; \descr{suffix}\descr{subscript} \;|\; \descr{suffix}\descr{tag}$\\
+$\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 \;|\; defaultcolormodel \;|\; defaultpen \;|\; defaultscale$\\
+$\tt \qquad \;|\; hour \;|\; jobname \;|\; labeloffset \;|\; linecap \;|\; linejoin
+\;|\; minute \;|\; miterlimit \;|\; month$\\
+$\tt \qquad \;|\; outputformat \;|\; outputtemplate \;|\; pausing \;|\; prologues \;|\; showstopping$\\
+$\tt \qquad \;|\; time \;|\; tracingoutput \;|\; tracingcapsules \;|\; tracingchoices \;|\; tracingcommands$\\
+$\tt \qquad \;|\; tracingequations \;|\; tracinglostchars \;|\; tracingmacros$\\
+$\tt \qquad \;|\; tracingonline \;|\; tracingrestores \;|\; tracingspecs$\\
+$\tt \qquad \;|\; tracingstats \;|\; tracingtitles \;|\; truecorners$\\
+$\tt \qquad \;|\; warningcheck \;|\; year$\\
+$\tt \qquad \;|\; \descr{symbolic token defined by {\tt newinternal}}$
+\end{ctabbing}
+\caption{Part 2 of the syntax for expressions}
+\index{nullary op?\tdescr{nullary op}}\index{of operator?\tdescr{of operator}}\index{primary binop?\tdescr{primary binop}}%
+\index{secondary binop?\tdescr{secondary binop}}\index{subscript?\tdescr{subscript}}\index{suffix?\tdescr{suffix}}%
+\index{tertiary binop?\tdescr{tertiary binop}}\index{unary op?\tdescr{unary op}}%
+\label{syexpr2}
+\end{figure}
+
+\begin{figure}[htp]
+\begin{ctabbing}
+$\tt \descr{pseudo function} \rightarrow min\hbox{\tt (}\descr{expression list}\hbox{\tt )}$\\
+$\tt \qquad \;|\; max\hbox{\tt (}\descr{expression list}\hbox{\tt )}$\\
+$\tt \qquad \;|\; incr\hbox{\tt (}\descr{numeric variable}\hbox{\tt )}$\\
+$\tt \qquad \;|\; decr\hbox{\tt (}\descr{numeric variable}\hbox{\tt )}$\\
+$\tt \qquad \;|\; dashpattern\hbox{\tt (}\descr{on\hbox{\tt /}off list}\hbox{\tt )}$\\
+$\tt \qquad \;|\; interpath\hbox{\tt (}\descr{numeric expression}\hbox{\tt ,} \descr{path expression}\hbox{\tt ,} \descr{path expression}\hbox{\tt )}$\\
+$\tt \qquad \;|\; buildcycle\hbox{\tt (}\descr{path expression list}\hbox{\tt )}$\\
+$\tt \qquad \;|\; thelabel\descr{label suffix}\hbox{\tt (}\descr{expression}\hbox{\tt ,} \descr{pair expression}\hbox{\tt )}$\\
+$\tt \descr{path expression list} \rightarrow \descr{path expression}$\\
+$\tt \qquad \;|\; \descr{path expression list}\hbox{\tt ,} \descr{path expression}$\\
+$\tt \descr{on\hbox{\tt /}off list} \rightarrow \descr{on\hbox{\tt /}off list}\descr{on\hbox{\tt /}off clause} \;|\; \descr{on\hbox{\tt /}off clause}$\\
+$\tt \descr{on\hbox{\tt /}off clause} \rightarrow on \descr{numeric tertiary} \;|\; off \descr{numeric tertiary}$
+\end{ctabbing}
+\caption{The syntax for function-like macros}
+\index{label suffix?\tdescr{label suffix}}%
+\label{sypseudo}
+\end{figure}
+
+\begin{figure}[htp]
+\begin{ctabbing}
+$\tt \descr{boolean expression} \rightarrow \descr{expression}$\\
+$\tt \descr{cmykcolor expression} \rightarrow \descr{expression}$\\
+$\tt \descr{color expression} \rightarrow \descr{expression}$\\
+$\tt \descr{numeric atom} \rightarrow \descr{atom}$\\
+$\tt \descr{numeric expression} \rightarrow \descr{expression}$\\
+$\tt \descr{numeric primary} \rightarrow \descr{primary}$\\
+$\tt \descr{numeric tertiary} \rightarrow \descr{tertiary}$\\
+$\tt \descr{numeric variable} \rightarrow \descr{variable} \;|\; \descr{internal variable}$\\
+$\tt \descr{pair expression} \rightarrow \descr{expression}$\\
+$\tt \descr{pair primary} \rightarrow \descr{primary}$\\
+$\tt \descr{path expression} \rightarrow \descr{expression}$\\
+$\tt \descr{path subexpression} \rightarrow \descr{subexpression}$\\
+$\tt \descr{pen expression} \rightarrow \descr{expression}$\\
+$\tt \descr{picture expression} \rightarrow \descr{expression}$\\
+$\tt \descr{picture variable} \rightarrow \descr{variable}$\\
+$\tt \descr{rgbcolor expression} \rightarrow \descr{expression}$\\
+$\tt \descr{string expression} \rightarrow \descr{expression}$\\
+$\tt \descr{suffix parameter} \rightarrow \descr{parameter}$\\
+$\tt \descr{transform primary} \rightarrow \descr{primary}$
+\end{ctabbing}
+\caption{Miscellaneous productions needed to complete the BNF}
+\label{sytypexpr}
+\end{figure}
+
+\begin{figure}[htp]
+\begin{ctabbing}
+$\tt \descr{program} \rightarrow \descr{statement list} end$\\
+$\tt \descr{statement list} \rightarrow \descr{empty} \;|\; \descr{statement list} \hbox{\tt ;} \descr{statement}$\\
+$\tt \descr{statement} \rightarrow \descr{empty}$\\
+$\tt \qquad \;|\; \descr{equation} \;|\; \descr{assignment}$\\
+$\tt \qquad \;|\; \descr{declaration} \;|\; \descr{macro definition}$\\
+$\tt \qquad \;|\; \descr{compound} \;|\; \descr{pseudo procedure}$\\
+$\tt \qquad \;|\; \descr{command}$\\
+$\tt \descr{compound} \rightarrow begingroup \descr{statement list} endgroup$\\
+$\tt \qquad \;|\; beginfig\hbox{\tt (}\descr{numeric expression}\hbox{\tt );} \descr{statement list}\hbox{\tt ;} endfig$\\
+$\tt $\\
+$\tt \descr{equation} \rightarrow \descr{expression} \hbox{\tt =} \descr{right-hand side}$\\
+$\tt \descr{assignment} \rightarrow \descr{variable} \hbox{\tt :=} \descr{right-hand side}$\\
+$\tt \qquad \;|\; \descr{internal variable} \hbox{\tt :=} \descr{right-hand side}$\\
+$\tt \descr{right-hand side} \rightarrow \descr{expression} \;|\; \descr{equation} \;|\; \descr{assignment}$\\
+$\tt $\\
+$\tt \descr{declaration} \rightarrow \descr{type} \descr{declaration list}$\\
+$\tt \descr{declaration list} \rightarrow \descr{generic variable}$\\
+$\tt \qquad \;|\; \descr{declaration list}\hbox{\tt ,} \descr{generic variable}$\\
+$\tt \descr{generic variable} \rightarrow \descr{symbolic token} \descr{generic suffix}$\\
+$\tt \descr{generic suffix} \rightarrow \descr{empty} \;|\; \descr{generic suffix} \descr{tag}$\\
+$\tt \qquad \;|\; \descr{generic suffix} \hbox{\tt []}$\\
+$\tt $\\
+$\tt \descr{macro definition} \rightarrow \descr{macro heading} \hbox{\tt =} \descr{replacement text} enddef$\\
+$\tt \descr{macro heading} \rightarrow def \descr{symbolic token} \descr{delimited part} \descr{undelimited part}$\\
+$\tt \qquad \;|\; vardef \descr{generic variable} \descr{delimited part} \descr{undelimited part}$\\
+$\tt \qquad \;|\; vardef \descr{generic variable} \hbox{\verb|@#|} \descr{delimited part} \descr{undelimited part}$\\
+$\tt \qquad \;|\; \descr{binary def} \descr{parameter} \descr{symbolic token} \descr{parameter}$\\
+$\tt \descr{delimited part} \rightarrow \descr{empty}$\\
+$\tt \qquad \;|\; \descr{delimited part}\hbox{\tt (}\descr{parameter type} \descr{parameter tokens}\hbox{\tt )}$\\
+$\tt \descr{parameter type} \rightarrow expr \;|\; suffix \;|\; text$\\
+$\tt \descr{parameter tokens} \rightarrow \descr{parameter} \;|\; \descr{parameter tokens}\hbox{\tt ,} \descr{parameter}$\\
+$\tt \descr{parameter} \rightarrow \descr{symbolic token}$\\
+$\tt \descr{undelimited part} \rightarrow \descr{empty}$\\
+$\tt \qquad \;|\; \descr{parameter type} \descr{parameter}$\\
+$\tt \qquad \;|\; \descr{precedence level} \descr{parameter}$\\
+$\tt \qquad \;|\; expr \descr{parameter} of \descr{parameter}$\\
+$\tt \descr{precedence level} \rightarrow primary \;|\; secondary \;|\; tertiary$\\
+$\tt \descr{binary def} \rightarrow primarydef \;|\; secondarydef \;|\; tertiarydef$\\
+$\tt $\\
+$\tt \descr{pseudo procedure} \rightarrow drawoptions\hbox{\tt (}\descr{option list}\hbox{\tt )}$\\
+$\tt \qquad \;|\; label\descr{label suffix}\hbox{\tt (}\descr{expression}\hbox{\tt ,} \descr{pair expression}\hbox{\tt )}$\\
+$\tt \qquad \;|\; dotlabel\descr{label suffix}\hbox{\tt (}\descr{expression}\hbox{\tt ,} \descr{pair expression}\hbox{\tt )}$\\
+$\tt \qquad \;|\; labels\descr{label suffix}\hbox{\tt (}\descr{point number list}\hbox{\tt )}$\\
+$\tt \qquad \;|\; dotlabels\descr{label suffix}\hbox{\tt (}\descr{point number list}\hbox{\tt )}$\\
+$\tt \descr{point number list} \rightarrow \descr{suffix} \;|\; \descr{point number list}\hbox{\tt ,} \descr{suffix}$\\
+$\tt \descr{label suffix} \rightarrow \descr{empty} \;|\; lft \;|\; rt \;|\; top \;|\; bot \;|\; ulft \;|\; urt \;|\; llft \;|\; lrt$
+\end{ctabbing}
+\caption{Overall syntax for MetaPost programs}
+\index{generic variable?\tdescr{generic variable}}\index{label suffix?\tdescr{label suffix}}\index{replacement text?\tdescr{replacement text}}%
+\index{suffix?\tdescr{suffix}}%
+\label{syprog}
+\end{figure}
+
+\begin{figure}[htp]
+\begin{ctabbing}
+$\tt \descr{command} \rightarrow clip \descr{picture variable} to \descr{path expression}$\\
+$\tt \qquad \;|\; interim \descr{internal variable} \hbox{\tt :=} \descr{right-hand side}$\\
+$\tt \qquad \;|\; let \descr{symbolic token} \hbox{\tt =} \descr{symbolic token}$\\
+$\tt \qquad \;|\; pickup \descr{expression}$\\
+$\tt \qquad \;|\; randomseed \hbox{\tt :=} \descr{numeric expression}$\\
+$\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 \;|\; 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{newinternal command}$\\
+$\tt \qquad \;|\; \descr{message command}$\\
+$\tt \qquad \;|\; \descr{mode command}$\\
+$\tt \qquad \;|\; \descr{show command}$\\
+$\tt \qquad \;|\; \descr{special command}$\\
+$\tt \qquad \;|\; \descr{tracing command}$\\
+$\tt $\\
+$\tt \descr{show command} \rightarrow show \descr{expression list}$\\
+$\tt \qquad \;|\; showvariable \descr{symbolic token list}$\\
+$\tt \qquad \;|\; showtoken \descr{symbolic token list}$\\
+$\tt \qquad \;|\; showdependencies$\\
+$\tt $\\
+$\tt \descr{symbolic token list} \rightarrow \descr{symbolic token}$\\
+$\tt \qquad \;|\; \descr{symbolic token}\hbox{\tt ,} \descr{symbolic token list}$\\
+$\tt \descr{expression list} \rightarrow \descr{expression} \;|\; \descr{expression list}\hbox{\tt ,} \descr{expression}$\\
+$\tt $\\
+$\tt \descr{addto command} \rightarrow$\\
+$\tt \qquad addto \descr{picture variable} also \descr{picture expression} \descr{option list}$\\
+$\tt \qquad \;|\; addto \descr{picture variable} contour \descr{path expression} \descr{option list}$\\
+$\tt \qquad \;|\; addto \descr{picture variable} doublepath \descr{path expression} \descr{option list}$\\
+$\tt \descr{option list} \rightarrow \descr{empty} \;|\; \descr{drawing option} \descr{option list}$\\
+$\tt \descr{drawing option} \rightarrow withcolor \descr{color expression}$\\
+$\tt \qquad \;|\; withrgbcolor \descr{rgbcolor expression} \;|\; withcmykcolor \descr{cmykcolor expression}$\\
+$\tt \qquad \;|\; withgreyscale \descr{numeric expression} \;|\; withoutcolor$\\
+$\tt \qquad \;|\; withprescript \descr{string expression} \;|\; withpostscript \descr{string expression}$\\
+$\tt \qquad \;|\; withpen \descr{pen expression} \;|\; dashed \descr{picture expression}$\\
+$\tt $\\
+$\tt \descr{drawing command} \rightarrow draw \descr{picture expression} \descr{option list}$\\
+$\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{newinternal command} \rightarrow newinternal \descr{internal type} \descr{symbolic token list}$\\
+$\tt \qquad \;|\; newinternal \descr{symbolic token list}$\\
+$\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}$
+\end{ctabbing}
+\caption{Part 1 of the syntax for commands}
+\index{option list?\tdescr{option list}}\index{picture variable?\tdescr{picture variable}}%
+\label{sycmds1}
+
+% is this really true? in practice, in real implementations?
+%\bigskip
+%By the way, the default for \ttindex{randomseed} is, in effect,
+%$\textsl{day} + \textsl{time}*\epsilon$. Unfortunately, \textsl{time}
+%is in minutes.
+\end{figure}
+
+\begin{figure}[htp]
+\begin{ctabbing}
+$\tt \descr{mode command} \rightarrow batchmode \;|\; nonstopmode$\\
+$\tt \qquad \;|\; scrollmode \;|\; errorstopmode$\\
+$\tt $\\
+$\tt \descr{special command} \rightarrow fontmapfile \descr{string expression}$\\
+$\tt \qquad \;|\; fontmapline \descr{string expression}$\\
+$\tt \qquad \;|\; special \descr{string expression}$\\
+$\tt $\\
+$\tt \descr{tracing command} \rightarrow tracingall \;|\; loggingall \;|\; tracingnone$
+\end{ctabbing}
+\caption{Part 2 of the syntax for commands}
+\index{batchmode?\texttt{batchmode}}\index{nonstopmode?\texttt{nonstopmode}}\index{scrollmode?\texttt{scrollmode}}\index{errorstopmode?\texttt{errorstopmode}}%
+\label{sycmds2}
+\end{figure}
+
+\begin{figure}[htp]
+\begin{ctabbing}
+$\tt \descr{if test} \rightarrow if \descr{boolean expression} \hbox{\tt :} \descr{balanced tokens} \descr{alternatives} fi$\\
+$\tt \descr{alternatives} \rightarrow \descr{empty}$\\
+$\tt \qquad \;|\; else\hbox{\tt :} \descr{balanced tokens}$\\
+$\tt \qquad \;|\; elseif \descr{boolean expression} \hbox{\tt :} \descr{balanced tokens} \descr{alternatives}$\\
+$\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}$\\
+$\tt \qquad \;|\; \descr{numeric expression} downto \descr{numeric expression}$\\
+$\tt \qquad \;|\; \descr{numeric expression} step \descr{numeric expression} until \descr{numeric expression} $\\
+$\tt \descr{for list} \rightarrow \descr{expression} \;|\; \descr{for list}\hbox{\tt ,} \descr{expression}$\\
+$\tt \descr{suffix list} \rightarrow \descr{suffix} \;|\; \descr{suffix list}\hbox{\tt ,} \descr{suffix}$
+\end{ctabbing}
+\caption{The syntax for conditionals and loops}
+\index{balanced tokens?\tdescr{balanced tokens}}\index{suffix?\tdescr{suffix}}%
+\label{sycondloop}
+\end{figure}
+
+\endgroup
+
+
+\subsection{Command-line syntax}
+\label{refman:commandline}
+\index{command-line}
+
+\begingroup
+\renewcommand*{\arraystretch}{1.25}% Give command-line switch tables air.
+\newcommand*{\cmdindex}[1]{\index{command-line!\texttt{mpost}!\texttt{#1}}\texttt{#1}}
+
+\subsubsection*{The \texttt{mpost} program}
+\label{refman:mpost}
+
+The command-line syntax of the MetaPost executable is
+$$ {\tt mpost}\ \descr{switches}\ \descr{file}
+$$\label{Dmpost}
+where $\descr{file}$ is a text file containing statements in the
+MetaPost language. Typically, MetaPost input files have file extension
+\texttt{.mp}\index{mp file?{\tt mp} file}\index{files!mp?{\tt mp}},
+e.g., \texttt{foo.mp}. This extension can then be omitted in the
+\texttt{mpost} call. There exist a number of command-line switches to
+control the run-time behavior of the MetaPost executable. Switches can
+prefixed by one or two dashes. Both forms have the same meaning. An
+exemplary call to MetaPost that compiles file \texttt{foo.mp}, but
+immediately exits after encountering the first error without
+user-interaction would look like:
+$$ \hbox{\tt mpost -halt-on-error foo} $$
+
+Here's a summary of the command-line switches understood by
+\texttt{mpost}:
+
+\begin{longtable}{>{\ttfamily}p{.3\linewidth}>{\raggedright\arraybackslash}p{.6\linewidth}}
+ \cmdindex{-debug}
+ & Don't delete intermediate files.\\
+ \cmdindex{-dvitomp}
+ & Act as the \textit{dvitomp} executable (see below).\\
+ \cmdindex{-file-line-error}
+ & Start error messages with \texttt{filename:lineno:} instead of
+ \texttt{!}.\\
+ \cmdindex{-halt-on-error}
+ & Immediately exit after the first error occurred.\\
+ \cmdindex{-help}
+ & Show help on command-line switches.\\
+ \cmdindex{-ini}
+ & Be the INI variant of the program.\\
+ \cmdindex{-interaction}=$\descr{string}$
+ & Set interaction mode to one of \texttt{batchmode, nonstopmode,
+ scrollmode, errorstopmode}.\\
+ \cmdindex{-jobname}=$\descr{jobname}$
+ & Set the name of the job (affects output file names).\\
+ \cmdindex{-kpathsea-debug}=$\descr{number}$
+ & Set debugging flags for path searching.\\
+ \cmdindex{-mem}=$\descr{string}$
+ & Use $\descr{string}$ as memory dump name (same as
+ \texttt{\&$\descr{string}$})\\
+ \cmdindex{-no-file-line-error}
+ & Enable normal MetaPost and \TeX\ style error messages.\\
+ \cmdindex{-no-kpathsea}
+ & Do not use \textit{kpathsea} to find files. All files have to be in
+ the current directory or specified via a full path.\\
+ \cmdindex{-progname}=$\descr{string}$
+ & Pretend to be the $\descr{string}$ executable.\\
+ \cmdindex{-recorder}
+ & Write a list of all opened disk files to
+ \texttt{$\descr{jobname}$.fls}\index{fls file?{\tt fls}
+ file}\index{files!fls?{\tt fls}}. (This functionality is provided
+ by \textit{kpathsea}.)\\
+ \cmdindex{-s}$\descr{key}$=$\descr{value}$ \textrm{or}\newline
+ -s $\descr{key}$=$\descr{value}$
+ & Set internal variable $\descr{key}$ to $\descr{value}$. The
+ assignment is applied just before the input file is read-in. This
+ switch can be applied multiple times on the command-line.\newline
+ $\descr{value}$ can be an integer between -16383 and 16383 or a string
+ in double quotes. For strings, double quotes are stripped, but no
+ other processing takes place.\newline
+ Example: \verb|-soutputformat="svg" -sprologues=3|\newline
+ Use SVG backend converting font shapes to paths.\\
+ \cmdindex{-tex}=$\descr{texprogram}$
+ & Load format $\descr{texprogram}$ for rendering \TeX\ material.\\
+ \cmdindex{-troff}, \cmdindex{-T}
+ & Output \textit{troff} compatible PostScript files.\\
+ \cmdindex{-version}
+ & Print version information and exit.\\
+\end{longtable}
+
+The following command-line switches are silently ignored in
+\textit{mplib}-based MetaPost (v1.100 or later), because they are always
+`on':
+\begin{longtable}{>{\ttfamily}p{.3\linewidth}>{\raggedright\arraybackslash}p{.6\linewidth}}
+ \cmdindex{-8bit}
+ & \\
+ \cmdindex{-parse-first-line}
+ & \\
+\end{longtable}
+
+The following command-line switches are ignored, but trigger a warning:
+\begin{longtable}{>{\ttfamily}p{.3\linewidth}>{\raggedright\arraybackslash}p{.6\linewidth}}
+ \cmdindex{-no-parse-first-line}
+ & \\
+ \cmdindex{-output-directory}=$\descr{string}$
+ & \\
+ \cmdindex{-translate-file}=$\descr{string}$
+ & \\
+\end{longtable}
+
+\renewcommand*{\cmdindex}[1]{\index{command-line!\texttt{dvitomp}!\texttt{#1}}\texttt{#1}}
+
+\subsubsection*{The \texttt{dvitomp} program}
+\label{refman:dvitomp}
+
+The \ttindex{dvitomp}\label{Ddvitomp} program converts DVI\index{dvi
+ file?{\tt dvi} file}\index{files!dvi?{\tt dvi}} files into low-level
+MetaPost code. The command-line syntax of the executable is
+$$ \hbox{\verb|dvitomp|}\ \descr{switches}\ \descr{infile}\ \descr{outfile}
+$$
+where $\descr{infile}$ is the DVI file to convert and $\descr{outfile}$
+contains the equivalent MetaPost code. MetaPost uses the
+\texttt{dvitomp} program when typesetting \verb|btex| \verb|...|
+\verb|etex| labels by \TeX\ for the final conversion back into MetaPost
+code. Files generated that way end with \texttt{.mpx}\index{mpx
+ file?{\tt mpx} file}\index{files!mpx?{\tt mpx}}. The following
+command-line switches are accepted:
+\begin{longtable}{>{\ttfamily}p{.3\linewidth}>{\raggedright\arraybackslash}p{.6\linewidth}}
+ \cmdindex{-help}
+ & Show help on command-line switches.\\
+ \cmdindex{-kpathsea-debug}=$\descr{number}$
+ & Set debugging flags for path searching.\\
+ \cmdindex{-progname}=$\descr{string}$
+ & Pretend to be the $\descr{string}$ executable.\\
+ \cmdindex{-version}
+ & Print version information and exit.\\
+\end{longtable}
+
+The \texttt{dvitomp} program used to be part of a set of external tools,
+called \emph{mpware}\index{mpware tools}\footnote{\texttt{makempx},
+ \texttt{mpto}, \texttt{dvitomp}, and \texttt{dmp}.}, that were used by
+MetaPost for processing \verb|btex| \verb|...| \verb|etex| labels.
+Since MetaPost version~1.100, the label conversion is handled internally
+by the \texttt{mpost} executable. The \emph{mpware} tools are therefore
+obsolete and no longer part of the MetaPost distribution. Nowadays, the
+\texttt{dvitomp} executable is either a copy of the \texttt{mpost}
+executable with the name \texttt{dvitomp} or a wrapper, calling
+\texttt{mpost} as
+$$ \hbox{\verb|mpost -dvitomp|}\ \descr{infile}\
+\descr{outfile}\qquad\hbox{.} $$
+
+\endgroup
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-PDF-mode: t
+%%% TeX-master: "mpman"
+%%% End:
diff --git a/Master/texmf-dist/doc/metapost/base/source/mpman.bib b/Master/texmf-dist/doc/metapost/base/source/mpman.bib
index 9ce6574fc9e..c476a028e02 100644
--- a/Master/texmf-dist/doc/metapost/base/source/mpman.bib
+++ b/Master/texmf-dist/doc/metapost/base/source/mpman.bib
@@ -71,3 +71,18 @@
pagest = "123--140",
year = 1986
}
+@manual{w3c:svg1.1,
+ organization = "World Wide Web Consortium (W3C)",
+ title = "Scalable Vector Graphics (SVG)~1.1 Specification",
+ month = jan,
+ year = 2003,
+ note = "\url{http://www.w3.org/TR/SVG11/}"
+}
+@misc{reckdahl:epslatex,
+ author = "Keith Reckdahl",
+ title = "Using Imported Graphics in {\LaTeX} and {pdf\LaTeX}",
+ month = jan,
+ year = 2006,
+ edition = "3.0.1",
+ note = "\texttt{CTAN://info/epslatex}"
+}
diff --git a/Master/texmf-dist/doc/metapost/base/source/mpman.mp b/Master/texmf-dist/doc/metapost/base/source/mpman.mp
new file mode 100644
index 00000000000..d4e81d0d08c
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/base/source/mpman.mp
@@ -0,0 +1,858 @@
+% Figures for MetaPost manual, by John Hobby. Public domain.
+
+if scantokens(mpversion) < 1.200:
+ filenametemplate
+else:
+ outputtemplate :=
+fi
+"%j-%c.mps";
+
+%%% This redefinition of dotlabel draws dots as a closed path
+%%% which are rendered more smoothly in Adobe Reader.
+vardef dotlabel@#(expr s,z) text t_ =
+ label@#(s,z) t_;
+ addto currentpicture
+ contour (makepath pencircle scaled dotlabeldiam) shifted z t_;
+enddef;
+
+
+%%% TeX macro \place is only used in figure 0.
+verbatimtex
+\input texnames.sty
+\def\place#1{\vphantom{FiMP}\smash{#1}}
+etex
+
+%%% The boxes package is only used in figure 0.
+input boxes
+
+beginfig(0);
+ba.dy = bb.dy = d.dy = 12bp;
+d.dx = 100bp;
+boxit.aa(btex \place{Figures in MetaPost} etex);
+boxit.ab(btex \place{\TeX\ Document} etex);
+boxit.ba(btex \hbox to 75bp {\hfil\place{MetaPost}\hfil} etex);
+boxit.bb.(btex \hbox to 75bp {\hfil\place{\TeX\ or \LaTeX}\hfil} etex);
+boxit.ca(btex \place{Figures in PostScript} etex);
+boxit.cb(btex \place{{\tt dvi} file} etex);
+boxit.d(btex \place{\tt dvips} etex);
+boxit.e(btex PostScript etex);
+boxit.f(btex \vbox{
+ \hbox to 50bp {\hfil\hbox{bounding}\hfil}
+ \hbox to 50bp {\hfil\hbox{box}\hfil}
+ } etex scaled .8);
+ba.n - aa.s = ca.n - ba.s
+= bb.n - ab.s = cb.n - bb.s
+= e.n - d.s = down * 25bp;
+ypart cb.s - ypart d.n = 25bp;
+e.s = origin;
+ypart ca.s = ypart cb.s;
+xpart aa.n = xpart 0.1[d.nw,d.ne];
+xpart ab.n = xpart 0.9[d.nw,d.ne];
+drawunboxed(aa,ab,ca,cb,e);
+drawboxed(ba,bb,d);
+drawarrow aa.s -- top ba.n; drawarrow ab.s -- top bb.n;
+drawarrow ba.s -- top ca.n; drawarrow bb.s -- top cb.n;
+drawarrow ca.s -- top 0.1[d.nw,d.ne];
+drawarrow cb.s -- top 0.9[d.nw,d.ne];
+drawarrow d.s -- top e.n;
+path p;
+p = ca.e{right} .. {right}bb.w;
+f.c = point .5 of p;
+drawunboxed(f);
+draw p cutafter bpath f dashed evenly;
+drawarrow p cutbefore subpath (1,3) of bpath f dashed evenly;
+endfig;
+
+
+beginfig(1);
+draw (20,20)--(0,0)--(0,30)--(30,0)--(0,0);
+endfig;
+
+
+beginfig(2); numeric u;
+u=1cm;
+draw (2u,2u)--(0,0)--(0,3u)--(3u,0)--(0,0);
+pickup pencircle scaled 4pt;
+for i=0 upto 2:
+ for j=0 upto 2:
+ drawdot (i*u,j*u);
+ endfor
+endfor
+endfig;
+
+
+beginfig(3);
+z0 = (0,0); z1 = (60,40);
+z2 = (40,90); z3 = (10,70);
+z4 = (30,50);
+draw z0..z1..z2..z3..z4;
+dotlabels.top(0,2,4);
+dotlabels.lft(3);
+dotlabels.lrt(1);
+endfig;
+
+
+beginfig(104);
+z0 = (0,0); z1 = (60,40);
+z2 = (40,90); z3 = (10,70);
+z4 = (30,50);
+draw z0..z1..z2..z3..z4..cycle;
+dotlabels.top(2,4);
+dotlabels.lft(0,3);
+dotlabels.lrt(1);
+endfig;
+
+
+beginfig(204);
+z0 = (0,0); z1 = (60,40);
+z2 = (40,90); z3 = (10,70);
+z4 = (30,50);
+draw z0..z1..z2..z3--z4--cycle;
+dotlabels.top(2,4);
+dotlabels.lft(0,3);
+dotlabels.lrt(1);
+endfig;
+
+
+beginfig(5);
+z0 = (0,0); z1 = (60,40);
+z2 = (40,90); z3 = (10,70);
+z4 = (30,50);
+path p; p = z0..z1..z2..z3..z4;
+draw p;
+for t=0 upto 3:
+ draw point t of p--postcontrol t of p
+ --precontrol t+1 of p--point t+1 of p
+ dashed (evenly scaled .5);
+endfor
+dotlabels.top(0,2,4);
+dotlabels.lft(3);
+dotlabels.lrt(1);
+endfig;
+
+
+beginfig(6);
+z0 = (0,0); z1 = (60,40);
+z2 = (40,90); z3 = (10,70);
+z4 = (30,50);
+draw z0..z1{up}..z2{left}..z3..z4;
+dotlabels.top(0,2,4);
+dotlabels.lft(3);
+dotlabels.lrt(1);
+endfig;
+
+
+beginfig(7)
+for a=0 upto 9:
+ draw (0,0){dir 45}..{dir -10a}(6cm,0);
+endfor
+endfig;
+
+beginfig(8)
+for a=0 upto 7:
+ draw (0,0){dir 45}..{dir 10a}(6cm,0);
+endfor
+endfig;
+
+
+beginfig(109);
+z2=-z0=(1in,0); z1=(0,.2in);
+draw z0{up}..z1{right}..z2{down};
+dotlabels.bot(0,1,2);
+endfig;
+
+
+beginfig(209);
+z2=-z0=(1in,0); z1=(0,.2in);
+draw z0{up}...z1{right}...z2{down};
+dotlabels.bot(0,1,2);
+endfig;
+
+
+beginfig(110);
+numeric u; 10u=1.5in;
+-z0=z3=(5u,0);
+(-x1,y1)=z2=(3u,2u);
+draw z0..z1..z2..z3;
+dotlabels.bot(0,1,2,3);
+endfig;
+
+
+beginfig(210);
+numeric u; 10u=1.5in;
+-z0=z3=(5u,0);
+(-x1,y1)=z2=(3u,2u);
+draw z0..z1..tension 1.3..z2..z3;
+dotlabels.bot(0,1,2,3);
+endfig;
+
+
+beginfig(310);
+numeric u; 10u=1.5in;
+-z0=z3=(5u,0);
+(-x1,y1)=z2=(3u,2u);
+draw z0..z1..tension 1.5 and 1..z2..z3;
+dotlabels.bot(0,1,2,3);
+endfig;
+
+
+beginfig(111);
+numeric u, c; 10u=1.4in; c=0;
+z1=(0,0); (x0,-y0)=z2=(2u,5u);
+draw z0{curl c}..z1..{curl c}z2;
+dotlabels.rt(0,1,2);
+endfig;
+
+
+beginfig(211);
+numeric u, c; 10u=1.4in; c=1;
+z1=(0,0); (x0,-y0)=z2=(2u,5u);
+draw z0{curl c}..z1..{curl c}z2;
+dotlabels.rt(0,1,2);
+endfig;
+
+
+beginfig(311);
+numeric u, c; 10u=1.4in; c=2;
+z1=(0,0); (x0,-y0)=z2=(2u,5u);
+draw z0{curl c}..z1..{curl c}z2;
+dotlabels.rt(0,1,2);
+endfig;
+
+
+beginfig(411);
+numeric u, c; 10u=1.4in; c=infinity;
+z1=(0,0); (x0,-y0)=z2=(2u,5u);
+draw z0{curl c}..z1..{curl c}z2;
+dotlabels.rt(0,1,2);
+endfig;
+
+
+beginfig(13);
+z1=-z2=(.2in,0);
+x3=-x6=.3in;
+x3+y3=x6+y6=1.1in;
+z4=1/3[z3,z6];
+z5=2/3[z3,z6];
+z20=whatever[z1,z3]=whatever[z2,z4];
+z30=whatever[z1,z4]=whatever[z2,z5];
+z40=whatever[z1,z5]=whatever[z2,z6];
+draw z1--z20--z2--z30--z1--z40--z2;
+pickup pencircle scaled 1pt;
+draw z1--z2;
+draw z3--z6;
+%
+dotlabels.bot(1,2);
+dotlabels.rt(3);
+dotlabels.lft(6);
+dotlabels.top(20,30,40);
+endfig;
+
+
+vardef llet(expr c) =
+ c infont defaultfont scaled magstep3
+enddef;
+
+primarydef p centered h =
+ (p shifted (h - xpart .5[llcorner p,lrcorner p], 0))
+enddef;
+
+beginfig(14);
+string s; s = "abcde";
+numeric u,n, ytop, ybot;
+n = 5;
+ytop = 3bp + ypart urcorner llet(s);
+ybot = -3bp + ypart llcorner llet(s);
+ytop - ybot = u;
+draw (n*u,ybot)--(0,ybot)--(0,ytop)--(n*u,ytop);
+for i=1 upto n:
+ draw (i*u,ybot)..(i*u,ytop);
+ draw llet(substring (i-1,i) of s) centered ((i-.5)*u);
+ label.bot(decimal i, (i*u,ybot));
+endfor
+picture llab; llab = btex \llap{$x={}$}0 etex;
+z0 = urcorner llab;
+draw llab shifted (-.5*x0, ybot-labeloffset-y0);
+endfig;
+
+
+beginfig(17);
+a=.7in; b=.5in;
+z0=(0,0);
+z1=-z3=(a,0);
+z2=-z4=(0,b);
+draw z1..z2..z3..z4..cycle;
+draw z1--z0--z2;
+label.top("a", .5[z0,z1]);
+label.lft("b", .5[z0,z2]);
+dotlabel.bot("(0,0)", z0);
+endfig;
+
+
+beginfig(18);
+numeric u;
+u = 1cm;
+draw (0,2u)--(0,0)--(4u,0);
+pickup pencircle scaled 1pt;
+draw (0,0){up}
+ for i=1 upto 8: ..(i/2,sqrt(i/2))*u endfor;
+label.lrt(btex $\sqrt x$ etex, (3,sqrt 3)*u);
+label.bot(btex $x$ etex, (2u,0));
+label.lft(btex $y$ etex, (0,u));
+endfig;
+
+
+beginfig(19);
+numeric ux, uy;
+120ux=1.2in; 4uy=2.4in;
+draw (0,4uy)--(0,0)--(120ux,0);
+pickup pencircle scaled 1pt;
+draw (0,uy){right}
+ for ix=1 upto 8:
+ ..(15ix*ux, uy*2/(1+cosd 15ix))
+ endfor;
+label.bot(btex $x$ axis etex, (60ux,0));
+label.lft(btex $y$ axis etex rotated 90,
+ (0,2uy));
+label.lft(
+ btex $\displaystyle y={2\over1+\cos x}$ etex,
+ (120ux, 4uy));
+endfig;
+
+
+beginfig(20);
+picture p;
+p = "testing" infont "ptmr8r" scaled 7;
+draw p;
+draw llcorner p--lrcorner p--urcorner p--ulcorner p--cycle;
+dotlabel.lft(btex \tt llcorner etex, llcorner p);
+dotlabel.rt(btex \tt lrcorner etex, lrcorner p);
+dotlabel.lft(btex \tt ulcorner etex, ulcorner p);
+dotlabel.rt(btex \tt urcorner etex, urcorner p);
+endfig;
+
+
+beginfig(21);
+path p;
+p = (-1cm,0)..(0,-1cm)..(1cm,0);
+fill p{up}..(0,0){-1,-2}..{up}cycle;
+draw p..(0,1cm)..cycle;
+endfig;
+
+
+beginfig(22);
+path a, b, aa, ab;
+a = fullcircle scaled 2cm;
+b = a shifted (0,1cm);
+aa = halfcircle scaled 2cm;
+ab = buildcycle(aa, b);
+picture pa, pb;
+pa = thelabel(btex $A$ etex, (0,-.5cm));
+pb = thelabel(btex $B$ etex, (0,1.5cm));
+fill a withcolor .7white;
+fill b withcolor .7white;
+fill ab withcolor .4white;
+unfill bbox pa;
+draw pa;
+unfill bbox pb;
+draw pb;
+label.lft(btex $U$ etex, (-1cm,.5cm));
+draw bbox currentpicture;
+endfig;
+
+
+beginfig(123);
+path aa, b;
+b = a shifted (0,1cm);
+aa = halfcircle scaled 2cm;
+draw aa;
+draw b dashed evenly;
+z1 = aa intersectionpoint reverse b;
+z2 = reverse aa intersectionpoint b;
+dotlabel.rt(btex 1 etex, z1);
+dotlabel.lft(btex 2 etex, z2);
+label.bot(btex \tt aa etex, point 0 of aa);
+label.bot(btex \tt b etex, point 2 of b);
+endfig;
+
+beginfig(223);
+path aa, b;
+b = a shifted (0,1cm);
+aa = halfcircle scaled 2cm;
+numeric t[], tt[];
+(t1,8-tt1) = aa intersectiontimes reverse b;
+(4-t2,tt2) = reverse aa intersectiontimes b;
+pickup(pencircle scaled .3);
+draw aa;
+draw b;
+pickup(pencircle scaled .8);
+draw subpath (t1,t2) of aa;
+draw subpath (tt2,tt1) of b;
+dotlabel.rt(btex 1 etex, point t1 of aa);
+dotlabel.lft(btex 2 etex, point t2 of aa);
+label.bot(btex \tt aa etex, point 0 of aa);
+label.bot(btex \tt b etex, point 2 of b);
+endfig;
+
+
+beginfig(24);
+h=2in; w=2.7in;
+path p[], q[], pp;
+for i=2 upto 4: ii:=i**2;
+ p[i] = (w/ii,h){1,-ii}...(w/i,h/i)...(w,h/ii){ii,-1};
+endfor
+q0.5 = (0,0)--(w,0.5h);
+q1.5 = (0,0)--(w/1.5,h);
+pp = buildcycle(q0.5, p2, q1.5, p4);
+fill pp withcolor .7white;
+z0=center pp;
+picture lab; lab=thelabel(btex $f>0$ etex, z0);
+unfill bbox lab; draw lab;
+draw q0.5; draw p2; draw q1.5; draw p4;
+dotlabel.top(btex $P$ etex, p2 intersectionpoint q0.5);
+dotlabel.rt(btex $Q$ etex, p2 intersectionpoint q1.5);
+dotlabel.lft(btex $R$ etex, p4 intersectionpoint q1.5);
+dotlabel.bot(btex $S$ etex, p4 intersectionpoint q0.5);
+endfig;
+
+
+beginfig(25);
+numeric u;
+u = .2in;
+path a, b;
+a = (0,0){up}..(4u,0)..(8u,0)..(8u,4u);
+b = (10u,3u)..(5u,u)..(-u,u);
+numeric t; t=0;
+forsuffixes $=bot, llft, lrt, lft:
+ dotlabel$(decimal t, point t of a);
+ t:=t+1;
+endfor
+for i=0 upto 2:
+ dotlabel.top(decimal i, point i of b);
+endfor
+pickup(pencircle scaled .3);
+draw a;
+pickup(pencircle scaled .8);
+draw b;
+% intersections (atime, btime):
+% (0.2501,1.77225)
+% (2.58316,0.23619)
+% (0.75288,1.40094)
+endfig;
+
+
+beginfig(26);
+numeric scf, #, t[];
+3.2scf = 2.4in;
+path fun;
+# = .1; % Keep the function single-valued
+fun = ((0,-1#)..(1,.5#){right}..(1.9,.2#){right}..{curl .1}(3.2,2#))
+ yscaled(1/#) scaled scf;
+x1 = 2.5scf;
+for i=1 upto 2:
+ (t[i],whatever) =
+ fun intersectiontimes ((x[i],-infinity)--(x[i],infinity));
+ z[i] = point t[i] of fun;
+ z[i]-(x[i+1],0) = whatever*direction t[i] of fun;
+ draw (x[i],0)--z[i]--(x[i+1],0);
+ fill fullcircle scaled 3bp shifted z[i];
+endfor
+label.bot(btex $x_1$ etex, (x1,0));
+label.bot(btex $x_2$ etex, (x2,0));
+label.bot(btex $x_3$ etex, (x3,0));
+draw (0,0)--(3.2scf,0);
+pickup pencircle scaled 1pt;
+draw fun;
+endfig;
+
+
+beginfig(28);
+path p[];
+p1 = fullcircle scaled .6in;
+z1=(.75in,0)=-z3;
+z2=directionpoint left of p1=-z4;
+p2 = z1..z2..{curl1}z3..z4..{curl 1}cycle;
+fill p2 withcolor .4[white,black];
+unfill p1;
+draw p1;
+transform T;
+z1 transformed T = z2;
+z3 transformed T = z4;
+xxpart T=yypart T; yxpart T=-xypart T;
+picture pic;
+pic = currentpicture;
+for i=1 upto 2:
+ pic:=pic transformed T;
+ draw pic;
+endfor
+dotlabels.top(1,2,3); dotlabels.bot(4);
+endfig;
+
+
+beginfig(29);
+if unknown withdots: % So this works w/o MetaPost version 0.5
+ picture withdots; withdots=dashpattern(off 2.5 on 0 off 2.5);
+fi
+z0 = (0,0);
+z1 = (2in-2bp,0);
+for i=1 upto 4:
+ z[2i]-z[2i-2] = z[2i+1]-z[2i-1] = (0,14pt);
+endfor
+draw z0..z1 dashed evenly;
+label.rt(btex \tt dashed evenly etex, z1);
+draw z2..z3 dashed evenly scaled 2;
+label.rt(btex \tt dashed evenly scaled 2 etex, z3);
+draw z4..z5 dashed evenly scaled 4;
+label.rt(btex \tt dashed evenly scaled 4 etex, z5);
+draw z6..z7 dashed withdots;
+label.rt(btex \tt dashed withdots etex, z7);
+draw z8..z9 dashed withdots scaled 2;
+label.rt(btex \tt dashed withdots scaled 2 etex, z9);
+endfig;
+
+
+beginfig(30);
+picture e[]; e4=evenly scaled 4;
+z0 = (0,0);
+z1 = (2in,0);
+for i=1 upto 3:
+ z[2i]-z[2i-2] = z[2i+1]-z[2i-1] = (0,14pt);
+endfor
+dotlabels.lft(0,2,4,6);
+draw z0..z1 dashed e4;
+dotlabel.rt(btex 1 \tt\ draw z0..z1 dashed e4 etex, z1);
+draw z2..z3 dashed e4 shifted (6bp,0);
+dotlabel.rt(btex 3 \tt\ draw z2..z3 dashed e4 shifted (6bp,0) etex, z3);
+draw z4..z5 dashed e4 shifted (12bp,0);
+dotlabel.rt(btex 5 \tt\ draw z4..z5 dashed e4 shifted (12bp,0) etex, z5);
+draw z6..z7 dashed e4 shifted (18bp,0);
+dotlabel.rt(btex 7 \tt\ draw z6..z7 dashed e4 shifted (18bp,0) etex, z7);
+endfig;
+
+
+beginfig(31);
+picture d; d = dashpattern(on 6bp off 12bp on 6bp);
+draw d;
+endfig;
+
+
+beginfig(32);
+draw dashpattern(on 15bp off 15bp) dashed evenly;
+picture p;
+p=currentpicture;
+currentpicture:=nullpicture;
+draw fullcircle scaled 1cm xscaled 3 dashed p;
+endfig;
+
+
+beginfig(33);
+for i=0 upto 2:
+ z[i]=(0,-40i); z[i+3]-z[i]=(100,30);
+endfor
+pickup pencircle scaled 18;
+draw z0..z3 withcolor .8white;
+linecap:=butt;
+draw z1..z4 withcolor .8white;
+linecap:=squared;
+draw z2..z5 withcolor .8white;
+dotlabels.top(0,1,2,3,4,5);
+endfig; linecap:=rounded;
+
+
+beginfig(34);
+for i=0 upto 2:
+ z[i]=(0,-50i); z[i+3]-z[i]=(60,40);
+ z[i+6]-z[i]=(120,0);
+endfor
+pickup pencircle scaled 24;
+draw z0--z3--z6 withcolor .8white;
+linejoin:=mitered;
+draw z1..z4--z7 withcolor .8white;
+linejoin:=beveled;
+draw z2..z5--z8 withcolor .8white;
+dotlabels.bot(0,1,2,3,4,5,6,7,8);
+endfig; linejoin:=rounded;
+
+
+beginfig(35);
+z2a=(0,0);
+(-x1a,y1a) = -z3a = .5in*unitvector(6,1);
+z1b - z1a = .75*z1a rotated -90;
+z2b - z1b = whatever*(z2a-z1a);
+z3b - z2b = whatever*(z3a-z2a);
+y2b = 0;
+z3b - z3a = whatever*(z3a rotated 90);
+z0b-z1b = z0a-z1a = z1a;
+x4a=x2a; x4b=x2b;
+y4a = y4b = 1.3*y3b;
+fill z1a--z2a--z3a--z3b--z2b--z1b--cycle withcolor .8 white;
+for p= z2a--z4a, z2b--z4b, z0a--z1a, z0b--z1b:
+ draw p dashed evenly;
+endfor
+drawdblarrow z4a--z4b;
+drawdblarrow z0a--z0b;
+label.bot(btex miter length etex, .5[z4a,z4b]);
+label.ulft(btex line width etex, .5[z0a,z0b]);
+endfig;
+
+
+beginfig(36);
+z[-1]=(0,0); z0=(1in,0);
+for i=1 upto 6:
+ z[i]-z[i-2] = (0,-15pt);
+ if x[i]=0: label.lft(decimal i, z[i]);
+ fi
+endfor
+drawarrow z1..z2;
+drawarrow reverse(z3..z4);
+drawdblarrow z5..z6;
+label.rt(btex 2 \tt\ drawarrow z1..z2 etex, z2);
+label.rt(btex 4 \tt\ drawarrow reverse(z3..z4) etex, z4);
+label.rt(btex 6 \tt\ drawdblarrow z5..z6 etex, z6);
+endfig;
+
+
+beginfig(37);
+path p, q, r;
+ahlength := 1.5cm;
+pickup pencircle scaled .2cm;
+p = (0,0)..{right}(2.5cm,2cm);
+q = counterclockwise arrowhead p;
+z0 = directionpoint up of q;
+z.a = directionpoint right of q;
+z.b = directionpoint (-1,-1) of q;
+drawarrow p withcolor .4white;
+pickup defaultpen;
+undraw p;
+undraw q;
+ahlength:=4bp;
+z.a1-z0 = .3cm*unitvector(z.a-z0) rotated 90;
+z.a1-z.a2 = z0-z.a;
+z.b1-z0 = .3cm*unitvector(z.b-z0) rotated -90;
+z.b1-z.b2 = z0-z.b;
+z.ab = whatever[z.a1,z.a2] = whatever[z.b1,z.b2];
+z.a0-z.ab = .4cm*unitvector(z.a1-z.a2);
+z.b0-z.ab = .4cm*unitvector(z.b1-z.b2);
+drawdblarrow z.a1..z.a2;
+label.lrt(btex \tt ahlength etex, .9[z.a1,z.a2]);
+draw z.a1..z.a0 dashed evenly;
+drawdblarrow z.b1..z.b2;
+label.urt(btex \tt ahlength etex, .9[z.b1,z.b2]);
+draw z.b1..z.b0 dashed evenly;
+r = z.a0{(z.a2-z.a0) rotated 90}..{(z.b2-z.b0)rotated 90}z.b0;
+draw r;
+label.rt(btex \tt ahangle etex, point .5 of r);
+endfig;
+
+
+beginfig(38);
+pickup pencircle scaled .2in yscaled .08 rotated 30;
+x0=x3=x4;
+z1-z0 = .45in*dir 30;
+z2-z3 = whatever*(z1-z0);
+z6-z5 = whatever*(z1-z0);
+z1-z6 = 1.2*(z3-z0);
+rt x3 = lft x2;
+x5 = .55[x4,x6];
+y4 = y6;
+lft x3 = bot y5 = 0;
+top y2 = .9in;
+draw z0--z1--z2--z3--z4--z5--z6 withcolor .7white;
+dotlabels.top(0,1,2,3,4,5,6);
+endfig;
+
+
+beginfig(40);
+path p[];
+p1 = (0,0){curl 0}..(5pt,-3pt)..{curl 0}(10pt,0);
+p2 = p1..(p1 yscaled-1 shifted(10pt,0));
+p0 = p2;
+for i=1 upto 3: p0:=p0.. p2 shifted (i*20pt,0);
+ endfor
+for j=0 upto 8: draw p0 shifted (0,j*10pt);
+ endfor
+p3 = fullcircle shifted (.5,.5) scaled 72pt;
+clip currentpicture to p3;
+draw p3;
+endfig;
+
+
+marksize=4pt;
+angle_radius=8pt;
+
+def draw_mark(expr p, a) =
+ begingroup
+ save t, dm; pair dm;
+ t = arctime a of p;
+ dm = marksize*unitvector direction t of p
+ rotated 90;
+ draw (-.5dm.. .5dm) shifted point t of p;
+ endgroup
+enddef;
+
+def draw_marked(expr p, n) =
+ begingroup
+ save amid;
+ amid = .5*arclength p;
+ for i=-(n-1)/2 upto (n-1)/2:
+ draw_mark(p, amid+.6marksize*i);
+ endfor
+ draw p;
+ endgroup
+enddef;
+
+def mark_angle(expr a, b, c, n) =
+ begingroup
+ save s, p; path p;
+ p = unitvector(a-b){(a-b)rotated 90}..unitvector(c-b);
+ s = .9marksize/length(point 1 of p - point 0 of p);
+ if s<angle_radius: s:=angle_radius; fi
+ draw_marked(p scaled s shifted b, n);
+ endgroup
+enddef;
+
+def mark_rt_angle(expr a, b, c) =
+ draw ((1,0)--(1,1)--(0,1))
+ zscaled (angle_radius*unitvector(a-b)) shifted b
+enddef;
+
+beginfig(42);
+pair a,b,c,d;
+b=(0,0); c=(1.5in,0); a=(0,.6in);
+d-c = (a-b) rotated 25;
+dotlabel.lft("a",a);
+dotlabel.lft("b",b);
+dotlabel.bot("c",c);
+dotlabel.llft("d",d);
+z0=.5[a,d];
+z1=.5[b,c];
+(z.p-z0) dotprod (d-a) = 0;
+(z.p-z1) dotprod (c-b) = 0;
+draw a--d;
+draw b--c;
+draw z0--z.p--z1;
+draw_marked(a--b, 1);
+draw_marked(c--d, 1);
+draw_marked(a--z.p, 2);
+draw_marked(d--z.p, 2);
+draw_marked(b--z.p, 3);
+draw_marked(c--z.p, 3);
+mark_angle(z.p, b, a, 1);
+mark_angle(z.p, c, d, 1);
+mark_angle(z.p, c, b, 2);
+mark_angle(c, b, z.p, 2);
+mark_rt_angle(z.p, z0, a);
+mark_rt_angle(z.p, z1, b);
+endfig;
+
+
+def getmid(suffix p) =
+ pair p.mid[], p.off[], p.dir[];
+ for i=0 upto 36:
+ p.dir[i] = dir(5*i);
+ p.mid[i]+p.off[i] = directionpoint p.dir[i] of p;
+ p.mid[i]-p.off[i] = directionpoint -p.dir[i] of p;
+ endfor
+enddef;
+
+def joinup(suffix pt, d)(expr n) =
+ begingroup
+ save res, g; path res;
+ res = pt[0]{d[0]};
+ for i=1 upto n:
+ g:= if (pt[i]-pt[i-1]) dotprod d[i] <0: - fi 1;
+ res := res{g*d[i-1]}...{g*d[i]}pt[i];
+ endfor
+ res
+ endgroup
+enddef;
+
+beginfig(45)
+path p, q;
+p = ((5,2)...(3,4)...(1,3)...(-2,-3)...(0,-5)...(3,-4)
+ ...(5,-3)...cycle) scaled .3cm shifted (0,5cm);
+getmid(p);
+draw p;
+draw joinup(p.mid, p.dir, 36)..cycle;
+q = joinup(p.off, p.dir, 36);
+draw q..(q rotated 180)..cycle;
+drawoptions(dashed evenly);
+for i=0 upto 3:
+ draw p.mid[9i]-p.off[9i]..p.mid[9i]+p.off[9i];
+ draw -p.off[9i]..p.off[9i];
+endfor
+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;
+
+
+fontmapfile "=lm-ec.map";
+beginfig(56);
+ picture q;
+ path p;
+ interim ahlength := 12bp;
+ interim ahangle := 25;
+ q := glyph "Dcaron" of "ec-lmr10" scaled .2;
+ for item within q:
+ p := pathpart item;
+ drawarrow p withcolor (.6,.9,.6)
+ withpen pencircle scaled 1.5;
+ for j=0 upto length p:
+ pickup pencircle scaled .7;
+ draw (point j of p -- precontrol j of p)
+ dashed evenly withcolor blue;
+ draw (point j of p -- postcontrol j of p)
+ dashed evenly withcolor blue;
+ pickup pencircle scaled 3;
+ draw precontrol j of p withcolor red;
+ draw postcontrol j of p withcolor red;
+ pickup pencircle scaled 2;
+ draw point j of p withcolor black;
+ endfor
+ endfor
+endfig;
+
+
+%%% Title page rule.
+beginfig(60);
+ pickup pencircle scaled 1.1bp;
+ linecap := rounded;
+ draw origin--(4.38in,0);
+endfig;
+
+end
diff --git a/Master/texmf-dist/doc/metapost/base/source/mpman.tex b/Master/texmf-dist/doc/metapost/base/source/mpman.tex
index d72d133cc6d..0f689273db3 100644
--- a/Master/texmf-dist/doc/metapost/base/source/mpman.tex
+++ b/Master/texmf-dist/doc/metapost/base/source/mpman.tex
@@ -1,4 +1,4 @@
-% $Id: mpman.tex 524 2008-05-13 23:01:45Z stephanhennig $
+% $Id: mpman.tex 1051 2009-05-25 08:31:54Z taco $
% MetaPost manual, by John Hobby. License at end.
\listfiles
\RequirePackage{ifpdf}
@@ -12,8 +12,8 @@
\fi
\documentclass{article} % article is NOT the original style
\usepackage[nofancy]{svninfo}% Access VCS information.
-\svnInfo $Id: mpman.tex 524 2008-05-13 23:01:45Z stephanhennig $
-\newcommand*{\mpversion}{1.005}
+\svnInfo $Id: mpman.tex 1051 2009-05-25 08:31:54Z taco $
+\newcommand*{\mpversion}{1.200}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
@@ -64,9 +64,10 @@
\usepackage{hyperxmp}
\usepackage{hyperref}
\hypersetup{
- pdftitle={A User's Manual for MetaPost},
+ pdftitle={MetaPost: A User's Manual},
pdfauthor={John D. Hobby and the MetaPost development team},
- pdfkeywords={MetaPost, PostScript, vector graphics language, MetaFont, TeX}
+ pdfkeywords={MetaPost, PostScript, SVG, vector graphics language,
+ MetaFont, TeX}
}
\hypersetup{
pdfstartview={XYZ null null null},% Zoom factor is determined by viewer.
@@ -94,7 +95,7 @@
\vfil
\centerline{\resizebox{3.5in}{!}{\fontseries{b}\selectfont\MP}}
\vskip10bp% actually 21bp (-11bp)
- \centerline{\includegraphics{manfig-60.mps}}
+ \centerline{\includegraphics{mpman-60.mps}}
\vskip15bp% actually 21bp (-6bp)
\centerline{%
\resizebox{3.5in}{!}{%
@@ -130,7 +131,8 @@
MetaPost is a programming language much like Knuth's \MF\footnote{\MF\
is a trademark of Addison Wesley Publishing
company.}\index{metafont?\MF}~\cite{kn:c} except that it outputs
-PostScript programs instead of bitmaps. Borrowed from \MF\ are the
+vector graphics, either PostScript programs or SVG\index{SVG} graphics,
+instead of bitmaps. Borrowed from \MF\ are the
basic tools for creating and manipulating pictures. These include
numbers, coordinate pairs, cubic splines, affine transformations, text
strings, and boolean quantities. Additional features facilitate
@@ -151,62 +153,19 @@ 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.
-To use MetaPost, you prepare an input file containing MetaPost code and
-then invoke MetaPost, usually by giving a command of the
-form\index{mpost?\texttt{mpost}}
-$$ {\tt mpost}\, \descr{filename} $$
-The syntax and program name itself are system-dependent; sometimes it is
-named \texttt{mp}. MetaPost input
-files\index{files!input} normally have names ending ``{\tt .mp}'' but
-this part of the name can be omitted when invoking MetaPost. For an
-input file {\tt foo.mp}
-$$ \hbox{\tt mpost foo} $$
-invokes MetaPost and produces output files with names like {\tt foo.1}
-and {\tt foo.2}. Any terminal I/O is summarized in a
-transcript\index{files!transcript}\index{transcript file} file called
-{\tt foo.log}. This includes error messages and any MetaPost commands
-entered interactively.\footnote{A {\tt *}\index{*?\texttt{*}} prompt is
-used for interactive input and a {\tt **}\index{**?\texttt{**}} prompt
-indicates that an input file name is expected. This can be avoided by
-invoking MetaPost on a file that ends with an {\tt
-end}\index{end?\texttt{end}} command.}
-
-\label{Dmpversion}The transcript file starts with a banner line that
-identifies the version of MetaPost you are using. You can also determine
-the current version from within a MetaPost program via the
-\texttt{mpversion} predefined constant string (this was introduced in
-version 0.9). For instance:
-$$\begin{verbatim}
-if known mpversion:
- message "mp = " & mpversion;
- if scantokens(mpversion) < 1: message "CMYK color support not available!" fi
-fi
-\end{verbatim}
-$$
-prints
-$$\begin{verbatim}[commandchars=\\\{\}]
-mp = \mpversion
-\end{verbatim}
-$$
-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.
-
This document introduces the MetaPost language, beginning with the
features that are easiest to use and most important for simple
-applications. Reading the manual does not require knowledge of \MF\ or
-access to {\sl The \MF book}, but both are beneficial.
-The first few sections describe the language as it
+applications. The first few sections describe the language as it
appears to the novice user with key parameters at their default values.
Some features described in these sections are part of a predefined macro
package called Plain. Later sections summarize the complete language
and distinguish between primitives and preloaded macros from the Plain
-macro package\index{Plain macros}. Since much of the language is
-identical to Knuth's \MF, the appendix gives a detailed comparison so
-that advanced users can learn more about MetaPost by reading {\sl The
-\MF book\/} \cite{kn:c}.
+macro package\index{Plain macros}. Reading the manual and creating
+moderately complex graphics with MetaPost does not require knowledge of
+\MF\ or access to {\sl The \MF book} \cite{kn:c}. However, to really
+master MetaPost, both are beneficial, since the MetaPost language is
+based on Knuth's \MF\ to a large extent. Appendix~\ref{MPvsMF} gives a
+detailed comparison of MetaPost and \MF.
MetaPost documentation is completed by ``Drawing Boxes with MetaPost''
and ``Drawing Graphs with MetaPost''---the manuals of the \texttt{boxes}
@@ -236,7 +195,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-1} $$
+$$ \includegraphics{mpman-1.mps} $$
\label{Ddrawdot}MetaPost also has a \ttt{drawdot} command to print a
single point, as in \ttt{drawdot(30,0)}.
@@ -309,62 +268,235 @@ for i=0 upto 2:
endfor
endfig;
\end{verbatim}
-\quad \mathcenter{\includegraphics{manfig-2}}
+\quad \mathcenter{\includegraphics{mpman-2.mps}}
$$
\caption{MetaPost commands and the resulting output}
\label{fig1}
\end{figure}
-Note that the program in Figure~\ref{fig1} starts with
-\verb|beginfig(2)|\index{beginfig?\texttt{beginfig}} and ends with
-\verb|endfig|\index{endfig?\texttt{endfig}}. These are macros that
-perform various administrative functions and ensure that the results of
-all the \verb|draw| statements get packaged up and translated into
-PostScript. A MetaPost input file normally contains a sequence of
-\verb|beginfig|, \verb|endfig| pairs with an {\tt
-end}\index{end?\texttt{end}} statement after the last one. If this file
-is named {\tt fig.mp}, the output from \verb|draw| statements between
-\verb|beginfig(1)| and the next \verb|endfig| is written in a file {\tt
-fig.1}\index{files!output}. In other words, the numeric argument to the
-\verb|beginfig| macro determines the name of the corresponding output
-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.
-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}
-
-There can be a two-fold interaction between \TeX\ and MetaPost. On one
-hand, MetaPost graphics can be imported into documents typeset by \TeX\
-and friends. On the other hand, MetaPost can delegate typesetting
-textual elements to \TeX, \LaTeX\ or \emph{troff}, e.g., text labels or
-mathematical formulas in a graphic. That way, MetaPost graphics can
-easily adopt the style of a document (type, type size, etc.) and fit its
-typesetting quality (use kerning, ligatures, etc.) This makes MetaPost
-an ideal tool for preparing high-quality graphics for \TeX\ or
-\emph{troff} documents.
-
-This section deals with the first aspect of \TeX--MetaPost interaction,
-the import of MetaPost graphics into \TeX\ and friends. Typesetting
-text in MetaPost is discussed in section~\ref{text}.
+\section{The MetaPost workflow}
+\label{workflow}
+
+Before describing the MetaPost language in detail, let's have a look at
+how the MetaPost program is used for developing graphics: creating
+MetaPost source files, compiling sources, previewing MetaPost graphics,
+and finally including MetaPost graphics into third-party applications.
+This section also contains some technical details about MetaPost that
+are useful to know. If you're not interested in these basics right now
+you can savely skip those parts and only refer to them later.
+
+\subsection{Processing source files}
+\label{processing}
+
+To create graphics with MetaPost, you prepare a text file containing
+code in the MetaPost language and then invoke the compiler, usually by
+giving a command of the form\index{mpost?\texttt{mpost}}
+$$ {\tt mpost}\, \descr{filename} $$
+on the command-line. The syntax and program name itself are
+system-dependent; sometimes it is named \texttt{mp}. MetaPost input
+files\index{files!input} normally have names ending
+\texttt{.mp}\index{mp file?{\tt mp} file}\index{files!mp?{\tt mp}} but
+this part of the name can be omitted when invoking MetaPost. The
+command-line options provided by MetaPost are summarized in
+appendix~\ref{refman:commandline}.
+
+\paragraph{Input file}
+\label{inputfile}
+
+A MetaPost input file normally contains a sequence of
+\verb|beginfig()|\index{beginfig?\texttt{beginfig}},
+\verb|endfig|\index{endfig?\texttt{endfig}} pairs with an {\tt
+ end}\index{end?\texttt{end}} statement after the last one. These are
+macros that perform various administrative functions and ensure that the
+results of all drawing operations get packaged up and translated into
+PostScript. The numeric argument to the \verb|beginfig| macro
+determines the name of the corresponding output file, whose name, by
+default, is of the form $\descr{jobname}{\tt.}\descr{n}$, where
+$\descr{jobname}$ is the base name of the graphics source file and
+$\descr{n}$ is the current argument to \verb|beginfig|. As an example,
+if a file is named {\tt fig.mp}, the output from drawing statements
+between \verb|beginfig(1)| and the next \verb|endfig| is written in a
+file {\tt fig.1}\index{files!output}.
+
+Statements can also appear outside \verb|beginfig/endfig|. Such
+statements are processed, but drawing operations generate no visible
+output. Typically, global configurations are put outside
+\verb|beginfig/endfig|, e.g., assignments to internal variables, such as
+\verb|outputtemplate| or \verb|prologues|, or a \LaTeX\ preamble
+declaration for enhanced text rendering.
+
+\paragraph{Log file and version number}
+\label{logfile}
+
+Any terminal I/O is summarized in a
+transcript\index{files!transcript}\index{transcript file} file called
+$\descr{filename}{\tt.log}$\index{log file?{\tt log}
+ file}\index{files!log?{\tt log}}. This includes error messages and
+any MetaPost commands entered interactively.\footnote{A {\tt
+ *}\index{*?\texttt{*}} prompt is used for interactive input and a
+ {\tt **}\index{**?\texttt{**}} prompt indicates that an input file
+ name is expected. This can be avoided by invoking MetaPost on a file
+ that ends with an {\tt end}\index{end?\texttt{end}} command.} The
+transcript file starts with a banner line that identifies the
+version\index{version number} of MetaPost you are using. The version
+number is also written to the generated PostScript or SVG file as a
+comment (for PostScript output the \texttt{Creator}\index{Creator
+ comment in PostScript output} line is used). You can also determine
+the current version from within a MetaPost program via the predefined
+constant string
+\texttt{mpversion}\index{mpversion?\texttt{mpversion}}\label{Dmpversion}
+(since version~0.9). For instance the following code
+
+$$\begin{verbatim}
+message "mp = " & mpversion;
+\end{verbatim}
+$$
+writes
+$$\begin{verbatim}[commandchars=\\\{\}]
+mp = \mpversion
+\end{verbatim}
+$$
+to the console and the transcript file.
+
+\paragraph{Output format}
+\label{outputformat}
+
+MetaPost can generate graphic in two output formats: Encapsulated
+PostScript\index{PostScript!structured} (EPSF\index{EPSF}), hence the
+name, and, since version~1.200, Scalable Vector Graphics
+(SVG\index{SVG}) following version~1.1 of the SVG
+specification~\cite{w3c:svg1.1}. By default, MetaPost outputs
+PostScript files. The output format can be changed to SVG by assigning
+the value \verb|"svg"| to the internal string variable\index{internal
+ variables}\index{variables!internal}
+\ttindex{outputformat}\label{Doutputformat}:
+
+$$\begin{verbatim}
+outputformat := "svg";
+\end{verbatim}
+$$
+
+Any other value makes MetaPost fall back to PostScript output. Variable
+\verb|outputformat| is case-sensitive, so assigning it the string
+\verb|"SVG"| enables PostScript output, too. Default value of variable
+\verb|outputformat| is \verb|"eps"|.
+
+\paragraph{Output file names}
+\label{outputfilenames}
+
+As discussed earlier, by default, every
+\verb|beginfig/endfig| group in an input file corresponds to an output
+file that follows the naming scheme $\descr{jobname}{\tt.}\descr{n}$.
+That is, all files have varying numeric file extensions. MetaPost
+provides a template mechanism that allows for more flexible output file
+names. The template mechanism uses \ttt{printf}-style escape sequences
+that are re-evaluated at ship-out time, i.e., before each figure is
+written to disk.
+
+To configure the output file naming scheme a string containing the
+corresponding escape sequences has to be assigned to the internal string
+variable\index{internal variables}\index{variables!internal}
+\ttt{outputtemplate}%
+\index{outputtemplate?\texttt{outputtemplate}}\label{Doutputtemplate}.
+The escape sequences provided are listed in table~\ref{tab:fntmpl}. If
+this code is saved in a file \ttt{fig.mp},
+
+$$\begin{verbatim}
+outputtemplate := "%j-%3c.mps";
+beginfig(1);
+ draw origin--(100,100);
+endfig;
+\end{verbatim}
+$$
+it will create the output file \ttt{fig-001.mps} instead of \ttt{fig.1}.
+The file extension \texttt{.mps}\index{mps file?{\tt mps}
+ file}\index{files!mps?{\tt mps}} is conventionally chosen for
+MetaPost's PostScript output (see section~\ref{teximport}). For SVG
+output one would want to use \texttt{.svg}\index{svg file?{\tt svg}
+ file}\index{files!svg?{\tt svg}} instead.
+
+%\suppressfloats[t]
+\begin{table}
+ \def\d{$\langle$0-9$\rangle$}
+ \centering
+ \begin{tabular}{|>{\ttfamily}l|>{\ttfamily}l|l|}
+ \hline
+ \multicolumn1{|c|}{Escape sequence} & \multicolumn1{c|}{Equivalent}
+ & \multicolumn1{c|}{Meaning}\\\hline
+ \%\%\index{\%\%?\texttt{\%\%}} & & percent sign\\
+ \%\d\{$\descr{internal
+ variable}$\}\index{\%\{...\}?\texttt{\%\{\ldots\}}} & & evaluate
+ internal variable\\
+ \%j\index{\%j?\texttt{\%j}} & \%\{jobname\} & current jobname\\
+ \%\d c\index{\%c?\texttt{\%c}} & \%\d\{charcode\} & charcode value (\verb|beginfig|
+ argument)\\
+ \%\d y\index{\%y?\texttt{\%y}} & \%\d\{year\} & current year\\
+ \%\d m\index{\%m?\texttt{\%m}} & \%\d\{month\} & month (numeric)\\
+ \%\d d\index{\%d?\texttt{\%d}} & \%\d\{day\} & day of the month\\
+ \%\d H\index{\%H?\texttt{\%H}} & \%\d\{hour\} & hour\\
+ \%\d M\index{\%M?\texttt{\%M}} & \%\d\{minute\} & minute\\
+ \hline
+ \end{tabular}
+ \caption{Allowed escape sequences for \ttt{outputtemplate}}
+ \label{tab:fntmpl}
+\end{table}
+
+The template mechanism can also be used for naming graphic files
+individually, yet keeping all sources in one file. E.\,g., collecting
+different diagram sources in a file \ttt{fig.mp}
+
+$$\begin{verbatim}
+outputtemplate := "fig-quality.mps";
+beginfig(1);
+ ...
+endfig;
+
+outputtemplate := "fig-cost-vs-productivity.mps";
+beginfig(2);
+ ...
+endfig;
+\end{verbatim}
+$$
+it might be easier to recall the correct diagram names in a \TeX\
+document than with numbered file names. Note, the argument to
+\verb|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{outputtemplate} is \verb|%j.%c|.
+If you assign an empty string, it will revert to that default. MetaPost
+versions~1.000 to~1.102 used a different template mechanism, see
+section~\ref{Dfilenametemplate} for more information.
+
+What does one do with all the graphic files? PostScript files are
+perfectly suitable for inclusion into documents created by
+\TeX\index{TeX?\TeX} or \emph{troff}\index{troff}. The SVG format, as
+an XML descendant (Extensible Meta Language), is more aiming at
+automated data processing/interchanging and is widely used for web
+applications. The next sections deal with the import of MetaPost
+graphics into third-party applications.
+
+At this point, it seems advisable to point out, that it is good style to
+create MetaPost graphics at nearly target size. While vector graphics
+\emph{can} be scaled without quality degradation, the visual character
+of a drawing might change unintentionally at large post-processing scale
+factors, because certain properties of a drawing do not scale
+proportionally, e.g., line width or arrow size. Additionally, while
+outline fonts do scale proportionally, this is not always desired, e.g.,
+when a font is available in optical sizes, like the Computer Modern font
+family.
\subsection{Previewing MetaPost graphics}
-\label{Dpreview}
+\label{previewing}
\index{previewing}
+\index{PostScript!previewing}
+\index{SVG!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
+The PostScript output of MetaPost can be previewed with any decent
+PostScript viewer, e.\,g., GSview\index{GSview}.
+The situation becomes only a little bit fussy when PostScript graphics
+contain 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
@@ -384,131 +516,100 @@ 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}.
+Starting with version~1.200, MetaPost is also capable of producing
+SVG output. SVG files can be previewed with certain web browsers,
+for example Firefox~3\index{Firefox} or Konqueror~4.2\index{Konqueror}.
-\subsection{Using MetaPost graphics in \TeX, \LaTeX, pdf\LaTeX, pdf\TeX, Con\TeX{}t and troff}
-\label{Dteximport}
+\subsection{Importing MetaPost graphics in \TeX\ documents}
+\label{teximport}
\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.
+MetaPost graphics in the PostScript format can be easily integreated
+into documents prepared with \TeX\ and friends. MetaPost's PostScript
+output is a low-featured dialect of the Postscript language, called
+\emph{purified EPS}, that can be converted into the Portable Document
+Format (PDF\index{PDF}) language on-the-fly. For that reason, MetaPost
+graphics can be handled by both engines, the traditional \TeX\ with an
+external output driver and the newer pdf\TeX, that contains a built-in
+PDF output driver.
+
+Figure~\ref{fig0} shows the process of including a MetaPost graphic into
+a plain \TeX\ or \LaTeX\ document. In the \TeX\ document a ``magic
+macro'' provided by the format or an external package is used for
+including a graphic file. During the typesetting stage, the macro only
+reads bounding box information off the PostScript file and reserves the
+required space on the page via an empty box. The file reference is
+passed-on to the output driver and only then, finally, the file is
+embedded into the document. The freely available program
+\ttindex{dvips} is used as an output driver in this
+example.\footnote{The C source for \ttt{dvips} comes with the web2c
+ \TeX\ distribution. Similar programs are available from other
+ sources.} The next paragraphs give brief information on some popular
+combinations of formats and engines.
\begin{figure}[htp]
-$$ \includegraphics{manfig-0} $$
+$$ \includegraphics{mpman-0.mps} $$
\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 PostScript
-files, reserve as much space on a page as a graphic occupies and write
-a reference to the corresponding file into \ttt{dvi} output. Graphic
-files are 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
-pdf\LaTeX's default extension for purified EPS files is
-\ttt{mps}\index{files!mps?\texttt{mps}}, but MetaPost output by
-default has a number as extensions, we either have to
-\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:
+\paragraph{Plain \TeX\ with \TeX}
+For users of \TeX\ with traditional DVI output the
+\ttt{epsf}\index{epsf.tex?\texttt{epsf.tex}} package provides the
+``magic macro''
+$$ \verb|\epsfbox{|\descr{filename}\verb|}|%
+\index{epsfbox?\texttt{\string\epsfbox}} $$
+for embedding graphics, e.g., \verb|\epsfbox{fig.1}|.
+
+\paragraph{Plain \TeX\ with pdf\TeX}
+Users of Plain \TeX\ and 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}.
-$$
-\begin{verbatim}
-\usepackage{graphicx}
-\usepackage{ifpdf}
-\ifpdf
- \DeclareGraphicsRule{*}{mps}{*}{}
-\fi
+\paragraph{\LaTeX\ format}
+For \LaTeX\ documents the well-known \ttindex{graphics} (or
+\ttindex{graphicx}) package aids in external graphics inclusion. The
+package supports different engines and can handle several graphic
+formats. The ``magic macro'' is
+$$ \verb|\includegraphics{|\descr{filename}\verb|}|%
+\index{includegraphics?\texttt{\string\includegraphics}} $$
+
+When the \ttt{dvips} driver is chosen, the \ttt{graphics} package
+assumes all files with an unknown file extension to be in the EPS
+format. MetaPost files with a numeric default file extension are
+therefore handled correctly -- even if only in a fall-back procedure
+(see~\cite{reckdahl:epslatex} for more information).
+
+For the pdf\TeX\ driver, the situation is a bit different. Only files
+with file extension \texttt{.mps}\index{mps file?{\tt mps}
+ file}\index{files!mps?{\tt mps}} are recognized as purified EPS and
+can be converted to PDF\index{PDF} on-the-fly. The recommended
+procedure for including MetaPost graphics into \LaTeX\ documents
+compiled with the pdf\TeX\ engine should be obvious: change MetaPost's
+output file naming scheme to write files ending \texttt{.mps} via
+\verb|outputtemplate|\index{outputtemplate?\texttt{outputtemplate}} (see
+p.~\pageref{Doutputtemplate}). In the \LaTeX\ document include the
+graphic files with full name, e.g.,
+$$\begin{verbatim}
+\includegraphics{fig-1.mps}
\end{verbatim}
$$
-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 documentation 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}.
+Note, the latter approach works with the \ttt{dvips} driver, too. Even
+though, again, this time \ttt{.mps} is an unknown file extension and
+triggers EPS file handling in the fall-back procedure. This property of
+the \ttt{graphics} package, that comes in handy for MetaPost files, is
+the reason many MetaPost source files start with the line
+$$\begin{verbatim}
+outputtemplate := "%j-%c.mps";
+\end{verbatim}
+$$
\paragraph{Con\TeX t}
In Con\TeX t\index{ConTeXt?Con\TeX t} support of MetaPost is integrated
@@ -526,84 +627,41 @@ 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}
+\subsection{Importing MetaPost graphics in \emph{troff} documents}
+\label{troffimport}
+\index{troff!importing MetaPost files}
+
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
+document. The procedure is similar to Figure~\ref{fig0}: the
+\ttt{grops} output processor includes PostScript files when they are
+requested via \emph{troff}'s \ttt{\string\X} command. The
+\ttt{-mpspic}\index{mpspic?\texttt{-mpspic}} macro package provides a
+command \verb|.PSPIC|\index{PSPIC?\texttt{.PSPIC}}, that does just that
+when including an encapsulated PostScript file in the source code. 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{Handling SVG files}
+\label{svgimport}
+\index{SVG!third-party applications}
-\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}%
-\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";|\\
-\verb|beginfig(1);|\\
-\verb| draw p;|\\
-\verb|endfig;|
-\end{tabular}\end{center}
-
-If the file is saved as \ttt{fig.mp}, then this will create the output
-file \ttt{fig-001.mps} instead of \ttt{fig.1}. A small set of escape
-sequences are possible, see table~\ref{tab:fntmpl} for details.
-
-\def\d{$\langle$0-9$\rangle$}
+SVG graphics can be easily embedded into HTML\index{HTML} documents with
+the following code snippet:
-\begin{table}
-\centering
-\begin{tabular}{|>{\ttfamily}l|l|}
-\hline
-\multicolumn1{|c|}{Escape sequence} & \multicolumn1{c|}{Meaning}\\\hline
-\%\% & A percent sign \\
-\%j & The current jobname\\
-\%\d c & The charcode value\\
-\%\d y & The current year\\
-\%\d m & The numeric month\\
-\%\d d & The day of the month\\
-\%\d H & The hour\\
-\%\d M & The minute\\
-\hline
-\end{tabular}
-\caption{Allowed escape sequences for \ttt{filenametemplate}}
-\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;
+$$\begin{verbatim}
+<p>
+ <object data="foo.svg" type="image/svg+xml" width="300" height="200">
+ </object>
+</p>
\end{verbatim}
$$
-it might be easier to recall the correct diagram names in a
-\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.
+SVG files can also be imported by various interactive graphics editing
+programs, for example GIMP\index{GIMP} or Inkscape\index{Inkscape}. See
+section~\ref{Dprologues} for information on font handling in SVG
+graphics.
\section{Curves}
@@ -625,7 +683,7 @@ Figure~\ref{fig2} shows the curve with points \verb|z0| through \verb|z4|
labeled.
\begin{figure}[htp]
-$$ \includegraphics{manfig-3}
+$$ \includegraphics{mpman-3.mps}
$$
\caption[A curve through points 0, 1, 2, 3, and 4]
{The result of {\tt draw z0..z1..z2..z3..z4}}
@@ -650,8 +708,8 @@ as having two draw statements
\end{eqnarray*}
\begin{figure}[htp]
-$$ {\includegraphics{manfig-104} \atop (a)}
- \qquad {\includegraphics{manfig-204} \atop (b)}
+$$ {\includegraphics{mpman-104.mps} \atop (a)}
+ \qquad {\includegraphics{mpman-204.mps} \atop (b)}
$$
\caption[Closed curves through five points]
{(a)~The result of {\tt draw z0..\linebreak[0]z1..\linebreak[0]%
@@ -704,7 +762,7 @@ draw (0,0)..controls (26.8,-1.8) and (51.4,14.6)
$$
\begin{figure}[htp]
-$$ \includegraphics{manfig-5}
+$$ \includegraphics{mpman-5.mps}
$$
\caption[A curve and the control polygon]
{The result of {\tt draw z0..z1..z2..z3..z4} with the
@@ -732,7 +790,7 @@ would have chosen a direction designed to make the curvature above
\verb|z1| almost the same as the curvature below that point.
\begin{figure}[htp]
-$$ \includegraphics{manfig-6}
+$$ \includegraphics{mpman-6.mps}
$$
\caption[A curve and the control polygon]
{The result of {\tt draw z0..z1\char`\{up\char`\}..z2\char`\{left\char`\}%
@@ -747,7 +805,7 @@ directions there. Figures \ref{fig6} and~\ref{fig7} give a good idea of what
this family of curves is like.
\begin{figure}[htp]
-$$ \mathcenter{\includegraphics{manfig-7}} \quad
+$$ \mathcenter{\includegraphics{mpman-7.mps}} \quad
\begin{verbatim}
beginfig(7)
for a=0 upto 9:
@@ -761,7 +819,7 @@ $$
\end{figure}
\begin{figure}[htp]
-$$ \mathcenter{\includegraphics{manfig-8}} \quad
+$$ \mathcenter{\includegraphics{mpman-8.mps}} \quad
\begin{verbatim}
beginfig(8)
for a=0 upto 7:
@@ -807,10 +865,10 @@ endpoint directions make this impossible.'' (It would be possible to
avoid inflections in Figure~\ref{fig6}, but not in Figure~\ref{fig7}).
\begin{figure}[htp]
-$$ {\mathcenter{\includegraphics{manfig-109}} \atop
+$$ {\mathcenter{\includegraphics{mpman-109.mps}} \atop
\hbox{\verb|draw z0{up}..z1{right}..z2{down}|}}
\quad
- {\mathcenter{\includegraphics{manfig-209}} \atop
+ {\mathcenter{\includegraphics{mpman-209.mps}} \atop
\hbox{\verb|draw z0{up}...z1{right}...z2{down}|}}
$$
\caption{Two {\tt draw} statements and the resulting curves.}
@@ -831,11 +889,11 @@ $$ \hbox{\verb|draw z0..z1..tension 1.5 and 1..z2..z3|} $$
The tension parameter can be less than one, but it must be at least $3\over4$.
\begin{figure}[htp]
-$$ {\mathcenter{\includegraphics{manfig-110}} \atop (a)}
+$$ {\mathcenter{\includegraphics{mpman-110.mps}} \atop (a)}
\quad
- {\mathcenter{\includegraphics{manfig-210}} \atop (b)}
+ {\mathcenter{\includegraphics{mpman-210.mps}} \atop (b)}
\quad
- {\mathcenter{\includegraphics{manfig-310}} \atop (c)}
+ {\mathcenter{\includegraphics{mpman-310.mps}} \atop (c)}
$$
\caption[Effects of changing the tension parameter]
{Results of {\tt draw z0..z1..tension} $\alpha$ {\tt and} $\beta$
@@ -859,13 +917,13 @@ shown in Figure~\ref{fig10}. In particular, a curl value of zero makes
the curvature approach zero.
\begin{figure}[htp]
-$$ {\mathcenter{\includegraphics{manfig-111}} \atop c=0}
+$$ {\mathcenter{\includegraphics{mpman-111.mps}} \atop c=0}
\qquad
- {\mathcenter{\includegraphics{manfig-211}} \atop c=1}
+ {\mathcenter{\includegraphics{mpman-211.mps}} \atop c=1}
\qquad
- {\mathcenter{\includegraphics{manfig-311}} \atop c=2}
+ {\mathcenter{\includegraphics{mpman-311.mps}} \atop c=2}
\qquad
- {\mathcenter{\includegraphics{manfig-411}} \atop c=\infty}
+ {\mathcenter{\includegraphics{mpman-411.mps}} \atop c=\infty}
$$
\caption[Effects of changing the curl parameter]
{Results of {\tt draw z0\char`\{curl c\char`\}..z1..%
@@ -1036,7 +1094,7 @@ draw z1--z2;
draw z3--z6;
endfig;
\end{verbatim}
-\quad \mathcenter{\includegraphics{manfig-13}}
+\quad \mathcenter{\includegraphics{mpman-13.mps}}
$$
\caption[MetaPost code and figure using linear equations]
{MetaPost commands and the resulting figure. Point labels have been
@@ -1364,7 +1422,7 @@ is written on a piece of graph paper so that the first character
occupies $x$~coordinates between zero and one and the next character
covers the range $1\le x\le2$, etc. Thus the string \verb|"abcde"|
should be thought of like this
-$$ \includegraphics{manfig-14} $$
+$$ \includegraphics{mpman-14.mps} $$
and {\tt substring (2,4) of "abcde"} is {\tt "cd"}. This takes a little
getting used to but it tends to avoid annoying ``off by one'' errors.
@@ -1673,16 +1731,38 @@ the internal variables discussed in this manual are predefined and do
not have to be declared at all, but there is a way to declare that a
variable should behave like a newly-created internal variable. The
declaration is {\tt
-newinternal}\index{newinternal?\texttt{newinternal}}\label{Dnewint}
-followed by a list of symbolic tokens. For example,
-$$ \hbox{\tt newinternal a, b, c;} $$
-causes {\tt a}, {\tt b}, and {\tt c} to behave like internal variables.
-Such variables always have known numeric values, and these values can
-only be changed by using the assignment\index{assignment} operator
-{\tt:=}\index{:=?\texttt{:=}}. Internal variables are initially zero
-except that the Plain\index{Plain macros} macro package gives some of
-them nonzero initial values. (The Plain macros are normally preloaded
-automatically as explained in Section~\ref{intro}.)
+ newinternal}\index{newinternal?\texttt{newinternal}}\label{Dnewint}
+followed by an optional type specifier \texttt{numeric}\index{internal
+ variables!\texttt{numeric}}\index{variables!internal!\texttt{numeric}}
+or \texttt{string}\index{internal
+ variables!\texttt{string}}\index{variables!internal!\texttt{string}}
+and a list of symbolic tokens. For example,
+$$\begin{verbatim}
+newinternal numeric n, m;
+newinternal string s, t;
+newinternal num;
+\end{verbatim}
+$$
+are valid declarations that declare three internal numeric variables
+\texttt{n}, \texttt{m}, and~\texttt{num} and two internal string
+variables \texttt{s} and~\texttt{t}.
+
+Internal variables always have known values, and these values can only
+be changed by using the assignment\index{assignment} operator
+{\tt:=}\index{:=?\texttt{:=}}. Internal numeric variables are initially
+zero and internal string variables are initially the empty
+string~\verb|""|, except that the Plain\index{Plain macros} macro
+package gives some of the variables different initial values. (The
+Plain macros are normally preloaded automatically as explained in
+Section~\ref{intro}.)
+
+Internal string variables have been introduced in MetaPost
+version~1.200. For backwards compatibility, if the type specifier is
+missing, internal variables default to a \texttt{numeric}\index{internal
+ variables!\texttt{numeric}}\index{variables!internal!\texttt{numeric}}
+type, as in the last example. The declarations \texttt{newinternal
+ numeric;} and \texttt{newinternal string;} are invalid and throw an
+error.
\section{Integrating Text and Graphics}
@@ -1737,7 +1817,7 @@ label.lft("b", .5[z0,z2]);
dotlabel.bot("(0,0)", z0);
endfig;
\end{verbatim}
-\qquad \mathcenter{\includegraphics{manfig-17}}
+\qquad \mathcenter{\includegraphics{mpman-17.mps}}
$$
\caption{MetaPost code and the resulting output}
\label{fig16}
@@ -1856,7 +1936,7 @@ label.bot(btex $x$ etex, (2u,0));
label.lft(btex $y$ etex, (0,u));
endfig;
\end{verbatim}
-\qquad \mathcenter{\includegraphics{manfig-18}}
+\qquad \mathcenter{\includegraphics{mpman-18.mps}}
$$
\caption{Arbitrary \TeX\ as labels}
\label{fig17}
@@ -1892,7 +1972,7 @@ label.lft(
(120ux, 4uy));
endfig;
\end{verbatim}
-\qquad \mathcenter{\includegraphics{manfig-19}}
+\qquad \mathcenter{\includegraphics{mpman-19.mps}}
$$
\caption{\TeX\ labels with display math, and rotated by MetaPost}
\label{fig18}
@@ -1909,23 +1989,49 @@ For a way to typeset \emph{variable} text as labels, see the
\texttt{TEX} utility routine described on p.\ \pageref{dTEX}.
Here is how \TeX\ material gets translated into a form MetaPost
-understands: The MetaPost processor skips over {\tt
-btex}\index{btex?\texttt{btex}} \ldots\ {\tt
-etex}\index{etex?\texttt{etex}} blocks and depends on a preprocessor to
-translate them into low level MetaPost commands. If the main file is
-{\tt fig.mp}, the translated \TeX\ material is placed in a file named
-{\tt fig.mpx}\index{files!mpx?{\tt mpx}}. This is normally done
-silently without any user intervention but it could fail if one of the
-{\tt btex} $\ldots$ {\tt etex} blocks contains an erroneous
-\TeX\index{TeX?\TeX!errors} command. Then the erroneous \TeX\ input is
-saved in the file {\tt mpxerr.tex}\index{mpxerr.tex?\texttt{mpxerr.tex}}
-and the error messages appear in {\tt
-mpxerr.log}\index{mpxerr.log?\texttt{mpxerr.log}}.
-
-The preprocessor for \TeX\ labels {\it does\/} understand virtual
+understands: MetaPost stores all {\tt btex}\index{btex?\texttt{btex}}
+\ldots\ {\tt etex}\index{etex?\texttt{etex}} blocks in a temporary
+file and then runs \TeX\ on that file. If the environment variable
+\ttindex{MPTEXPRE} is set to the name of an existing file, its content
+will be prepended to the output file for processing by \TeX. You can
+use this to include \LaTeX\ preambles, for instance. The \ttt{TEX}
+macro described on p.\ \pageref{dTEX} provides another way to handle
+this.
+
+Once the \TeX\ run is finished, MetaPost translates the resulting
+DVI\index{dvi file?{\tt dvi} file}\index{files!dvi?{\tt dvi}} file into
+low level MetaPost commands that are then read instead of the {\tt btex}
+\ldots\ {\tt etex} blocks. If the main file is {\tt fig.mp}, the
+translated \TeX\ material is placed in a file named {\tt
+ fig.mpx}\index{mpx file?{\tt mpx} file}\index{files!mpx?{\tt mpx}}.
+
+The conversion normally runs silently without any user intervention but
+it could fail, for instance if one of the {\tt btex} \ldots {\tt etex}
+blocks contains an erroneous \TeX\index{TeX?\TeX!errors} command. In
+that case, the \TeX\ input is saved in the file {\tt
+ mpxerr.tex}\index{mpxerr.tex?\texttt{mpxerr.tex}} and the \TeX\ error
+messages appear in {\tt
+ mpxerr.log}\index{mpxerr.log?\texttt{mpxerr.log}}\index{log file?{\tt
+ log} file}\index{files!log?{\tt log}}.
+
+The DVI to MetaPost conversion route {\it does\/} understand virtual
fonts, so you can use your normal \TeX\ font switching commands inside
the label.
+
+\label{Dmakempx}
+In MetaPost versions before 1.100, the \TeX\ label preprocessing was
+handled by an external program that was called upon automatically by
+MetaPost. On Web2C-based systems, the preprocessor was normally named
+\ttindex{makempx}, which called the utility \ttindex{mpto} for the
+creation of the \TeX\ input file and the utility \ttindex{dvitomp} for
+the conversion to low level MetaPost. In the current MetaPost version,
+the work of this program is now done internally. However, if the
+environment variable \ttindex{MPXCOMMAND} is set, the whole label
+conversion mechanism will be delegated to the command given in that
+variable.
+
+
\label{Dverbatimtex}
\TeX\ macro definitions or any other auxiliary \TeX\ commands can be
enclosed in a {\tt verbatimtex}\index{verbatimtex?\texttt{verbatimtex}}
@@ -1958,30 +2064,50 @@ Setting \ttt{prologues} can be useful with \TeX, too, not just troff.
Here is some explanation:
\begin{itemize}
-\item When \ttt{prologues} is 0, which is the default, the MetaPost
+\item In PostScript output mode, when \ttt{prologues} is 0, which is the default, the MetaPost
output files do not have embedded fonts. Fonts in the resulting
-output will probably render as Courier\index{Courier} or Times-Roman\index{Times-Roman}.
+output will probably render as Courier\index{Courier} or
+Times-Roman\index{Times-Roman}.
-\item When \ttt{prologues} is 1, the MetaPost output claims to be
+In SVG mode, the text will probably render in a generic sans serif font.
+There may very well be problems with the encoding of non-ASCII characters:
+the font model of SVG is totally different from the model used by MetaPost.
+
+\item In PostScript output mode, when \ttt{prologues} is 1, the MetaPost output claims to be
``structured PostScript''\index{PostScript!structured} (EPSF\index{EPSF}),
but it is not completely conformant. This variant is kept for backward
compatibility with old (troff) documents, but its use is deprecated.
-For historical reasons, MetaPost sets \ttt{prologues} to~1 when the {\tt
--troff} option is given on the command line.
+MetaPost sets \ttt{prologues} to~1 when the {\tt -troff} option is given
+on the command line.
+
+A \ttt{prologues:=1} setting is currently ignored in SVG output
+mode. The value is reserved for future use (possibly for mapping to
+\ttt{font-family}, \ttt{font-weight}, etc. properties).
-\item When \ttt{prologues} is 2, the MetaPost output is EPSF and assumes
+\item In PostScript output mode, when \ttt{prologues} is 2, the
+MetaPost output is EPSF and assumes
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
\ttt{fontmapline} commands.
-\item When \ttt{prologues} is 3, the MetaPost output will be EPSF but
+A \ttt{prologues:=2} setting is currently ignored in SVG output mode.
+The value is reserved for future use (possibly for external
+\ttt{font-face} definitions).
+
+\item In PostScript output mode, when \ttt{prologues} is 3, the MetaPost output will be EPSF but
will contain the PostScript font(s) (or a subset) used based on the
\ttt{fontmapfile} and \ttt{fontmapline} commands. This value is useful
for generating stand-alone PostScript graphics.
+
+In SVG mode, the font glyphs are converted to path definitions that
+are included at the top of the output file. This method is currently
+the only reliable way to export text objects to SVG.
+
\end{itemize}
+
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
@@ -1994,25 +2120,15 @@ 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, but have a look at
-section~\ref{Dteximport} of this manual for some brief instructions that
+section~\ref{teximport} 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
formats.
-\label{Dmakempx}
-On Web2C-based systems, the preprocessor is named \ttindex{makempx},
-which calls another utility \ttindex{mpto}; the Web2C documentation
-describes them in more detail. We'll mention one feature here, though:
-if the environment variable \ttindex{MPTEXPRE} is set to the name of an
-existing file, {\tt makempx} will prepend it to the output. You can use
-this to include \LaTeX\ preambles, for instance. The \ttt{TEX}
-macro described on p.\ \pageref{dTEX} provides another way to handle this.
-
-
\subsection{Font map files}
-\label{Sfontmapfile}\label{Sfontmapline}
+\label{fontmap}
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
@@ -2021,11 +2137,12 @@ the fontmap entry will be embedded in the output file. If
(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 YandY
-(\LaTeX\ LY1) encoding:
+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}\label{Dfontmapfile} and
+\ttindex{fontmapline}\label{Dfontmapline}. Here is a simple example,
+specifying the map file for Latin Modern fonts in YandY (\LaTeX\ LY1)
+encoding:
\begin{center}\begin{tabular}{l}
\verb|prologues:=2;|\\
\verb|fontmapfile "texnansi-lm.map";|\\
@@ -2142,7 +2259,7 @@ variables}\index{variables!internal} {\tt
bboxmargin}\index{bboxmargin?\texttt{bboxmargin}}\label{Dbbmargin}.
\begin{figure}[htp]
-$$ \includegraphics{manfig-20} $$
+$$ \includegraphics{mpman-20.mps} $$
\caption{A bounding box and its corner points.}
\label{bbox}
\end{figure}
@@ -2192,7 +2309,9 @@ 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:red2}.
+winding\index{winding number} number rule\index{non-zero fill
+ rule}\index{fill rule!non-zero}\index{PostScript!fill
+ rule}~\cite{ad:red2}.
\begin{figure}[htp]
$$ \begin{verbatim}
@@ -2203,7 +2322,7 @@ fill p{up}..(0,0){-1,-2}..{up}cycle;
draw p..(0,1cm)..cycle;
endfig;
\end{verbatim}
-\qquad \mathcenter{\includegraphics{manfig-21}}
+\qquad \mathcenter{\includegraphics{mpman-21.mps}}
$$
\caption{MetaPost code and the corresponding output.}
\label{fig20}
@@ -2252,8 +2371,8 @@ this model means that MetaPost will not write a color selection
statement to the PostScript output file for this object.
The `current default' color model can be set up using the internal
-variable \ttindex{defaultcolormodel}. Table~\ref{dfltcmod} lists the
-valid values.
+variable \ttindex{defaultcolormodel}\label{Ddefaultcolormodel}.
+Table~\ref{dfltcmod} lists the valid values.
\begin{table}
\centering
\begin{tabular}{|c|l|}
@@ -2305,7 +2424,7 @@ label.lft(btex $U$ etex, (-1cm,.5cm));
draw bbox currentpicture;
endfig;
\end{verbatim}
-\qquad \mathcenter{\includegraphics{manfig-22}}
+\qquad \mathcenter{\includegraphics{mpman-22.mps}}
$$
\caption{MetaPost code and the corresponding output.}
\index{fullcircle?\texttt{fullcircle}}\index{halfcircle?\texttt{halfcircle}}\index{buildcycle?\texttt{buildcycle}}
@@ -2369,8 +2488,8 @@ little confusing.
\begin{figure}[htp]
-$$ {\includegraphics{manfig-123} \atop (a)}
- \qquad {\includegraphics{manfig-223} \atop (b)}
+$$ {\includegraphics{mpman-123.mps} \atop (a)}
+ \qquad {\includegraphics{mpman-223.mps} \atop (b)}
$$
\caption[A demonstration of cycle building]
{(a)~The semicircular path~{\tt aa}
@@ -2417,7 +2536,7 @@ dotlabel.lft(btex $R$ etex, p4 intersectionpoint q1.5);
dotlabel.bot(btex $S$ etex, p4 intersectionpoint q0.5);
endfig;
\end{verbatim}
-\atop \mathcenter{\includegraphics{manfig-24}}
+\atop \mathcenter{\includegraphics{mpman-24.mps}}
$$
\caption{MetaPost code and the corresponding output.}
\label{fig23}
@@ -2490,7 +2609,7 @@ there are no integers between $t_a$ and $t'_a$\index{intersection}.
(For more details, see {\sl The \MF book} \cite[Chapter 14]{kn:c}).
\begin{figure}[htp]
-$$ \includegraphics{manfig-25} $$
+$$ \includegraphics{mpman-25.mps} $$
\caption{Two intersecting paths with time values marked on each path.}
\label{fig24}
\end{figure}
@@ -2591,7 +2710,7 @@ pickup pencircle scaled 1pt;
draw fun;
endfig;
\end{verbatim}
-\atop \includegraphics{manfig-26}
+\atop \includegraphics{mpman-26.mps}
$$
\caption{MetaPost code and the resulting figure}
\label{fig25}
@@ -2809,7 +2928,7 @@ endfor
dotlabels.top(1,2,3); dotlabels.bot(4);
endfig;
\end{verbatim}
-\quad \mathcenter{\includegraphics{manfig-28}}
+\quad \mathcenter{\includegraphics{mpman-28.mps}}
$$
\caption{MetaPost code and the resulting ``fractal'' figure}
\label{fig27}
@@ -2837,7 +2956,7 @@ can be scaled\index{scaled?\texttt{scaled}} as shown in
Figure~\ref{fig28}.
\begin{figure}[htp]
-$$ \includegraphics{manfig-29} $$
+$$ \includegraphics{mpman-29.mps} $$
\caption[Dashed lines and the corresponding dash patters]
{Dashed lines each labeled with the \tdescr{dash pattern} used to create
it.}
@@ -2854,7 +2973,7 @@ $y$~axis is laid out along the path to be dashed\index{dash
pattern?\tdescr{dash pattern}}.
\begin{figure}[htp]
-$$ \includegraphics{manfig-30} $$
+$$ \includegraphics{mpman-30.mps} $$
\caption[Dashed lines and the corresponding dash patters]
{Dashed lines and the MetaPost statements for drawing them where {\tt e4}
refers to the dash pattern {\tt evenly scaled 4}.}
@@ -2897,7 +3016,7 @@ $$ \hbox{\tt dashpattern(on 6bp off 12bp on 6bp)}, $$
then {\tt llcorner d} is $(0,24)$ and {\tt urcorner d} is $(24,24)$.
Drawing {\tt d} directly without using it as a dash pattern produces two
thin horizontal line segments like this:
-$$ \includegraphics{manfig-31} $$
+$$ \includegraphics{mpman-31.mps} $$
The lines in this example are specified as having width zero, but this
does not matter because the line width is ignored when a picture is used
as a dash pattern.
@@ -2939,7 +3058,7 @@ currentpicture:=nullpicture;
draw fullcircle scaled 1cm xscaled 3 dashed p;
endfig;
\end{verbatim}
-\quad \mathcenter{\includegraphics{manfig-32}}
+\quad \mathcenter{\includegraphics{mpman-32.mps}}
$$
\caption{MetaPost code for dashed patterns and the corresponding output}
\label{fig32}
@@ -3019,7 +3138,7 @@ dotlabels.top(0,1,2,3,4,5);
endfig; linecap:=rounded;
\end{verbatim}
\qquad
-\mathcenter{\includegraphics{manfig-33}}
+\mathcenter{\includegraphics{mpman-33.mps}}
$$
\caption{MetaPost code and the corresponding output}
\label{fig33}
@@ -3052,7 +3171,7 @@ dotlabels.bot(0,1,2,3,4,5,6,7,8);
endfig; linejoin:=rounded;
\end{verbatim}
\qquad
-\mathcenter{\includegraphics{manfig-34}}
+\mathcenter{\includegraphics{mpman-34.mps}}
$$
\caption{MetaPost code and the corresponding output}
\label{fig34}
@@ -3069,7 +3188,7 @@ default value of 10.0 and line joins revert to beveled when the ratio of
miter length to line width reaches this value.
\begin{figure}[htp]
-$$ \includegraphics{manfig-35} $$
+$$ \includegraphics{mpman-35.mps} $$
\caption{The miter length and line width whose ratio is limited by
{\tt miterlimit}.}
\label{fig35}
@@ -3084,7 +3203,7 @@ width and is quite subtle at the default line width of 0.5bp as shown in
Figure~\ref{fig36}.
\begin{figure}[htp]
-$$\includegraphics{manfig-36}$$
+$$\includegraphics{mpman-36.mps}$$
\caption{Three ways of drawing arrows.}
\label{fig36}
\end{figure}
@@ -3120,7 +3239,7 @@ parameter that controls the angle at the tip of the arrowhead. The
default value of this angle is 45 degrees as shown in the figure.
\begin{figure}[htp]
-$$ \includegraphics{manfig-37} $$
+$$ \includegraphics{mpman-37.mps} $$
\caption[A large arrowhead with key parameters labeled.]
{A large arrowhead with key parameters labeled and paths used to
draw it marked with white lines.}
@@ -3234,7 +3353,7 @@ draw z0--z1--z2--z3--z4--z5--z6 withcolor .7white;
dotlabels.top(0,1,2,3,4,5,6);
endfig;
\end{verbatim}
-\quad \mathcenter{\includegraphics{manfig-38}}
+\quad \mathcenter{\includegraphics{mpman-38.mps}}
$$
\caption{MetaPost code and the resulting ``calligraphic'' figure.}
\label{fig38}\index{lft?\texttt{lft}}\index{bot?\texttt{bot}}\index{top?\texttt{top}}
@@ -3412,7 +3531,7 @@ draw p3;
endfig;
\end{verbatim}
\qquad
-\mathcenter{\includegraphics{manfig-40}}
+\mathcenter{\includegraphics{mpman-40.mps}}
$$
\caption{MetaPost code and the resulting ``clipped'' figure.}
\label{fig40}
@@ -3424,8 +3543,8 @@ statement\index{shipout?\texttt{shipout}}\label{Dship}
$$ {\tt shipout}\, \descr{picture expression} $$
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 outputtemplate}\index{outputtemplate?\texttt{outputtemplate}}
+(see section~\ref{outputfilenames}). 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
@@ -3456,7 +3575,7 @@ 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} $$
+$$ \includegraphics{mpman-55.mps} $$
\caption{Copying objects with the \ttt{image} operator.}
\label{fig55}
\end{figure}
@@ -3662,6 +3781,202 @@ To summarize the discussion of mismatching part operators:
\index{greypart?\texttt{greypart}|)}
+\subsection{Decomposing the glyphs of a font}
+\label{glyphs}
+
+MetaPost provides a primitive to convert a glyph of a font in the Adobe
+Type~1 Font\index{PostScript!fonts}\index{font!PostScript}\index{Adobe
+ Type~1 Font}\index{font!Adobe Type~1} format into its constituent
+filled paths---the strokes---and store them in a picture variable. A
+glyph\index{font!glyph} is the visual representation of a character in a
+font. A character\index{character}\index{font!character} is a certain
+slot\index{slot} (index) in a font with an associated meaning, e.g., the
+capital letter~``M'' or the exclamation mark. The meaning of a slot is
+defined by the font encoding\index{encoding}\index{font!encoding}. In
+general, the same character is represented by different glyphs in
+different fonts. Figure~\ref{glyphsample} shows some glyphs for the
+character at slot~103 in the T1 encoding, i.e., the lower-case
+letter~``g''. All glyphs are at the same nominal size. Note, how
+glyphs may extend beyond their bounding box.
+\begin{figure}[htp]
+ \centering
+ \setlength{\fboxsep}{0pt}
+ \setlength{\fboxrule}{.125pt}
+ \fontsize{56pt}{56pt}\selectfont
+ \newcommand*{\showglyph}[4]{% a glyph with its bounding box
+ \fbox{\usefont{#1}{#2}{#3}{#4}g}%
+ }
+ \makebox[0pt][c]{% base line
+ \rule{.7\textwidth}{.125pt}%
+ }%
+ \makebox[0pt][c]{% glyphs
+ \showglyph{T1}{lmr}{m}{n}\hspace{.3em}
+ \showglyph{T1}{qag}{m}{n}\hspace{.3em}
+ \showglyph{T1}{qpl}{m}{it}\hspace{.3em}
+ \showglyph{T1}{qzc}{m}{it}%
+ }
+ \caption{Different glyphs representing the same character.}
+ \label{glyphsample}
+\end{figure}
+
+The glyphs of an Adobe Type~1 font
+\index{PostScript!fonts}\index{font!PostScript}\index{Adobe Type~1
+ Font}\index{font!Adobe Type~1} are composed of two types of contours:
+Clockwise oriented contours add to the shape of a glyph and are filled
+with black ink. Counter-clockwise oriented contours
+erase\index{erasing} parts of other contours, i.e., make them
+transparent again. To save the contours of a glyph in a picture, the
+\verb|glyph|\index{glyph?\texttt{glyph}}\label{Dglyph} operator can be
+used. There are two ways to identify a glyph in a font:
+\begin{eqnarray*}
+ & \verb|glyph|\, \descr{numeric expression}\, \verb|of|\,
+ \descr{string expression}\\
+ \noalign{\hbox{and}}
+ & \verb|glyph|\, \descr{string expression}\, \verb|of|\,
+ \descr{string expression}\rlap{\quad\mbox{.}}
+\end{eqnarray*}
+
+If the first argument is a numeric expression, it has to be a slot
+number between 0 and~255. Fractional slot numbers are rounded to the
+nearest integer value. Slot numbers outside the allowed range trigger
+an error. If the first argument is string, it has to be a CharString
+name\index{CharString name} in the PostScript font's source file. A
+CharString name is a unique text label for a glyph in a PostScript font
+(a font encoding actually maps CharStrings to slots). This second
+syntax can be used to address glyphs without having to think about font
+encodings. The second argument to the \verb|glyph| operator is a string
+containing a font name (section~\ref{text} has more on font names).
+
+The \verb|glyph| operator looks-up the font name in the font map to
+determine the encoding and to find the font's PostScript source file.
+It returns a picture consisting of the glyph's contour lines, explicitly
+filled black and white in the greyscale color model according to the
+rules laid out above. Additionally, the contours are sorted, such that
+all black contours are drawn before white contours. The filling and
+sorting is necessary for the picture to resembles the corresponding
+glyph visually\footnote{Plain contours already carry enough information
+ to completely reconstruct a glyph, the orientation of a contour can be
+ computed from its cardinal and control points. MetaPost has a
+ \texttt{turningnumber}\index{turningnumber?\texttt{turningnumber}}\label{Dturningnumber}
+ primitive to do that.}, since Adobe Type~1
+fonts\index{PostScript!fonts}\index{font!PostScript}\index{Adobe Type~1
+ Font}\index{font!Adobe Type~1} use a generalized variant of the
+non-zero winding number fill rule\index{non-zero fill rule}\index{fill
+ rule!non-zero}\index{PostScript!fill rule}, that MetaPost doesn't
+implement (MetaPost cannot handle non-contiguous paths). As a side
+effect, the interiors of the erasing\index{erasing} contours are an
+opaque white in the returned picture, while they were transparent in the
+original glyph. One can think of erasing contours to be unfilled (see
+p.~\pageref{Dunfill}). For instance, the following code saves the
+contours of the lower case letter~``g'', bound to slot~103 in the OT1
+encoding\index{OT1 encoding}\index{encoding!OT1}, in the Computer Modern
+Roman\index{Computer Modern Roman} font in a picture variable:
+
+$$\begin{verbatim}
+fontmapline "cmr10 CMR10 <cmr10.pfb";
+picture g;
+g := glyph 103 of "cmr10";
+\end{verbatim}
+$$
+
+The \verb|glyph| operator returns an empty picture, if the
+\texttt{.tfm}\index{tfm file?{\tt tfm} file}\index{files!tfm?{\tt tfm}}
+or \texttt{.pfb}\index{pfb file?{\tt pfb} file}\index{files!pfb?{\tt
+ pfb}} file cannot be found, if the encoding given in the font map
+cannot be found or the slot number is not covered by the encoding or if
+the CharString name cannot be found. Note, while MetaPost delegates the
+actual font handling to a rendering application for \verb|infont| and
+\verb|btex| \ldots\ \verb|etex| blocks, the \verb|glyph| operator
+directly operates on font ressources. For that reason, a font map entry
+is mandatory for the font in question, given either by
+\verb|fontmapline| or \verb|fontmapfile| (see
+section~\ref{Dfontmapline}).
+
+In Figure~\ref{fig56}, the contours of the upper case letter~``\v{D}''
+in the Latin Modern Roman\index{Latin Modern Roman} font are saved in a
+picture variable. The glyph is identified by its CharString name
+``Dcaron''\index{Dcaron}. The code then iterates over all contours and
+draws them together with their cardinal (black) and control points
+(red). As it turns out, many of the control points coincide with
+cardinal points in this glyph.
+
+\begin{figure}[htb]
+$$\begin{verbatim}
+fontmapfile "=lm-ec.map";
+beginfig(56);
+ picture q;
+ path p;
+ interim ahlength := 12bp;
+ interim ahangle := 25;
+ q := glyph "Dcaron" of "ec-lmr10" scaled .2;
+ for item within q:
+ p := pathpart item;
+ drawarrow p withcolor (.6,.9,.6)
+ withpen pencircle scaled 1.5;
+ for j=0 upto length p:
+ pickup pencircle scaled .7;
+ draw (point j of p -- precontrol j of p)
+ dashed evenly withcolor blue;
+ draw (point j of p -- postcontrol j of p)
+ dashed evenly withcolor blue;
+ pickup pencircle scaled 3;
+ draw precontrol j of p withcolor red;
+ draw postcontrol j of p withcolor red;
+ pickup pencircle scaled 2;
+ draw point j of p withcolor black;
+ endfor
+ endfor
+endfig;
+\end{verbatim}
+\qquad
+\mathcenter{\includegraphics{mpman-56.mps}}
+$$
+\caption{Iterating over the contours of a glyph}
+\label{fig56}
+\end{figure}
+
+The contours in a picture returned by the \verb|glyph| operator are no
+raw copies of the contours found in the font sources, but the
+\verb|glyph| operator applies a number of transformations to them.
+First, the direction of all contours is reversed, so that contours
+filled black become counter-clockwise oriented (mathematically positive)
+and contours filled white become clockwise oriented (mathematically
+negative). Second, in an Adobe Type~1
+font\index{PostScript!fonts}\index{font!PostScript}\index{Adobe Type~1
+ Font}\index{font!Adobe Type~1}, contours are in general closed by
+repeating the starting point before applying the \verb|closepath|
+operator\index{PostScript!\texttt{closepath} operator}. The MetaPost
+representation of such a path would be:
+$$
+z_0\verb|..|\mbox{\itshape controls}\verb|..|z_1\verb|..| \cdots
+\verb|..|z_n\verb|..|\mbox{\itshape controls}\verb|..|z_0\verb|--cycle|
+$$
+A more natural MetaPost representation of this path would be:
+$$
+z_0\verb|..|\mbox{\itshape controls}\verb|..|z_1\verb|..| \cdots
+\verb|..|z_n\verb|..|\mbox{\itshape controls}\verb|..cycle|
+$$
+The \verb|glyph| operator transforms all paths into the latter
+representation, i.e., the last point is removed, whenever it matches the
+starting point. Finally, the picture returned by the \verb|glyph|
+operator is scaled such that one font design unit\index{font!design
+ unit} equals one PostScript
+point\index{point!PostScript}\index{PostScript!point} (bp). A usual
+font design unit is a thousandth part of the font design
+size\index{font!design size}. The returned picture will therefore
+typically have a height of around 1000\,bp.
+
+Converting a text into plain curves is part of a process oftentimes
+called ``flattening\index{flattening} a document.'' When flattening
+text, all hinting information in fonts are lost. Hinting information
+aid a rendering application in aligning certain parts of a glyph on a
+low-resolution output device. A flattened text may therefore look
+distorted on screen. In SVG output, all text is automatically
+flattened, when the internal variable
+\verb|prologues|\index{prologues?\texttt{prologues}} is set to~3 (see
+section~\ref{Dprologues}).
+
+
\section{Macros}
\label{macros}
@@ -3810,7 +4125,7 @@ internal variable\index{internal variables}\index{variables!internal}
gives it a new value without forgetting that {\tt linecap} is an internal
variable. The general syntax is
$$ {\tt interim}\, \descr{internal variable} \mathrel{\hbox{\tt:=}}
- \descr{numeric expression}
+ \descr{numeric expression} \;|\; \descr{string expression}
$$
@@ -3934,7 +4249,7 @@ mark_rt_angle(z.p, z0, a);
mark_rt_angle(z.p, z1, b);
endfig;
\end{verbatim}
-\quad \mathcenter{\includegraphics{manfig-42}}
+\quad \mathcenter{\includegraphics{mpman-42.mps}}
$$
\caption{MetaPost code and the corresponding figure}
\label{fig42}
@@ -4129,7 +4444,7 @@ for i=0 upto 3:
endfor
endfig;
\end{verbatim}
-\quad \mathcenter{\includegraphics{manfig-45}}
+\quad \mathcenter{\includegraphics{mpman-45.mps}}
$$
\caption{MetaPost code and the corresponding figure}
\label{fig45}
@@ -4720,7 +5035,8 @@ or just a one-off run.
writes a proof sheet for MetaPost output. Call it like this:
$$\hbox{\tt tex mproof {\sl MetaPost-output-filename}}$$
-Then process the resulting \texttt{dvi} file as usual.
+Then process the resulting \texttt{.dvi}\index{dvi file?{\tt dvi}
+ file}\index{files!dvi?{\tt dvi}} file as usual.
\section{Debugging}
@@ -4785,12 +5101,35 @@ Among the possible responses to a {\tt ?} prompt are the following:
{\tt ?} prompt.
\end{description}
+This interactive mode is not only entered when MetaPost finds an error
+in the code. It can be explicitly entered by the \ttindex{errmessage}
+command. The \ttindex{message}\label{Dmessage} command writes a string
+argument to a new line on the terminal. The
+\ttindex{errmessage}\label{Derrmessage} command is similar, but the
+string argument is preceded by \verb|"! "| and followed by~\verb|"."|.
+Additionally, some lines of context are appended as in MetaPost's normal
+error messages. If the user now types ``h'', the most recent
+\ttindex{errhelp}\label{Derrhelp} string will be shown (unless it was
+empty).
+
+\begin{figure}[htp]
+\begin{ctabbing}
+$\tt \descr{message command} \rightarrow errhelp \descr{string expression}$\\
+$\tt \qquad \;|\; errmessage \descr{string expression}$\\
+$\tt \qquad \;|\; message \descr{string expression}$
+\end{ctabbing}
+\caption{The syntax for message commands}
+\label{symsg}
+\end{figure}
+
Error messages and responses to {\tt show} commands are also written
into the transcript\index{files!transcript} file whose name is obtained
-from the name of the main input file by changing ``{\tt .mp}'' to ``{\tt
-.log}''. When the internal variable\index{internal
-variables}\index{variables!internal} {\tt
-tracingonline}\index{tracingonline?\texttt{tracingonline}} is at its
+from the name of the main input file by changing ``{\tt .mp}''\index{mp
+ file?{\tt mp} file}\index{files!mp?{\tt mp}} to ``{\tt
+ .log}''\index{log file?{\tt log} file}\index{files!log?{\tt
+ log}}. When the internal variable\index{internal
+ variables}\index{variables!internal} {\tt
+ tracingonline}\index{tracingonline?\texttt{tracingonline}} is at its
default value of zero, some {\tt show} commands print their results in
full detail only in the transcript file.
@@ -4903,1047 +5242,8 @@ treatment of included \TeX\ material.
\appendix
-\section{Reference Manual}
-
-\let\svtopfrac=\topfraction % prepare to restore values at end of this appendix
-\let\svtxtfrac=\textfraction % grouping would fail because \setcounter is global
-\newcounter{svtopnum}
-\newcounter{svtotnum}
-\setcounter{svtopnum}{\value{topnumber}}
-\setcounter{svtotnum}{\value{totalnumber}}
-
-\renewcommand\topfraction{1.0} % set values to allow *lots* of figures and tables
-\renewcommand\textfraction{0.0}
-\setcounter{topnumber}{10}
-\setcounter{totalnumber}{10}
-
-Tables \ref{ivartab}--\ref{pseudotab} summarize the built-in features of
-Plain MetaPost. Features from the Plain\index{Plain macros} macro
-package are marked by \pl\ symbols. The distinction between primitives
-and plain macros can be ignored by the casual user.
-
-The tables in this appendix give the name of each feature, the page
-number where it is explained, and a short description. A few features
-are not explained elsewhere and have no page number listed. These
-features exist primarily for compatibility with \MF\index{metafont?\MF}
-and are intended to be self-explanatory. Certain other features from
-\MF\ are omitted entirely because they are of limited interest to the
-MetaPost users and/or would require long explanations. All of these are
-documented in {\sl The \MF book} \cite{kn:c} as explained in
-Appendix~\ref{MPvsMF}.
-
-Table~\ref{ivartab} lists internal variables that take on numeric values.
-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.
-
-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 this table because they are treated as
-``function-like macros''.
-
-The last two tables are Table~\ref{cmdtab} for commands and
-Table~\ref{pseudotab} macros that behave like functions or procedures.
-Such macros take parenthesized argument lists and/or suffix parameters,
-returning either a value whose type is listed in the table, or nothing.
-The latter case is for macros that behave like procedures. Their return
-values are listed as ``--''.
-
-The figures in this appendix present the syntax of the MetaPost language
-starting with expressions in Figures \ref{syexpr1}--\ref{sypseudo}.
-Although the productions sometimes specify types for expressions, primaries,
-secondaries, and tertiaries, no attempt is made to give separate syntaxes
-for \tdescr{numeric expression}, \tdescr{pair expression}, etc.
-The simplicity of the productions in Figure~\ref{sytypexpr} is due to this
-lack of type information. Type information
-can be found in Tables \ref{ivartab}--\ref{pseudotab}.
-
-Figures \ref{syprog} and \ref{sycmds} give the syntax for MetaPost programs,
-including statements and commands. They do not mention loops\index{loops}
-and {\tt if}\index{if?\texttt{if}}
-tests because these constructions do not behave like statements. The syntax
-given in Figures \ref{syexpr1}--\ref{sycondloop} applies to the result of
-expanding all conditionals and loops. Conditionals and loops do have a
-syntax, but they deal with almost arbitrary sequences of tokens.
-Figure~\ref{sycondloop} specifies conditionals in terms of
-\tdescr{balanced tokens} and loops in terms of \tdescr{loop text}, where
-\tdescr{balanced tokens} is any sequence of tokens balanced with respect
-to {\tt if} and {\tt fi}, and \tdescr{loop text} is a sequence of tokens
-balanced with respect to {\tt for}, {\tt forsuffixes}, {\tt forever},
-and {\tt endfor}.
-
-\begin{table}[htp]
-\caption{Internal variables with numeric values}
-$$\begin{tabular}{|l|r|l|}
-\hline
-\multicolumn1{|c}{Name}& \multicolumn1{|c}{Page}& \multicolumn1{|c|}{Explanation}\\
-\hline
-\hline
-\pl\tt ahangle& \pageref{Dahangle}&
- angle for arrowheads in degrees (default: 45)\\\hline
-\pl\tt ahlength& \pageref{Dahlength}&
- size of arrowheads (default: 4{\tt bp})\\\hline
-\pl\tt bboxmargin& \pageref{Dbbmargin}&
- extra space allowed by {\tt bbox} (default 2{\tt bp})\\\hline
-\tt charcode& \pageref{Dcharcode}&
- the number of the current figure\\\hline
-\tt day& --&
- the current day of the month\\\hline
-\tt defaultcolormodel& --&
- the initial color model (default: 5, rgb)\\\hline
-\pl\tt defaultpen& \pageref{Ddefaultpen}&
- numeric index used by {\tt pickup} to select default pen\\\hline
-\pl\tt defaultscale& \pageref{Ddfscale}&
- font scale factor for label strings (default 1)\\\hline
-\pl\tt labeloffset& \pageref{Dlaboff}&
- offset distance for labels (default 3{\tt bp})\\\hline
-\tt linecap& \pageref{Dlinecap}&
- 0 for butt, 1 for round, 2 for square\\\hline
-\tt linejoin& \pageref{Dlinejoin}&
- 0 for mitered, 1 for round, 2 for beveled\\\hline
-\tt miterlimit& \pageref{Dmiterlim}&
- controls miter length as in PostScript\\\hline
-\tt month& --&
- the current month (e.g, 3 $\equiv$ March)\\\hline
-\tt mpprocset& --&
- \vtop{\hbox{set this to~1 if you want to include a PostScript
-dictionary}\hbox{of abbreviations in the output}}\\\hline
-\tt pausing& --&
- ${}>0$ to display lines on the terminal before they are read\\\hline
-\tt prologues& \pageref{Dprologues}&
- ${}>0$ to output conforming PostScript using built-in fonts\\\hline
-\tt restoreclipcolor& --&
- restore the graphics state after clip operations (default: 1)\\\hline
-\tt showstopping& --&
- ${}>0$ to stop after each {\tt show} command\\\hline
-\tt time& --&
- the number of minutes past midnight when this job started\\\hline
-\tt tracingcapsules& \pageref{Dtcapsules}&
- ${}>0$ to show capsules too\\\hline
-\tt tracingchoices& \pageref{Dtchoices}&
- ${}>0$ to show the control points chosen for paths\\\hline
-\tt tracingcommands& \pageref{Dtcommands}&
- ${}>0$ to show commands and operations as they are performed\\\hline
-\tt tracingequations& \pageref{Dtequations}&
- ${}>0$ to show each variable when it becomes known\\\hline
-\tt tracinglostchars& \pageref{Dtlostchars}&
- ${}>0$ to show characters that aren't {\tt infont}\\\hline
-\tt tracingmacros& \pageref{Dtmacros}&
- ${}>0$ to show macros before they are expanded\\\hline
-\tt tracingonline& \pageref{Dtonline}&
- ${}>0$ to show long diagnostics on the terminal\\\hline
-\tt tracingoutput& \pageref{Dtoutput}&
- ${}>0$ to show digitized edges as they are output\\\hline
-\tt tracingrestores& \pageref{Dtrestores}&
- ${}>0$ to show when a variable or internal is restored\\\hline
-\tt tracingspecs& \pageref{Dtspecs}&
- ${}>0$ to show path subdivision when using a polygonal a pen\\\hline
-\tt tracingstats& \pageref{Dtstats}&
- ${}>0$ to show memory usage at end of job\\\hline
-\tt tracingtitles& --&
- ${}>0$ to show titles online when they appear\\\hline
-\tt troffmode& \pageref{Dtroffmode}&
- set to~1 if a {\tt -troff} or {\tt -T} option was given\\\hline
-\tt truecorners& \pageref{Dtruecorn}&
- ${}>0$ to make {\tt llcorner} etc. ignore {\tt setbounds}\\\hline
-\tt warningcheck& \pageref{Dwarncheck}&
- controls error message when variable value is large\\\hline
-\tt year& --&
- the current year (e.g., 1992)\\\hline
-\end{tabular}
-$$
-\label{ivartab}%
-\index{day?\texttt{day}}\index{month?\texttt{month}}\index{pausing?\texttt{pausing}}\index{showstopping?\texttt{showstopping}}%
-\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|}
-\hline
-\multicolumn1{|c}{Name}& \multicolumn1{|c}{Type}& \multicolumn1{|c}{Page}&
- \multicolumn1{|c|}{Explanation}\\
-\hline
-\hline
-\pl\tt background& color& \pageref{Dbground}&
- Color for {\tt unfill} and {\tt undraw} (usually white)\\\hline
-\pl\tt currentpen& pen& \pageref{Dcurpen}&
- Last pen picked up (for use by the {\tt draw} command)\\\hline
-\pl\tt currentpicture& picture& \pageref{Dcurpic}&
- Accumulate results of {\tt draw} and {\tt fill} commands\\\hline
-\pl\tt cuttings& path& \pageref{Dcuttings}&
- subpath cut off by last {\tt cutbefore} or {\tt cutafter}\\\hline
-\pl\tt defaultfont& string& \pageref{Ddffont}&
- Font used by label commands for typesetting strings\\\hline
-\pl\tt extra\_beginfig& string& \pageref{Dxbfig}&
- Commands for {\tt beginfig} to scan\\\hline
-\pl\tt extra\_endfig& string& \pageref{Dxefig}&
- Commands for {\tt endfig} to scan\\\hline
-\end{tabular}
-$$
-\label{pvartab}
-\end{table}
-
-
-\begin{table}[htp]
-\caption{Predefined Constants}
-$$\begin{tabular}{|l|l|r|l|}
-\hline
-\multicolumn1{|c}{Name}& \multicolumn1{|c}{Type}& \multicolumn1{|c}{Page}&
- \multicolumn1{|c|}{Explanation}\\
-\hline
-\hline
-\pl\tt beveled& numeric& \pageref{Dbvled}&
- {\tt linejoin} value for beveled joins [2]\\\hline
-\pl\tt black& color& \pageref{Dblack}&
- Equivalent to {\tt (0,0,0)}\\\hline
-\pl\tt blue& color& \pageref{Dblue}&
- Equivalent to {\tt (0,0,1)}\\\hline
-\pl\tt bp& numeric& \pageref{Dbp}&
- One PostScript point in {\tt bp} units [1]\\\hline
-\pl\tt butt& numeric& \pageref{Dbutt}&
- {\tt linecap} value for butt end caps [0]\\\hline
-\pl\tt cc& numeric& --&
- One cicero in {\tt bp} units [12.79213]\\\hline
-\pl\tt cm& numeric& \pageref{Dcm}&
- One centimeter in {\tt bp} units [28.34645]\\\hline
-\pl\tt dd& numeric& --&
- One didot point in {\tt bp} units [1.06601]\\\hline
-\pl\tt ditto& string& --&
- The {\tt "} character as a string of length 1\\\hline
-\pl\tt down& pair& \pageref{Ddown}&
- Downward direction vector $(0,-1)$\\\hline
-\pl\tt epsilon& numeric& --&
- 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}&
- Circle of diameter 1 centered on $(0,0)$\\\hline
-\pl\tt green& color& \pageref{Dgreen}&
- Equivalent to {\tt (0,1,0)}\\\hline
-\pl\tt halfcircle& path& \pageref{Dhcirc}&
- Upper half of a circle of diameter 1\\\hline
-\pl\tt identity& transform& \pageref{Dident}&
- Identity transformation\\\hline
-\pl\tt in& numeric& \pageref{Din}&
- One inch in {\tt bp} units [72]\\\hline
-\pl\tt infinity& numeric& \pageref{Dinf}&
- Large positive value [4095.99998]\\\hline
-\pl\tt left& pair& \pageref{Dleft}&
- Leftward direction $(-1,0)$\\\hline
-\pl\tt mitered& numeric& \pageref{Dmitred}&
- {\tt linejoin} value for mitered joins [0]\\\hline
-\pl\tt mm& numeric& \pageref{Dmm}&
- 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& --&
- The pair $(0,0)$\\\hline
-\pl\tt pc& numeric& --&
- One pica in {\tt bp} units [11.95517]\\\hline
-\tt pencircle& pen& \pageref{Dpncirc}&
- Circular pen of diameter 1\\\hline
-\pl\tt pensquare& pen& \pageref{Dpnsqr}&
- square pen of height 1 and width 1\\\hline
-\pl\tt pt& numeric& \pageref{Dpt}&
- One printer's point in {\tt bp} units [0.99626]\\\hline
-\pl\tt quartercircle& path& --&
- First quadrant of a circle of diameter 1\\\hline
-\pl\tt red& color& \pageref{Dred}&
- Equivalent to {\tt (1,0,0)}\\\hline
-\pl\tt right& pair& \pageref{Dright}&
- Rightward direction $(1,0)$\\\hline
-\pl\tt rounded& numeric& \pageref{Drnded}&
- {\tt linecap} and {\tt linejoin} value for round joins\\
-\tt & & &
- and end caps [1]\\\hline
-\pl\tt squared& numeric& \pageref{Dsqred}&
- {\tt linecap} value for square end caps [2]\\\hline
-\tt true& boolean& \pageref{Dtrue}&
- The boolean value {\tt true}\\\hline
-\pl\tt unitsquare& path& --&
- The path \verb|(0,0)--(1,0)--(1,1)--(0,1)--cycle|\\\hline
-\pl\tt up& pair& \pageref{Dup}&
- Upward direction $(0,1)$\\\hline
-\pl\tt white& color& \pageref{Dwhite}&
- Equivalent to {\tt (1,1,1)}\\\hline
-\pl\tt withdots& picture& \pageref{Dwdots}&
- Dash pattern that produces dotted lines\\\hline
-\end{tabular}
-$$
-\label{consttab}%
-\index{cc?\texttt{cc}}\index{dd?\texttt{dd}}\index{ditto?\texttt{ditto}}\index{epsilon?\texttt{epsilon}}%
-\index{origin?\texttt{origin}}\index{pc?\texttt{pc}}\index{quartercircle?\texttt{quartercircle}}%
-\index{unitsquare?\texttt{unitsquare}}
-\end{table}
-
-
-\clearpage
-\LTXtable{\textwidth}{mpman-optab}
-
-\begin{table}[htp]
-\caption{Commands}
-$$\begin{tabular}{|l|r|l|}
-\hline
-\multicolumn1{|c}{Name}& \multicolumn1{|c}{Page}& \multicolumn1{|c|}{Explanation}\\
-\hline
-\hline
-\tt \verb|addto|& \pageref{sydraw}&
- Low-level command for drawing and filling\\\hline
-\tt \verb|clip|& \pageref{Dclip}&
- Applies a clipping path to a picture\\\hline
-\tt \verb|closefrom|& \pageref{Dclosefrom}&
- Close a file opened by {\tt readfrom}\\\hline
-\pl\tt \verb|cutdraw|& \pageref{Dctdraw}&
- Draw with butt end caps\\\hline
-\tt \verb|dashed|& \pageref{Ddashed}&
- Apply dash pattern to drawing command\\\hline
-\pl\tt \verb|draw|& \pageref{curves}&
- Draw a line or a picture\\\hline
-\pl\tt \verb|drawarrow|& \pageref{Ddrwarr}&
- 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}&
- Draw a cyclic path and fill inside it\\\hline
-\tt \verb|interim|& \pageref{Dinterm}&
- Make a local change to an internal variable\\\hline
-\tt \verb|let|& --&
- Assign one symbolic token the meaning of another\\\hline
-\pl\tt \verb|loggingall|& \pageref{Dlogall}&
- Turn on all tracing (log file only)\\\hline
-\tt \verb|newinternal|& \pageref{Dnewint}&
- Declare new internal variables\\\hline
-\pl\tt \verb|pickup|& \pageref{Dpickup}&
- Specify new pen for line drawing\\\hline
-\tt \verb|save|& \pageref{Dsave}&
- Make variables local\\\hline
-\tt \verb|setbounds|& \pageref{Dsetbnd}&
- Make a picture lie about its bounding box\\\hline
-\tt \verb|shipout|& \pageref{Dship}&
- Low-level command to output a figure\\\hline
-\tt \verb|show|& \pageref{Dshow}&
- print out expressions symbolically\\\hline
-\tt \verb|showdependencies|& \pageref{Dshdep}&
- print out all unsolved equations\\\hline
-\tt \verb|showtoken|& \pageref{Dshtok}&
- print an explanation of what a token is\\\hline
-\tt \verb|showvariable|& \pageref{Dshvar}&
- print variables symbolically\\\hline
-\tt \verb|special|& \pageref{Dspecl}&
- print a string directly in the PostScript output file\\\hline
-\pl\tt \verb|tracingall|& \pageref{Dtall}&
- Turn on all tracing\\\hline
-\pl\tt \verb|tracingnone|& \pageref{Dtnone}&
- Turn off all tracing\\\hline
-\pl\tt \verb|undraw|& \pageref{Dundraw}&
- Erase a line or a picture\\\hline
-\pl\tt \verb|unfill|& \pageref{Dunfill}&
- Erase inside a cyclic path\\\hline
-\pl\tt \verb|unfilldraw|& \pageref{Dunfdrw}&
- Erase a cyclic path and its inside\\\hline
-\tt \verb|withcmykcolor|& \pageref{Dwithcmykcolor}&
- Apply CMYK color to drawing command\\\hline
-\tt \verb|withcolor|& \pageref{Dwithcolor}&
- Apply generic color specification to drawing command\\\hline
-\tt \verb|withgreyscale|& \pageref{Dwithgreyscale}&
- Apply greyscale color to drawing command\\\hline
-\tt \verb|withoutcolor|& \pageref{Dwithoutcolor}&
- Don't apply any color specification to drawing command\\\hline
-\tt \verb|withpen|& \pageref{sec.pens}&
- Apply pen to drawing operation\\\hline
-\tt \verb|withpostscript|& \pageref{Dwithpost}&
- End raw PostScript code\\\hline
-\tt \verb|withprescript|& \pageref{Dwithpre}&
- Begin raw PostScript code\\\hline
-\tt \verb|withrgbcolor|& \pageref{Dwithrgbcolor}&
- Apply RGB color to drawing command\\\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|}
-\hline
-\multicolumn1{|c}{Name}& \multicolumn1{|c}{Arguments}&
- \multicolumn1{|c}{Result}& \multicolumn1{|c}{Page}&
- \multicolumn1{|c|}{Explanation}\\
-\hline
-\hline
-\pl\tt \verb|buildcycle|& list of paths& path& \pageref{buildcy}&
- Build a cyclic path\\\hline
-\pl\tt \verb|dashpattern|& on/off distances& picture& \pageref{Ddshpat}&
- Create a pattern for dashed lines\\\hline
-\pl\tt \verb|decr|& numeric variable& numeric& \pageref{Dincr}&
- Decrement and return new value\\\hline
-\pl\tt \verb|dotlabel|& suffix, picture, pair& --& \pageref{Ddotlab}&
- Mark point and draw picture nearby\\\hline
-\pl\tt \verb|dotlabel|& suffix, string, pair& --& \pageref{Ddotlab}&
- Mark point and place text nearby\\\hline
-\pl\tt \verb|dotlabels|& suffix, point numbers& --& \pageref{Ddotlbs}&
- Mark {\tt z} points with their numbers\\\hline
-\pl\tt \verb|drawdot|& pair& --& \pageref{Ddrawdot}&
- Draw a dot at the given point\\\hline
-\pl\tt \verb|drawoptions|& drawing options& --& \pageref{Ddropts}&
- Set options for drawing commands\\\hline
-\pl\tt \verb|image|& string& picture& \pageref{Dimage}&
- Return picture from text\\\hline
-\pl\tt \verb|incr|& numeric variable& numeric& \pageref{Dincr}&
- Increment and return new value\\\hline
-\pl\tt \verb|label|& suffix, picture, pair& --& \pageref{Dlabel}&
- Draw picture near given point\\\hline
-\pl\tt \verb|label|& suffix, string, pair& --& \pageref{Dlabel}&
- Place text near given point\\\hline
-\pl\tt \verb|labels|& suffix, point numbers& --& \pageref{Dlabels}&
- Draw {\tt z} point numbers; no dots\\\hline
-\pl\tt \verb|max|& list of numerics& numeric& --&
- Find the maximum\\\hline
-\pl\tt \verb|max|& list of strings& string& --&
- Find the lexicographically last string\\\hline
-\pl\tt \verb|min|& list of numerics& numeric& --&
- Find the minimum\\\hline
-\pl\tt \verb|min|& list of strings& string& --&
- Find the lexicographically first string\\\hline
-\pl\tt \verb|thelabel|& suffix, picture, pair& picture& \pageref{Dthelab}&
- Picture shifted as if to label a point\\\hline
-\pl\tt \verb|thelabel|& suffix, string, pair& picture& \pageref{Dthelab}&
- Text positioned as if to label a point\\\hline
-\pl\tt \verb|z|& suffix& pair& \pageref{Dzconv}&
- The pair ${\tt x}\descr{suffix},{\tt y}\descr{suffix})$\\\hline
-\end{tabular}
-$$
-\index{min?\texttt{min}}\index{max?\texttt{max}}%
-\label{pseudotab}
-\end{table}
-
-\clearpage
-
-\begin{figure}[htp]
-\begin{ctabbing}
-$\tt \descr{atom} \rightarrow \descr{variable} \;|\; \descr{argument}$\\
-$\tt \qquad \;|\; \descr{number or fraction}$\\
-$\tt \qquad \;|\; \descr{internal variable}$\\
-$\tt \qquad \;|\; \hbox{\tt (}\descr{expression}\hbox{\tt )}$\\
-$\tt \qquad \;|\; begingroup \descr{statement list} \descr{expression} endgroup$\\
-$\tt \qquad \;|\; \descr{nullary op}$\\
-$\tt \qquad \;|\; btex \descr{typesetting commands} etex$\\
-$\tt \qquad \;|\; \descr{pseudo function}$\\
-$\tt \descr{primary} \rightarrow \descr{atom}$\\
-$\tt \qquad \;|\; \hbox{\tt (}\descr{numeric expression}\hbox{\tt ,} \descr{numeric expression}\hbox{\tt )}$\\
-$\tt \qquad \;|\; \hbox{\tt (}\descr{numeric expression}\hbox{\tt ,} \descr{numeric expression}\hbox{\tt ,} \descr{numeric expression}\hbox{\tt )}$\\
-$\tt \qquad \;|\; \descr{of operator} \descr{expression} of \descr{primary}$\\
-$\tt \qquad \;|\; \descr{unary op} \descr{primary}$\\
-$\tt \qquad \;|\; str \descr{suffix}$\\
-$\tt \qquad \;|\; z \descr{suffix}$\\
-$\tt \qquad \;|\; \descr{numeric atom}\hbox{\tt [}\descr{expression}\hbox{\tt ,}\descr{expression}\hbox{\tt ]}$\\
-$\tt \qquad \;|\; \descr{scalar multiplication op} \descr{primary}$\\
-$\tt \descr{secondary} \rightarrow \descr{primary}$\\
-$\tt \qquad \;|\; \descr{secondary} \descr{primary binop} \descr{primary}$\\
-$\tt \qquad \;|\; \descr{secondary} \descr{transformer}$\\
-$\tt \descr{tertiary} \rightarrow \descr{secondary}$\\
-$\tt \qquad \;|\; \descr{tertiary} \descr{secondary binop} \descr{secondary}$\\
-$\tt \descr{subexpression} \rightarrow \descr{tertiary}$\\
-$\tt \qquad \;|\; \descr{path expression} \descr{path join} \descr{path knot}$\\
-$\tt \descr{expression} \rightarrow \descr{subexpression}$\\
-$\tt \qquad \;|\; \descr{expression} \descr{tertiary binop} \descr{tertiary}$\\
-$\tt \qquad \;|\; \descr{path subexpression} \descr{direction specifier}$\\
-$\tt \qquad \;|\; \descr{path subexpression} \descr{path join} cycle$\\
-$\tt $\\
-$\tt \descr{path knot} \rightarrow \descr{tertiary}$\\
-$\tt \descr{path join} \rightarrow \verb|--|$\\
-$\tt \qquad \;|\; \descr{direction specifier} \descr{basic path join} \descr{direction specifier}$\\
-$\tt \descr{direction specifier} \rightarrow \descr{empty}$\\
-$\tt \qquad \;|\; \verb|{|curl \descr{numeric expression}\verb|}|$\\
-$\tt \qquad \;|\; \verb|{|\descr{pair expression}\verb|}|$\\
-$\tt \qquad \;|\; \verb|{|\descr{numeric expression}\hbox{\tt ,}\descr{numeric expression}\verb|}|$\\
-$\tt \descr{basic path join} \rightarrow \hbox{\tt ..} \;|\; \hbox{\tt ...} \;|\; \hbox{\tt ..}\descr{tension}\hbox{\tt ..} \;|\; \hbox{\tt ..}\descr{controls}\hbox{\tt ..}$\\
-$\tt \descr{tension} \rightarrow tension \descr{numeric primary}$\\
-$\tt \qquad \;|\; tension \descr{numeric primary} and \descr{numeric primary}$\\
-$\tt \descr{controls} \rightarrow controls \descr{pair primary}$\\
-$\tt \qquad \;|\; controls \descr{pair primary} and \descr{pair primary}$\\
-$\tt $\\
-$\tt \descr{argument} \rightarrow \descr{symbolic token}$\\
-$\tt \descr{number or fraction} \rightarrow \descr{number}\hbox{\tt /}\descr{number}$\\
-$\tt \qquad \;|\; \descr{number not followed by `\hbox{\tt /}\tdescr{number}'}$\\
-$\tt \descr{scalar multiplication op} \rightarrow + \;|\; -$\\
-$\tt \qquad \;|\; \descr{`\tdescr{number or fraction}' not followed by `\tdescr{add op}\tdescr{number}'}$
-\end{ctabbing}
-\caption{Part 1 of the syntax for expressions}
-\index{expression?\tdescr{expression}}\index{nullary op?\tdescr{nullary op}}\index{of operator?\tdescr{of operator}}%
-\index{path knot?\tdescr{path knot}}\index{primary?\tdescr{primary}}\index{primary binop?\tdescr{primary binop}}%
-\index{secondary?\tdescr{secondary}}\index{secondary binop?\tdescr{secondary binop}}\index{suffix?\tdescr{suffix}}%
-\index{tertiary?\tdescr{tertiary}}\index{tertiary binop?\tdescr{tertiary binop}}\index{unary op?\tdescr{unary op}}%
-\label{syexpr1}
-\end{figure}
-
-\begin{figure}[htp]
-\begin{ctabbing}
-$\tt \descr{transformer} \rightarrow rotated \descr{numeric primary}$\\
-$\tt \qquad \;|\; scaled \descr{numeric primary}$\\
-$\tt \qquad \;|\; shifted \descr{pair primary}$\\
-$\tt \qquad \;|\; slanted \descr{numeric primary}$\\
-$\tt \qquad \;|\; transformed \descr{transform primary}$\\
-$\tt \qquad \;|\; xscaled \descr{numeric primary}$\\
-$\tt \qquad \;|\; yscaled \descr{numeric primary}$\\
-$\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 \;|\; nullpen \;|\; nullpicture \;|\; pencircle$\\
-$\tt \qquad \;|\; true \;|\; whatever$\\
-$\tt \descr{unary op} \rightarrow \descr{type}$\\
-$\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 \;|\; 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 \;|\; 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$\\
-$\tt \qquad \;|\; intersectionpoint \;|\; intersectiontimes$\\
-$\tt \descr{tertiary binop} \rightarrow \hbox{\tt \&} \;|\; \hbox{\verb|<|} \;|\; \hbox{\verb|<=|} \;|\; \hbox{\verb|<>|} \;|\; \hbox{\tt =} \;|\; \hbox{\verb|>|} \;|\; \hbox{\verb|>=|}$\\
-$\tt \qquad \;|\; cutafter \;|\; cutbefore$\\
-$\tt \descr{of operator} \rightarrow arctime \;|\; direction \;|\; directiontime \;|\; directionpoint$\\
-$\tt \qquad \;|\; penoffset \;|\; point \;|\; postcontrol \;|\; precontrol \;|\; subpath$\\
-$\tt \qquad \;|\; substring$\\
-$\tt $\\
-$\tt \descr{variable} \rightarrow \descr{tag}\descr{suffix}$\\
-$\tt \descr{suffix} \rightarrow \descr{empty} \;|\; \descr{suffix}\descr{subscript} \;|\; \descr{suffix}\descr{tag}$\\
-$\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 \;|\; 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$\\
-$\tt \qquad \;|\; tracingstats \;|\; tracingtitles \;|\; truecorners$\\
-$\tt \qquad \;|\; warningcheck \;|\; year$\\
-$\tt \qquad \;|\; \descr{symbolic token defined by {\tt newinternal}}$
-\end{ctabbing}
-\caption{Part 2 of the syntax for expressions}
-\index{nullary op?\tdescr{nullary op}}\index{of operator?\tdescr{of operator}}\index{primary binop?\tdescr{primary binop}}%
-\index{secondary binop?\tdescr{secondary binop}}\index{subscript?\tdescr{subscript}}\index{suffix?\tdescr{suffix}}%
-\index{tertiary binop?\tdescr{tertiary binop}}\index{unary op?\tdescr{unary op}}%
-\label{syexpr2}
-\end{figure}
-
-\begin{figure}[htp]
-\begin{ctabbing}
-$\tt \descr{pseudo function} \rightarrow min\hbox{\tt (}\descr{expression list}\hbox{\tt )}$\\
-$\tt \qquad \;|\; max\hbox{\tt (}\descr{expression list}\hbox{\tt )}$\\
-$\tt \qquad \;|\; incr\hbox{\tt (}\descr{numeric variable}\hbox{\tt )}$\\
-$\tt \qquad \;|\; decr\hbox{\tt (}\descr{numeric variable}\hbox{\tt )}$\\
-$\tt \qquad \;|\; dashpattern\hbox{\tt (}\descr{on\hbox{\tt /}off list}\hbox{\tt )}$\\
-$\tt \qquad \;|\; interpath\hbox{\tt (}\descr{numeric expression}\hbox{\tt ,} \descr{path expression}\hbox{\tt ,} \descr{path expression}\hbox{\tt )}$\\
-$\tt \qquad \;|\; buildcycle\hbox{\tt (}\descr{path expression list}\hbox{\tt )}$\\
-$\tt \qquad \;|\; thelabel\descr{label suffix}\hbox{\tt (}\descr{expression}\hbox{\tt ,} \descr{pair expression}\hbox{\tt )}$\\
-$\tt \descr{path expression list} \rightarrow \descr{path expression}$\\
-$\tt \qquad \;|\; \descr{path expression list}\hbox{\tt ,} \descr{path expression}$\\
-$\tt \descr{on\hbox{\tt /}off list} \rightarrow \descr{on\hbox{\tt /}off list}\descr{on\hbox{\tt /}off clause} \;|\; \descr{on\hbox{\tt /}off clause}$\\
-$\tt \descr{on\hbox{\tt /}off clause} \rightarrow on \descr{numeric tertiary} \;|\; off \descr{numeric tertiary}$
-\end{ctabbing}
-\caption{The syntax for function-like macros}
-\index{label suffix?\tdescr{label suffix}}%
-\label{sypseudo}
-\end{figure}
-
-\begin{figure}[htp]
-\begin{ctabbing}
-$\tt \descr{boolean expression} \rightarrow \descr{expression}$\\
-$\tt \descr{cmykcolor expression} \rightarrow \descr{expression}$\\
-$\tt \descr{color expression} \rightarrow \descr{expression}$\\
-$\tt \descr{numeric atom} \rightarrow \descr{atom}$\\
-$\tt \descr{numeric expression} \rightarrow \descr{expression}$\\
-$\tt \descr{numeric primary} \rightarrow \descr{primary}$\\
-$\tt \descr{numeric tertiary} \rightarrow \descr{tertiary}$\\
-$\tt \descr{numeric variable} \rightarrow \descr{variable} \;|\; \descr{internal variable}$\\
-$\tt \descr{pair expression} \rightarrow \descr{expression}$\\
-$\tt \descr{pair primary} \rightarrow \descr{primary}$\\
-$\tt \descr{path expression} \rightarrow \descr{expression}$\\
-$\tt \descr{path subexpression} \rightarrow \descr{subexpression}$\\
-$\tt \descr{pen expression} \rightarrow \descr{expression}$\\
-$\tt \descr{picture expression} \rightarrow \descr{expression}$\\
-$\tt \descr{picture variable} \rightarrow \descr{variable}$\\
-$\tt \descr{rgbcolor expression} \rightarrow \descr{expression}$\\
-$\tt \descr{string expression} \rightarrow \descr{expression}$\\
-$\tt \descr{suffix parameter} \rightarrow \descr{parameter}$\\
-$\tt \descr{transform primary} \rightarrow \descr{primary}$
-\end{ctabbing}
-\caption{Miscellaneous productions needed to complete the BNF}
-\label{sytypexpr}
-\end{figure}
-
-\begin{figure}[htp]
-\begin{ctabbing}
-$\tt \descr{program} \rightarrow \descr{statement list} end$\\
-$\tt \descr{statement list} \rightarrow \descr{empty} \;|\; \descr{statement list} \hbox{\tt ;} \descr{statement}$\\
-$\tt \descr{statement} \rightarrow \descr{empty}$\\
-$\tt \qquad \;|\; \descr{equation} \;|\; \descr{assignment}$\\
-$\tt \qquad \;|\; \descr{declaration} \;|\; \descr{macro definition}$\\
-$\tt \qquad \;|\; \descr{compound} \;|\; \descr{pseudo procedure}$\\
-$\tt \qquad \;|\; \descr{command}$\\
-$\tt \descr{compound} \rightarrow begingroup \descr{statement list} endgroup$\\
-$\tt \qquad \;|\; beginfig\hbox{\tt (}\descr{numeric expression}\hbox{\tt );} \descr{statement list}\hbox{\tt ;} endfig$\\
-$\tt $\\
-$\tt \descr{equation} \rightarrow \descr{expression} \hbox{\tt =} \descr{right-hand side}$\\
-$\tt \descr{assignment} \rightarrow \descr{variable} \hbox{\tt :=} \descr{right-hand side}$\\
-$\tt \qquad \;|\; \descr{internal variable} \hbox{\tt :=} \descr{right-hand side}$\\
-$\tt \descr{right-hand side} \rightarrow \descr{expression} \;|\; \descr{equation} \;|\; \descr{assignment}$\\
-$\tt $\\
-$\tt \descr{declaration} \rightarrow \descr{type} \descr{declaration list}$\\
-$\tt \descr{declaration list} \rightarrow \descr{generic variable}$\\
-$\tt \qquad \;|\; \descr{declaration list}\hbox{\tt ,} \descr{generic variable}$\\
-$\tt \descr{generic variable} \rightarrow \descr{symbolic token} \descr{generic suffix}$\\
-$\tt \descr{generic suffix} \rightarrow \descr{empty} \;|\; \descr{generic suffix} \descr{tag}$\\
-$\tt \qquad \;|\; \descr{generic suffix} \hbox{\tt []}$\\
-$\tt $\\
-$\tt \descr{macro definition} \rightarrow \descr{macro heading} \hbox{\tt =} \descr{replacement text} enddef$\\
-$\tt \descr{macro heading} \rightarrow def \descr{symbolic token} \descr{delimited part} \descr{undelimited part}$\\
-$\tt \qquad \;|\; vardef \descr{generic variable} \descr{delimited part} \descr{undelimited part}$\\
-$\tt \qquad \;|\; vardef \descr{generic variable} \hbox{\verb|@#|} \descr{delimited part} \descr{undelimited part}$\\
-$\tt \qquad \;|\; \descr{binary def} \descr{parameter} \descr{symbolic token} \descr{parameter}$\\
-$\tt \descr{delimited part} \rightarrow \descr{empty}$\\
-$\tt \qquad \;|\; \descr{delimited part}\hbox{\tt (}\descr{parameter type} \descr{parameter tokens}\hbox{\tt )}$\\
-$\tt \descr{parameter type} \rightarrow expr \;|\; suffix \;|\; text$\\
-$\tt \descr{parameter tokens} \rightarrow \descr{parameter} \;|\; \descr{parameter tokens}\hbox{\tt ,} \descr{parameter}$\\
-$\tt \descr{parameter} \rightarrow \descr{symbolic token}$\\
-$\tt \descr{undelimited part} \rightarrow \descr{empty}$\\
-$\tt \qquad \;|\; \descr{parameter type} \descr{parameter}$\\
-$\tt \qquad \;|\; \descr{precedence level} \descr{parameter}$\\
-$\tt \qquad \;|\; expr \descr{parameter} of \descr{parameter}$\\
-$\tt \descr{precedence level} \rightarrow primary \;|\; secondary \;|\; tertiary$\\
-$\tt \descr{binary def} \rightarrow primarydef \;|\; secondarydef \;|\; tertiarydef$\\
-$\tt $\\
-$\tt \descr{pseudo procedure} \rightarrow drawoptions\hbox{\tt (}\descr{option list}\hbox{\tt )}$\\
-$\tt \qquad \;|\; label\descr{label suffix}\hbox{\tt (}\descr{expression}\hbox{\tt ,} \descr{pair expression}\hbox{\tt )}$\\
-$\tt \qquad \;|\; dotlabel\descr{label suffix}\hbox{\tt (}\descr{expression}\hbox{\tt ,} \descr{pair expression}\hbox{\tt )}$\\
-$\tt \qquad \;|\; labels\descr{label suffix}\hbox{\tt (}\descr{point number list}\hbox{\tt )}$\\
-$\tt \qquad \;|\; dotlabels\descr{label suffix}\hbox{\tt (}\descr{point number list}\hbox{\tt )}$\\
-$\tt \descr{point number list} \rightarrow \descr{suffix} \;|\; \descr{point number list}\hbox{\tt ,} \descr{suffix}$\\
-$\tt \descr{label suffix} \rightarrow \descr{empty} \;|\; lft \;|\; rt \;|\; top \;|\; bot \;|\; ulft \;|\; urt \;|\; llft \;|\; lrt$
-\end{ctabbing}
-\caption{Overall syntax for MetaPost programs}
-\index{generic variable?\tdescr{generic variable}}\index{label suffix?\tdescr{label suffix}}\index{replacement text?\tdescr{replacement text}}%
-\index{suffix?\tdescr{suffix}}%
-\label{syprog}
-\end{figure}
-
-\begin{figure}[htp]
-\begin{ctabbing}
-$\tt \descr{command} \rightarrow clip \descr{picture variable} to \descr{path expression}$\\
-$\tt \qquad \;|\; interim \descr{internal variable} \hbox{\tt :=} \descr{right-hand side}$\\
-$\tt \qquad \;|\; let \descr{symbolic token} \hbox{\tt =} \descr{symbolic token}$\\
-$\tt \qquad \;|\; newinternal \descr{symbolic token list}$\\
-$\tt \qquad \;|\; pickup \descr{expression}$\\
-$\tt \qquad \;|\; randomseed \hbox{\tt :=} \descr{numeric expression}$\\
-$\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 $\\
-$\tt \descr{show command} \rightarrow show \descr{expression list}$\\
-$\tt \qquad \;|\; showvariable \descr{symbolic token list}$\\
-$\tt \qquad \;|\; showtoken \descr{symbolic token list}$\\
-$\tt \qquad \;|\; showdependencies$\\
-$\tt $\\
-$\tt \descr{symbolic token list} \rightarrow \descr{symbolic token}$\\
-$\tt \qquad \;|\; \descr{symbolic token}\hbox{\tt ,} \descr{symbolic token list}$\\
-$\tt \descr{expression list} \rightarrow \descr{expression} \;|\; \descr{expression list}\hbox{\tt ,} \descr{expression}$\\
-$\tt $\\
-$\tt \descr{addto command} \rightarrow$\\
-$\tt \qquad addto \descr{picture variable} also \descr{picture expression} \descr{option list}$\\
-$\tt \qquad \;|\; addto \descr{picture variable} contour \descr{path expression} \descr{option list}$\\
-$\tt \qquad \;|\; addto \descr{picture variable} doublepath \descr{path expression} \descr{option list}$\\
-$\tt \descr{option list} \rightarrow \descr{empty} \;|\; \descr{drawing option} \descr{option list}$\\
-$\tt \descr{drawing option} \rightarrow withcolor \descr{color expression}$\\
-$\tt \qquad \;|\; withrgbcolor \descr{rgbcolor expression} \;|\; withcmykcolor \descr{cmykcolor expression}$\\
-$\tt \qquad \;|\; withgreyscale \descr{numeric expression} \;|\; withoutcolor$\\
-$\tt \qquad \;|\; withprescript \descr{string expression} \;|\; withpostscript \descr{string expression}$\\
-$\tt \qquad \;|\; withpen \descr{pen expression} \;|\; dashed \descr{picture expression}$\\
-$\tt $\\
-$\tt \descr{drawing command} \rightarrow draw \descr{picture expression} \descr{option list}$\\
-$\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}
-\index{option list?\tdescr{option list}}\index{picture variable?\tdescr{picture variable}}%
-\label{sycmds}
-
-% is this really true? in practice, in real implementations?
-%\bigskip
-%By the way, the default for \ttindex{randomseed} is, in effect,
-%$\textsl{day} + \textsl{time}*\epsilon$. Unfortunately, \textsl{time}
-%is in minutes.
-\end{figure}
-
-\begin{figure}[htp]
-\begin{ctabbing}
-$\tt \descr{if test} \rightarrow if \descr{boolean expression} \hbox{\tt :} \descr{balanced tokens} \descr{alternatives} fi$\\
-$\tt \descr{alternatives} \rightarrow \descr{empty}$\\
-$\tt \qquad \;|\; else\hbox{\tt :} \descr{balanced tokens}$\\
-$\tt \qquad \;|\; elseif \descr{boolean expression} \hbox{\tt :} \descr{balanced tokens} \descr{alternatives}$\\
-$\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}$\\
-$\tt \qquad \;|\; \descr{numeric expression} downto \descr{numeric expression}$\\
-$\tt \qquad \;|\; \descr{numeric expression} step \descr{numeric expression} until \descr{numeric expression} $\\
-$\tt \descr{for list} \rightarrow \descr{expression} \;|\; \descr{for list}\hbox{\tt ,} \descr{expression}$\\
-$\tt \descr{suffix list} \rightarrow \descr{suffix} \;|\; \descr{suffix list}\hbox{\tt ,} \descr{suffix}$
-\end{ctabbing}
-\caption{The syntax for conditionals and loops}
-\index{balanced tokens?\tdescr{balanced tokens}}\index{suffix?\tdescr{suffix}}%
-\label{sycondloop}
-\end{figure}
-
-\clearpage
-
-\let\topfraction=\svtopfrac % restore values from the start of this appendix
-\let\textfraction=\svtxtfrac
-\setcounter{topnumber}{\value{svtopnum}}
-\setcounter{totalnumber}{\value{svtotnum}}
-
-
-\section{MetaPost Versus \MF}
-\label{MPvsMF}
-
-Since the \MF\index{metafont?\MF} and MetaPost languages have so much in
-common, expert users of \MF\ will want to skip most of the explanations
-in this document and concentrate on concepts that are unique to
-MetaPost. The comparisons in this appendix are intended to help experts
-that are familiar with {\sl The\ \MF book} as well as other users that
-want to benefit from Knuth's more detailed explanations \cite{kn:c}.
-
-Since \MF\ is intended for making \TeX\ fonts, it has a number of
-primitives for generating the {\tt tfm}\index{tfm file?{\tt tfm}
-file}\index{files!tfm?{\tt tfm}} files that \TeX\ needs for character
-dimensions, spacing information, ligatures\index{ligatures} and
-kerning\index{kerning}. MetaPost can also be used for generating fonts,
-and it also has \MF's primitives for making {\tt tfm} files. These are
-listed in Table~\ref{tfmprim}. Explanations can be found in the \MF\
-documentation \cite{kn:c,kn:mf3}.
-
-\begin{table}[htp]
-$$\begin{tabular}{|l|l|} \hline
-commands& {\tt charlist}, {\tt extensible},
- {\tt fontdimen}, {\tt headerbyte} \\
- & {\tt kern}, {\tt ligtable} \\ \hline
-ligtable operators& \verb!::!, \verb!=:!, \verb!=:|!, \verb!=:|>!,
- \verb!|=:!, \verb!|=:>!, \\
- & \verb!|=:|!, \verb!|=:|>!, \verb!|=:|>>!,
- \verb!||:! \\ \hline
-internal variables\index{internal variables}\index{variables!internal}&
- {\tt boundarychar}, {\tt chardp},
- {\tt charext}, {\tt charht}, \\
- & {\tt charic}, {\tt charwd},
- {\tt designsize}, {\tt fontmaking} \\ \hline
-other operators& {\tt charexists} \\ \hline
-\end{tabular}
-$$
-\caption{MetaPost primitives for making {\tt tfm} files.}
-\label{tfmprim}
-\end{table}
-
-Even though MetaPost has the primitives for generating fonts, many of
-the font-making primitives and internal variables that are part of Plain
-\MF\index{metafont?\MF} are not defined in Plain MetaPost\index{Plain
-macros}. Instead, there is a separate macro package called {\tt
-mfplain}\index{mfplain?\texttt{mfplain}} that defines the macros
-required to allow MetaPost to process Knuth's Computer Modern fonts as
-shown in Table~\ref{mfponly} \cite{kn:e}. To load these macros, put
-``\verb|&mfplain|'' before the name of the input file. This can be done
-at the {\tt **} prompt after invoking the MetaPost interpreter with no
-arguments, or on a command line that looks something like
-this:\footnote{Command line syntax is system dependent. Quotes are
-needed on most Unix systems to protect special characters like
-{\tt\&}.}
-$$ \hbox{\verb|mpost '&mfplain' cmr10|} $$
-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\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]
-$$
-\renewcommand{\FancyVerbFormatLine}[1]{\hbox{#1}\strut}
-\begin{tabular}{|l|} \hline
-\multicolumn 1{|c|}
-{Defined in the {\tt mfplain} package} \\ \hline
-\begin{verbatim}
-beginchar font_identifier
-blacker font_normal_shrink
-capsule_def font_normal_space
-change_width font_normal_stretch
-define_blacker_pixels font_quad
-define_corrected_pixels font_size
-define_good_x_pixels font_slant
-define_good_y_pixels font_x_height
-define_horizontal_corrected_pixels italcorr
-define_pixels labelfont
-define_whole_blacker_pixels makebox
-define_whole_pixels makegrid
-define_whole_vertical_blacker_pixels maketicks
-define_whole_vertical_pixels mode_def
-endchar mode_setup
-extra_beginchar o_correction
-extra_endchar proofrule
-extra_setup proofrulethickness
-font_coding_scheme rulepen
-font_extra_space smode
-\end{verbatim}
- \\ \hline
-\multicolumn 1{|c|}
-{Defined as no-ops in the {\tt mfplain} package}\\ \hline
-\begin{verbatim}
-cullit proofoffset
-currenttransform screenchars
-gfcorners screenrule
-grayfont screenstrokes
-hround showit
-imagerules slantfont
-lowres_fix titlefont
-nodisplays unitpixel
-notransforms vround
-openit
-\end{verbatim}
- \\ \hline
-\end{tabular}
-\renewcommand{\FancyVerbFormatLine}[1]{#1}
-$$
-\caption{Macros and internal variables defined only in the {\tt mfplain}
-package.}
-\label{mfponly}
-\end{table}
-
-Another limitation of the {\tt mfplain} package is that certain internal
-variables from Plain \MF\index{metafont?\MF} cannot be given reasonable
-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\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
-that \MF\ primitive commands {\tt cull}, {\tt display}, {\tt
-openwindow}, {\tt numspecial} and {\tt totalweight} are not implemented
-in MetaPost. Also not implemented are a number of internal variables as
-well as the \tdescr{drawing option} {\tt withweight}. Here is a
-complete listing of the internal variables whose primitive meanings in
-\MF\ do not make sense in MetaPost:
-$$\begin{verbatim}
-autorounding fillin proofing tracingpens xoffset
-chardx granularity smoothing turningcheck yoffset
-chardy hppp tracingedges vppp
-\end{verbatim}
-$$
-
-There is also one \MF\ primitive that has a slightly different meaning in
-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\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
-commands listed in this table that the preceding sections do not discuss
-are
-\verb|extra_beginfig|\index{extra_beginfig?\texttt{extra\_beginfig}}\label{Dxbfig},
-\verb|extra_endfig|\index{extra_endfig?\texttt{extra\_endfig}}\label{Dxefig},
-and {\tt mpxbreak}. The first two are strings that contain extra
-commands to be processed by {\tt
-beginfig}\index{beginfig?\texttt{beginfig}} and {\tt
-endfig}\index{endfig?\texttt{endfig}} just as \verb|extra_beginchar| and
-\verb|extra_endchar| are processed by {\tt beginchar} and {\tt endchar}.
-(The file {\tt boxes.mp}\index{boxes.mp?\texttt{boxes.mp}} uses these
-features).
-
-The other new feature listed in Table~\ref{mponly} not listed in the
-index is {\tt mpxbreak}\index{mpxbreak?\texttt{mpxbreak}}. This is used
-to separate blocks of translated \TeX\index{TeX?\TeX} or
-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}
-\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\\
-closefrom\\
-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\\
-colorpart\\
-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}
-\caption{Macros and internal variables defined in MetaPost but not \MF.}
-\label{mponly}
-\end{table}
+\include{mpman-app-refman}
+\include{mpman-app-legacy}
\bibliographystyle{plain}
@@ -5981,3 +5281,9 @@ white
% - I request that it remain clear that I am the author of
% "A User's Manual for MetaPost" and "Drawing Graphs with MetaPost".
% - I request to be consulted before significant changes are made.
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-PDF-mode: t
+%%% TeX-master: t
+%%% End: