summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/generic/mfpic/README115
-rw-r--r--Master/texmf-dist/doc/generic/mfpic/changes.txt303
-rw-r--r--Master/texmf-dist/doc/generic/mfpic/examples/data.dat2
-rw-r--r--Master/texmf-dist/doc/generic/mfpic/examples/forfun.tex4
-rw-r--r--Master/texmf-dist/doc/generic/mfpic/examples/lapictures.tex10
-rw-r--r--Master/texmf-dist/doc/generic/mfpic/examples/pictures.tex8
-rw-r--r--Master/texmf-dist/doc/generic/mfpic/install.txt184
-rw-r--r--Master/texmf-dist/doc/generic/mfpic/lcheadings.ist9
-rw-r--r--Master/texmf-dist/doc/generic/mfpic/mfpcard.pdfbin145233 -> 145519 bytes
-rw-r--r--Master/texmf-dist/doc/generic/mfpic/mfpcard.tex15
-rw-r--r--Master/texmf-dist/doc/generic/mfpic/mfpdoc.sty56
-rw-r--r--Master/texmf-dist/doc/generic/mfpic/mfpguide.pdfbin346088 -> 344598 bytes
-rw-r--r--Master/texmf-dist/doc/generic/mfpic/mfpguide.tex60
-rw-r--r--Master/texmf-dist/doc/generic/mfpic/mfpic-doc.pdfbin536239 -> 558198 bytes
-rw-r--r--Master/texmf-dist/doc/generic/mfpic/mfpic-doc.tex777
-rw-r--r--Master/texmf-dist/metafont/mfpic/grafbase.mf483
-rw-r--r--Master/texmf-dist/metapost/mfpic/dvipsnam.mp2
-rw-r--r--Master/texmf-dist/metapost/mfpic/grafbase.mp504
-rw-r--r--Master/texmf-dist/source/generic/mfpic/grafbase.dtx1211
-rw-r--r--Master/texmf-dist/source/generic/mfpic/mfpic.dtx525
-rw-r--r--Master/texmf-dist/source/generic/mfpic/mfpic.ins11
-rw-r--r--Master/texmf-dist/tex/generic/mfpic/mfpic.sty4
-rw-r--r--Master/texmf-dist/tex/generic/mfpic/mfpic.tex173
-rw-r--r--Master/texmf-dist/tex/generic/mfpic/mfpicdef.tex39
24 files changed, 3286 insertions, 1209 deletions
diff --git a/Master/texmf-dist/doc/generic/mfpic/README b/Master/texmf-dist/doc/generic/mfpic/README
index e7da761bce3..fcc76efe00c 100644
--- a/Master/texmf-dist/doc/generic/mfpic/README
+++ b/Master/texmf-dist/doc/generic/mfpic/README
@@ -1,29 +1,28 @@
% File: README
-% A part of mfpic 1.06 2011/03/08
+% A part of mfpic 1.10 2012/11/13
%
-MFpic defines a command group \mfpic...\endmfpic (optionally in LaTeX,
-an environment mfpic) and drawing commands to be used inside this group.
+MFpic defines a command group \mfpic...\endmfpic (optionally in LaTeX
+an environment, mfpic) and drawing commands to be used inside this group.
When TeX (or LaTeX) is run on a file containing those commands, a
MetaPost (or Metafont) source file is created. When that file is correctly
processed by MetaPost (or Metafont), and LaTeX or TeX is run again, the
result is a figure in the TeX document at the location of each
environment.
-See install.txt for initial setup and brief installation instructions.
-See mfpguide.pdf for a short tutorial. See below for a summary of
-features added since the previous major release (1.00). See the manual
-mfpic-doc.pdf for more detailed instructions and descriptions of
-features.
+See install.txt for installation instructions. See mfpguide.pdf for a
+short tutorial. See below for a summary of features added since the
+previous major release (1.0). See the manual mfpic-doc.pdf for more
+detailed instructions and descriptions of features.
-This is mfpic version 1.06.
+This is mfpic version 1.10
LICENSE
-------
All files of the core mfpic distribution (listed below) may be
distributed and/or modified under the conditions of the LaTeX Project
Public License, either version 1.3c of this license or (at your option)
-any later version. The latest version of this license is in
+any later version. The latest version of this license is
http://www.latex-project.org/lppl.txt
@@ -39,63 +38,66 @@ MANIFEST
--------
Here is a list, plus explanation of purpose, of all files in the mfpic
distribution. Read it *before* trying to process any of the example
-files. These, and the files generated by running tex on mfpic.ins,
-constitute the mfpic distribution to which the LPPL applies.
+files. These files constitute the mfpic distribution to which the LPPL
+applies.
-The five files marked with + below are the only ones essential to using
-all the facilities of mfpic. The three files marked with * below are
+The six files marked with "+" below are the only ones essential to using
+all the facilities of mfpic. The three files marked with "*" below are
sufficient to generate those essential files.
-The mfpic reference manual is mfpic-doc.pdf. A tutorial is available in
-mfpguide.pdf.
+All the *.tex files in the doc directory (except the plain TeX file
+mfpcard.tex) require the LaTeX style file mfpdoc.sty. The mfpic manual
+is mfpic-doc.pdf. A tutorial is available in mfpguide.pdf.
-Source files:
+The directory names given below are subdirectories of graphics/mfpic/ in
+your nearest CTAN mirror (go to http://mirror.ctan.org/)
+
+Source files (in source/):
------------
-* mfpic.dtx Contains mfpic.sty and mfpic.tex
-* grafbase.dtx Contains grafbase.mf, grafbase.mp and dvipsnam.mp
-* mfpic.ins The unpacking script: run tex or latex on it. It reads
- in mfpic.dtx and grafbase.dtx and produces the
- required run-time files mfpic.sty, mfpic.tex,
- grafbase.mf, grafbase.mp, and dvipsnam.mp
-
-TeX/LaTeX code:
+*mfpic.dtx Contains mfpic.sty and mfpic.tex
+*grafbase.dtx Contains grafbase.mf, grafbase.mp and dvipsnam.mp
+*mfpic.ins The unpacking script: run tex or latex on it. It reads
+ in mfpic.dtx and grafbase.dtx and produces the six
+ required run-time files (marked "+" below)
+
+TeX/LaTeX code (in tex/):
--------------
- + mfpic.tex Basic TeX/LaTeX code
- + mfpic.sty LaTeX2e \usepackage wrapper for mfpic.tex
++mfpic.tex Basic TeX/LaTeX code
++mfpic.sty LaTeX2e wrapper for mfpic.tex
++mfpicdef.tex Input file used by metapost for TeX labels
-MetaPost/Metafont code:
+MetaPost/Metafont code (in metapost/ and metafont/):
----------------------
- + grafbase.mp MetaPost macros supporting mfpic
- + dvipsnam.mp Color definitions for MetaPost, input by grafbase.mp
- + grafbase.mf Metafont macros supporting mfpic
++grafbase.mp MetaPost macros supporting mfpic
++dvipsnam.mp Color definitions for MetaPost, needed by grafbase.mp
++grafbase.mf Metafont macos supporting mfpic
-Documentation:
+Documentation (in doc/):
-------------
- changes.txt Summary of 19 years of changes
+ changes.txt Summary of 20+ years of changes
install.txt Basic information on installation
README This file.
- mfpcard.pdf Precompiled reference card (usletter, landscape).
- mfpguide.pdf Precompiled tutorial (usletter paper size)
- mfpic-doc.pdf Precompiled manual (usletter paper size)
- mfpcard.tex plain TeX source for mfpcard.pdf, should fit on two
- sides of either USletter or A4, rotated.
+ mfpguide.pdf Tutorial (usletter paper size)
+ mfpic-doc.pdf Manual (usletter paper size)
+ mfpcard.pdf Reference card (two sides of usletter, landscape).
+ mfpdoc.sty LaTeX style used by the next two
mfpguide.tex LaTeX source for mfpguide.pdf, requires mfpdoc.sty and
the mfpic package.
- mfpic-doc.tex LaTeX source for mfpic-doc.pdf, requires mfpdoc.sty,
- lcheaders.ist amd coil.mps.
- mfpdoc.sty LaTeX style used by the above two
- lcheaders.ist makeindex style file for mfpic-doc.tex
+ mfpic-doc.tex LaTeX source for mfpic-doc.pdf, requires mfpdoc.sty.
coil.mps Figure included in mfpic-doc.tex
+ mfpcard.tex reference card source, should fit on two sides of
+ either USletter or A4, rotated. Plain TeX.
+ lcheaders.ist makeindex style file for mfpic-doc.tex
-Examples:
+Examples (in doc/examples/):
--------
- pictures.tex Running tex on it produces pics.mp
- lapictures.tex Running latex on it produces same pics.mp
- data.dat Sample data file needed for above two
- forfun.tex Example of \mfsrc: running tex on it produces fun.mp
+ pictures.tex Example pictures. Produces pics.mp. Plain TeX
+ lapictures.tex Same examples. Produces same pics.mp. LaTeX
+ data.dat Sample data file used by above two
+ forfun.tex Examples of \mfsrc. Produces fun.mp. Plain TeX
-This distribution, the latest updates, and some past versions, should also be
+This distribution, any new updates, and some past versions, should also be
available at my web site:
http://comp.uark.edu/~luecking/tex/mfpic.html
@@ -117,11 +119,22 @@ NEW FEATURES since Version 1.0
-- Differential equation plotters \DEgraph and \DEtrajectory added. (1.06)
- -- Some internal macros changed, some documentation changes made.
- (1.01-1.06)
-
-- Remove mfppatch.tex (which has never been used). (1.06)
+ -- Added file mfpicdef.tex for metapost labels. (1.07)
+
+ -- Added \quarterellipse, \halfellipse and \fullellipse. (1.07)
+
+ -- Added \gbrace for large braces in pictures. (1.07)
+
+ -- Added \hypergeodesic for certain (technical) circular arcs. (1.07)
+
+ -- Added \browniangraph and \randomwalk (1.07)
+
+ -- Added \gradient, \radialgradient and \areagradient (1.08)
+
+ -- Added \interpolatepath. Added \reversepath (= \reverse) (1.10)
+
\sig
Dan Luecking (luecking at uark dot edu)
Department of Mathematical Sciences
diff --git a/Master/texmf-dist/doc/generic/mfpic/changes.txt b/Master/texmf-dist/doc/generic/mfpic/changes.txt
index 2086042b8ce..dc99de4dfa2 100644
--- a/Master/texmf-dist/doc/generic/mfpic/changes.txt
+++ b/Master/texmf-dist/doc/generic/mfpic/changes.txt
@@ -1,53 +1,39 @@
% File: changes.txt
-% A part of mfpic 1.06 2011/03/08
+% A part of mfpic 1.10 2012/12/03
%
Summaries of changes.
-VERSION 0.1:
-
+0.1:
First version released to network, 30 June 1992.
-
-VERSION 0.2:
-
+0.2:
Second version released to network, 7 Sept. 1992. (Still had 0.1.13.1
version number in code---oops!) Many new features added, bugs
worked out, code cleaned up.
-VERSION 0.2.5 of Wed 10 Nov. 1993:
-
+0.2.5 of Wed 10 Nov. 1993:
Bug fix release Primarily work by Geoffrey Tobin.
-
-REVISION 0.2.5.1 of Wed 13 July 1994:
-
+0.2.5.1 of Wed 13 July 1994:
Bug fix release Corrected "unxconv" bug which remained in version
0.2.5's graphbase.mf.
-
-VERSION 0.2.9 Alpha of Thu 11 August 1994:
-
+0.2.9 Alpha of Thu 11 August 1994:
A test release prior to any official version 0.3, is ready for intrepid
users. Introduces coordinate transforms, and other novelties.
-
-UPDATE 0.2.9.1 Alpha} of Thu 8 September 1994:
-
+0.2.9.1 Alpha} of Thu 8 September 1994:
Fixes a bug in \sclosed and a bug in \white, corrects some omissions and
typos in the documentation, and adds the \shadewd, \hatchwd, \lhatch and
\rhatch macros.
-
-In 0.2.9.3 Alpha of Thu 21 March 1995:
-
+0.2.9.3 Alpha of Thu 21 March 1995:
Renamed \fill to \gfill, in order to avoid conflict with the LaTeX \fill
macro.
-
-UPDATE 0.2.9.4 Alpha of Thu 13 April 1995:
-
+0.2.9.4 Alpha of Thu 13 April 1995:
Renaming of \label to \tlabel, and \caption to \tcaption, in order to
avoid conflict with the LaTeX macros with those names.
@@ -59,9 +45,7 @@ because user-defined functions provide more power, and function plotting
macros were added that accept Metafont function names instead of
Metafont expressions.
-
-VERSION 0.2.9.5 Alfa of Wed 19 July 1995:
-
+0.2.9.5 Alfa of Wed 19 July 1995:
Renames \mfcmd to \mfsrc for clarity.
Renames \wedge to \sector to avoid conflict with the character name
@@ -78,9 +62,7 @@ transforms in grafbase.mf made slightly more robust. Begin an attempt
to make grafbase.mf compatible with John Hobby's MetaPost drawing
program.
-
-UPDATE 0.2.9.6 Alfa of Mon 24 July 1995:
-
+0.2.9.6 Alfa of Mon 24 July 1995:
Contributes \thatch which provides hatching by lines at any angle.
Modifications to \pen, \shadewd and \hatchwd, along with changes to
@@ -91,24 +73,18 @@ Renamed \rotate to \rotatepath.
Also renamed the affine transform macros, so that they no longer use the
`s' of the present tense, which could be mistaken for a plural.
-
-UPDATE 0.2.9.8 alfa, Mon 11 September 1995:
-
+0.2.9.8 alfa, Mon 11 September 1995:
Retain line separations of user's document's mfpic environment when
writing Metafont file. This prevents long Metafont commands from
exceeding Metafont's input buffer.
-
-REVISION 0.2.10.5 alfa, Sat 9 March 1996:
-
+0.2.10.5 alfa, Sat 9 March 1996:
Introduced \polyline as an alternative name for \lines.
In order to avoid repetition of side-effects, changed \tcaption to use
\unhbox\@textbox, instead of repeating its text argument.
-
-REVISION 0.2.10.6 alfa, (two hours later) on Sat 9 March 1996:
-
+0.2.10.6 alfa, (two hours later) on Sat 9 March 1996:
\polygon figure has been introduced;
\\ specifies explicit line breaks in tlabels and tcaptions;
@@ -120,20 +96,14 @@ Also modified \tcaption code to prevent repeated use of the text
argument, as that can cause side effects, as reported by Dennis
Petrovic.
-
-REVISION 0.2.10.7 alfa, Sat 28 March 1996:
-
+0.2.10.7 alfa, Sat 28 March 1996:
First release via Geoffrey Tobin's School's local anon ftp site:
ftp.ee.latrobe.edu.au : pub/gt/mfpic
-
-REVISION 0.2.10.8 alfa, Tue 26 May 1996:
-
+0.2.10.8 alfa, Tue 26 May 1996:
Second, and bug fix, release via Geoffrey Tobin's anonymous ftp area.
-
-REVISION 0.3.0 alpha, 1998:
-
+0.3.0 alpha, 1998:
Numbers jump a lot from here because I (Dan Luecking) have been lax in
keeping track of changes. First version with support for Metapost. Now
any(?) .mf file created by a recent mfpic can be run through Metapost
@@ -142,9 +112,7 @@ to produce a PostScript picture.
Added functions sin, cos, and their inverses invsin,
etc., that compute in radian measure. Also tan and cot.
-
-REVISION 0.3.8 alpha, 1999:
-
+0.3.8 alpha, 1999:
Color has been added. Default colors for lines/curves (drawcolor),
fills (fillcolor), hatch patterns (hatchcolor), and arrowheads
(headcolor). Optional arguments for color added to \gfill, \draw,
@@ -158,17 +126,13 @@ Added support for LaTeX2e's \usepackage command and options. Added
graphics inclusion code. Added code to detect which TeX format was in
use.
-
-REVISION 0.3.9 alpha, 2000:
-
+0.3.9 alpha, 2000:
Minor change to definition of \circle to avoid error messages in LaTeX.
Changed the graphic placement code so that it tests for the existence of
the graphic first.
-
-REVISION 0.3.10 alpha, 2000:
-
+0.3.10 alpha, 2000:
Added changes contributed by Jaromir Kuben: An option centercaptions
and command \centercaptions to center the lines in a \tcaption. Also
\nocentercaptions. Improvements to the code that positions text labels
@@ -184,16 +148,12 @@ functions secd, sec, cscd, csc, atan, invtan. Made log a
synonym for ln. Added complex variables functions Arg, cis, zexp
and Log.
-
-REVISION 0.3.11 alpha, 2000:
-
+0.3.11 alpha, 2000:
Added \plot similar to \dotted but these shapes can be placed:
Triangle, Square, Circle, Plus, Cross, Star, SolidTriangle,
SolidSquare, or SolidCircle
-
-REVISION 0.3.12 alpha, 2000:
-
+0.3.12 alpha, 2000:
Added macro \datafile to read a file of number pairs and create the
polygonal path connecting them.
@@ -205,9 +165,7 @@ Changed names of various commands to a more imperative form:
\usemetapost, \usemetafont,
Changed name of option centercaptions to centeredcaptions.
-
-REVISION 0.3.13 alpha, 2000:
-
+0.3.13 alpha, 2000:
\datafile now ignores leading blank lines and comments,
and won't gag on commented out EOLs.
@@ -236,9 +194,7 @@ Added Diamond and SolidDiamond to the symbols available.
A command \fcncurve that draws a function (i.e., curve doesn't double
back) if the x-values are unique and listed in order.
-
-REVISION 0.3.14 alpha, 2000:
-
+0.3.14 alpha, 2000:
Added optiom mplabels to make \tlabel write btex ... etex groups
to the .mp file. Commands \usemplabels and \nomplabels.
Added third part to the optional argument of \tlabel to
@@ -261,9 +217,7 @@ Changed \savepic: Now use \newpic{\foo} to allocate a box,
\savepic{\foo} to store the next picture, and \usepic{\foo} to copy
it.
-
-REVISION 0.3.15 alpha, 2000:
-
+0.3.15 alpha, 2000:
Added \mfpverbtex to write verbatimtex block to .mp file.
Changed \newpic to \newsavepic to more closely parallel LaTeX's
@@ -276,13 +230,11 @@ Added \pointdef: \pointdef{A}(1,3) makes \A expand to (1,3), with
\Ax and \Ay expanding to 1 and 3, respectively.
-REVISION 0.4.0 beta, Aug 2000:
-
+0.4.0 beta, Aug 2000:
Released to CTAN.
-REVISION 0.4.01 beta, Nov/Dec 2000:
-
+0.4.01 beta, Nov/Dec 2000:
Generate a time-stamp for the output file.
Added \penwd as a synonym for \pen.
@@ -290,16 +242,12 @@ Added \penwd as a synonym for \pen.
Added macros \xaxis[<hlen>] and \yaxis[<hlen>] with the obvious
meanings.
-
-REVISION 0.4.04 beta, Mar 2001:
-
+0.4.04 beta, Mar 2001:
Added \smoothdata[<tension>] to cause \datafile and \plotdata to
draw smooth curves with optional tension setting. And \unsmoothdata to
restore the default.
-
-REVISION 0.4.10 beta, May 2001:
-
+0.4.10 beta, May 2001:
Renamed \framed to \mfpframed, similarly: \mfpframegap and
\mfpframethickness.
@@ -322,7 +270,6 @@ tickmarks along those axes. Syntax eventually settled on in 0.4.16:
\setbordermarks{<pos>}{<pos>}{<pos>}{<pos>}
\setallbordermarks{<pos>}
-
For arrowheads on the side axis, a dimesion \sideheadlen was added.
Added \gridlines to draw a regular grid of lines.
@@ -334,8 +281,7 @@ Added the command \tlabels (note the plural). It has one mandatory
argument which contains a concatenation of arguments for one or more
\tlabel commands.
-REVISIONs 0.4.11--15 beta, July 2001:
-
+0.4.11--15 beta, July 2001:
Added support for multiline labels under mplabels.
Added ability to create a curve surrounding some text:
@@ -362,24 +308,18 @@ instead of \(un)smoothdata.
Added \mfpframe...\endmfpframe to frame the contents.
-
-REVISION 0.4.16 beta, July 28--30 2001:
-
+0.4.16 beta, July 28--30 2001:
Added "star form" of each \tlabel<path> that defines the curve without
placing the label.
-
-REVISION 0.4.17 beta, July 28--Aug 10, 2001:
-
+0.4.17 beta, July 28--Aug 10, 2001:
Commands: \function, \parafcn, \plrfcn, \btwnfcn and
\plrregion now take an option of the form [s<tension>].
Changed the \mfpic command so both optional parameters may be omitted
(scale 1 is then assumed).
-
-REVISION 0.4.18 beta, Aug 10--20, 2001:
-
+0.4.18 beta, Aug 10--20, 2001:
Added point size option to \grid.
Added a macro \plottext similar to \plotsymbol except instead of a
@@ -389,19 +329,13 @@ Added \plrgrid and \plrpatch.
Added \piechart and \piewdge.
-
-REVISION 0.4.19 beta, Aug 20--26, 2001:
-
+0.4.19 beta, Aug 20--26, 2001:
Added \mfpicnumber to set the number of the next character or figure.
-
-REVISION 0.4.20 beta, Aug 26--Sep 1, 2001:
-
+0.4.20 beta, Aug 26--Sep 1, 2001:
Added \barchart.
-
-REVISION 0.4.21 beta, Sept 1--10, 2001:
-
+0.4.21 beta, Sept 1--10, 2001:
Added SolidStar to symbols available. Changed Star to produces an
open five-pointed star instead of the asterisk previously drawn. Added
Asterisk to duplicate the old Star.
@@ -411,15 +345,11 @@ Added \shiftpath{p}, \scalepath{p,sf}, \xscalepath{x,sf},
scale factor, "x" is an x-coordinate, "y" is a y-coordinate and "sl"
is a slant factor.
-
-REVISION 0.4.22 beta, Sept 11--22, 2001:
-
+0.4.22 beta, Sept 11--22, 2001:
Added \reflectpath{p1,p2}, \xyswappath and \yslantpath{x,sl}; also
\xslantpath (a synonym for \slantpath).
-
-REVISION 0.5.0 beta, Sept 24--Oct25, 2001:
-
+0.5.0 beta, Sept 24--Oct25, 2001:
Change comment written at the top of the output file. Now includes the
name of the output file, as well as the \jobname of the TeX source
that produced it.
@@ -435,15 +365,11 @@ output and \endmfpic ends the group (under mplabels).
Released to CTAN, Oct, 2001.
-
-REVISION 0.5.01 beta
-
+0.5.01 beta
Corrects a small bug by adding some braces around the point arguments of
\tlabel in a couple of places.
-
-REVISION 0.5.04 alpha, ???--April 11, 2002:
-
+0.5.04 alpha, ???--April 11, 2002:
Added options draft, final, and nowrite (commands \mfpicdraft,
\mfpicfinal, and \mfpicnowrite) which should avoid including the
pictures (draft) or include the pictures (final), overriding automatic
@@ -460,20 +386,14 @@ are implemented with \marks x, etc. (Later renamed to \axismarks.)
Added aliases \lattice and \gridpoints for \grid.
-
-REVISION 0.5.05 alpha, April 16, 2002:
-
+0.5.05 alpha, April 16, 2002:
Corrected bug in \mfpverbtex which caused # symbols to be doubled in
the output.
-
-REVISION 0.5.06 alpha, April 16--May 7, 2002:
-
+0.5.06 alpha, April 16--May 7, 2002:
Made changes to avoid MF/MP overflow in \tlabelellipse/oval.
-
-REVISION 0.5g (= 0.5.07) alpha, May 7--June 25, 2002:
-
+0.5g (= 0.5.07) alpha, May 7--June 25, 2002:
Added \usingpairdefault to reset the \using specification to the
default. Also \usingnumericdefault for commands that take numeric
data.
@@ -481,37 +401,25 @@ data.
Changed version numbering scheme so LaTeX file utilities like the
snapshot package are better served.
-
-REVISION 0.5h alpha, Aug 1--6, 2002:
-
+0.5h alpha, Aug 1--6, 2002:
Added \gclip rendering macro that clips the current picture to a path.
-
-REVISION 0.6 beta, Sep 12, 2002:
-
+0.6 beta, Sep 12, 2002:
Uploaded to CTAN.
-
-REVISION 0.6a alpha, Sep 12--Nov 5, 2002.
-
+0.6a alpha, Sep 12--Nov 5, 2002.
Added \let\par\relax (later \@empty) in \mfpic to nullify blank lines
in user code. (Reported by Jaromir Kuben.) Put in commands to restore
\par to its normal meaning in labels and captions.
-
-REVISION 0.6b beta, Nov 6--, 2002.
-
+0.6b beta, Nov 6--, 2002.
Correct sign on sinh function with negative argument
-
-REVISION 0.6c beta, Nov 6--, 2002.
-
+0.6c beta, Nov 6--, 2002.
Bounding box had the horizontal and vertical data reversed if all
of the following three options were selected: metapost, mplabels and
clip.
-
-REVISION 0.63(=0.6c) alpha
-
+0.63(=0.6c) alpha
New numbering scheme: increment hundreds (perhaps also thousands) digit
for alpha, add letters only for patches to released beta version.
@@ -548,15 +456,11 @@ Transcribed documentation to latex.
Packaged mfpic in mfpic.dtx, mfpic.ins and grafbase.dtx.
-
-REVISION 0.64 alpha
-
+0.64 alpha
Added optional argument to \circle (similar to the ones for \arc). So
the circle through three points can be easily drawn, filled, etc.
-
-REVISION 0.65 alpha
-
+0.65 alpha
Rewrote \noship and added \stopshipping and \resumeshipping so that
shipping can be turned off for several figures.
@@ -571,9 +475,7 @@ Added \trimpath{<dim1>,<dim2>} , a prefix macro that removes the part
of the following path within <dim1> of its start and within <dim2>
of its end.
-
-REVISION 0.66 alpha
-
+0.66 alpha
Added \pointcolor , the color in which points are drawn by \point and
in which symbols are drawn by \plotsymbol.
@@ -582,9 +484,7 @@ The optional parameter of \tlabelrect may now be the literal word
half the narrower dimension of the rectangle, giving the "rectangle"
semicircular ends.
-
-REVISION 0.67 alpha
-
+0.67 alpha
Allow the use of \usetruebbox in an mfpic environment.
Added \reconfigureplot which takes the word `dashes', `colors', or
@@ -604,9 +504,7 @@ second one later removed).
Started mfpguide.tex, a beginner's tutorial.
-
-REVISION 0.68 alpha
-
+0.68 alpha
Added complex function sgn Z : returns (0,0) if Z = (0,0),
otherwise unitvector Z.
@@ -639,9 +537,7 @@ figure processor.
Renamed \mfp@addto to \mfpaddto and added \mfpmultiply for power
users.
-
-REVISION 0.69 alpha and 0.69a
-
+0.69 alpha and 0.69a
Make \gridlines honor the settings of \axismargin.
Added \hgridlines to draw only the horizontal and \vgridlines to
@@ -660,49 +556,35 @@ exists.
Renamed manual to mfpman.tex. Provide a linked mfpman.pdf with
TOC, and two indices.
-
-REVISION 0.69c alpha
-
+0.69c alpha
Lowered MF memory usage of \gendashed (and therefore also for \dashed,
\dotted and \plot). Problem reported by J. Kuben.
-
-REVISION 0.69d
-
+0.69d
\barchart can now take pair data. Interpreting (a,b) as an interval
and creates bars that begin at a and end at b (Gantt diagrams).
Added \gantt (= \barchart)
-
-REVISION 0.69f
-
+0.69f
Made [cc] the default for \tlabelrect, etc. Added command
\tlpathjustify to change the default.
Added code to input user additions, defaults, etc., in mfpic.usr, if
it exists.
-
-REVISION 0.69g
-
+0.69g
Bug fix to \tlabelrect.
-
-REVISION 0.7 beta, 14 Nov 2003
-
+0.7 beta, 14 Nov 2003
Packed up and put on web page and CTAN.
-
-REVISION 0.7a beta, 16 Apr 2004
-
+0.7a beta, 16 Apr 2004
Change one semicolon (;) in a string written by \opengraphsfile to a
colon (:) to work around a bug in the perl scripts mptopdf and/or
texexec.
-
-REVISIONS 0.71 alpha--0.8 beta, 17 May 2005
-
+0.71 alpha--0.8 beta, 17 May 2005
Added
\arc[r], \arc[q], \circle[r], circle[q].
\arrow* (star form).
@@ -744,20 +626,14 @@ the version info and emit a message if there is a mismatch.
Sent to CTAN 13 May 2005.
-
-REVISION 0.8a 17 May 2005
-
+0.8a 17 May 2005
Added forgotton \belowfcn plus the documentation of \btwnplrfcn.
-
-REVISION 0.8b 27 Sep 2005
-
+0.8b 27 Sep 2005
Bug fixed concerning unprintable characters in filenames.
NOT uploaded.
-
-REVISION 0.89 08 May 2006
-
+0.89 08 May 2006
Added: \arrowhead, \arrowtail and \arrowmid for arrows.
Added: \zigzag, \sinewave and \corkscrew renderings.
@@ -810,12 +686,10 @@ mfpman.tex.
Corrected behavior of mfpic environments with regard to \everypar.
-REVISION 0.90 01 Jun 2006
-
+0.90 01 Jun 2006
Uploaded to CTAN
-REVISION 0.94 09 Sep 2009
-
+0.94 09 Sep 2009
Added support for cmyk and grayscale color models that have been
available in MetaPost since version 1.000.
@@ -901,17 +775,10 @@ Correct minor error in mfpic.dtx affecting only the documentation.
1.02
Add work-around for verbatimtex (added a commented blank line after
-user-supplied verbatimtex material). Metapost comments out final eol in
-a verbatimtex group, also ignoring trailing spaces, also ignoring blank
-lines. This causes problems if user ends one verbatimtex with an
-assignment, and then follows with another verbatimtex before any btex's.
-These two verbatimtex's are then effectively concatenated, contrary to a
-user's expectation that a line end separates them.
+user-supplied verbatimtex material).
1.03
-Correct iscolor in grafbase. Added parentheses around "color clr" to
-force it to be interpreted as a boolean expression rather than an
-incomplete color variable declaration.
+Correct iscolor in grafbase, adding parentheses.
Change detection of amstex to \ifx\amstexloaded@\relax (don't know why I
rejected this before). This takes care of formats built on top of
@@ -938,3 +805,35 @@ support macros *RKIV (4-step Runge-Kutta numerical method).
Removed mfppatch.tex from the distribution. Add lcheadings.ist for the
index.
+1.07
+Added mfpicdef.tex for metapost labels and removed token register
+\mfp@commonverbatimtex.
+
+Added \quarterellipse, \halfellipse and \fullellipse.
+
+Use \MFPeverylabel in the metapost file instead of \everylabel in case
+someone uses a LaTeX package that includes such a macro.
+
+Added \gbrace.
+
+Changed the detection of AmS-TeX. Check that both \amstexloaded@=\relax
+and \NoBlackBoxes is defined. The former alone is too easy to occur by
+accident.
+
+Added hyperbolic geodesics. Also a half-plane version of pshdist(,).
+
+Added \browniangraph and \randomwalk.
+
+Added the Kelvin transform, kelvin(z). Also the complex function
+zsqrt(z) and complex number operations zmul and zdiv.
+
+1.08
+Added gradients: \gradient, \areagradient and \radialgradient.
+
+1.09
+Testing...
+
+1.10
+Added commands to interpolate between two paths.
+Added \reversepath=\reverse.
+
diff --git a/Master/texmf-dist/doc/generic/mfpic/examples/data.dat b/Master/texmf-dist/doc/generic/mfpic/examples/data.dat
index 834ab5b57d1..12222ede486 100644
--- a/Master/texmf-dist/doc/generic/mfpic/examples/data.dat
+++ b/Master/texmf-dist/doc/generic/mfpic/examples/data.dat
@@ -1,5 +1,5 @@
# File: data.dat
-# A part of mfpic 1.06 2011/03/08
+# A part of mfpic 1.10 2012/12/03
#
# A file of data to plot a function curve
# ("#", not "%", must be comment character when this is read.)
diff --git a/Master/texmf-dist/doc/generic/mfpic/examples/forfun.tex b/Master/texmf-dist/doc/generic/mfpic/examples/forfun.tex
index d2832c8ac90..76fcdbb8b70 100644
--- a/Master/texmf-dist/doc/generic/mfpic/examples/forfun.tex
+++ b/Master/texmf-dist/doc/generic/mfpic/examples/forfun.tex
@@ -1,5 +1,5 @@
% File: forfun.tex
-% A part of mfpic 1.06 2011/03/08
+% A part of mfpic 1.10 2012/12/03
%
\nopagenumbers
\input mfpic.tex
@@ -7,7 +7,7 @@
\usetruebbox
\opengraphsfile{fun}
-\mfpicunit=1bp
+\mfpicunit=2bp
\noindent
\mfpic{-1.25}{118.5}{-11.25}{40}
diff --git a/Master/texmf-dist/doc/generic/mfpic/examples/lapictures.tex b/Master/texmf-dist/doc/generic/mfpic/examples/lapictures.tex
index 4247e3b7b15..4400d8734d6 100644
--- a/Master/texmf-dist/doc/generic/mfpic/examples/lapictures.tex
+++ b/Master/texmf-dist/doc/generic/mfpic/examples/lapictures.tex
@@ -1,5 +1,5 @@
% File: lapictures.tex
-% A part of mfpic 1.06 2011/03/08
+% A part of mfpic 1.10 2012/12/03
%
% Magnify to same scale as pictures.tex :
% (Use of \mag is against the law of LaTeX, but Bugs Bunny set a precedent.)
@@ -121,10 +121,10 @@
\noindent
\begin{mfpframe}
\begin{mfpic}[30]{-1.3}{1.7}{-1}{1.1}
-\gfill\sector{(0.3,0.2), 1, 0,60}
-\shade\sector{(0,0), 1, 60,105}
-\turtle{(0,0), \plr{(1,105)}}
-\sector{(0,0), 1, 60,360}
+\gfill\sector{(0.3,0.2), 1, 0, 60}
+\shade\sector{(0,0), 1, 60, 105}
+\turtle{(0,0), \plr{(1, 105)}}
+\sector{(0,0), 1, 60, 360}
\tcaption{{\it Figure 5:} Pie Chart.}
\end{mfpic}
\end{mfpframe}
diff --git a/Master/texmf-dist/doc/generic/mfpic/examples/pictures.tex b/Master/texmf-dist/doc/generic/mfpic/examples/pictures.tex
index 649a8dd27d8..44146130a5f 100644
--- a/Master/texmf-dist/doc/generic/mfpic/examples/pictures.tex
+++ b/Master/texmf-dist/doc/generic/mfpic/examples/pictures.tex
@@ -1,5 +1,5 @@
% File: pictures.tex
-% A part of mfpic 1.06 2011/03/08
+% A part of mfpic 1.10 2012/12/03
%
\magnification=\magstep1
@@ -120,9 +120,9 @@ Filled Circle.}
\mfpframe
\mfpic[30]{-1.3}{1.7}{-1}{1.1}
\gfill\sector{(0.3,0.2), 1, 0,60}
-\shade\sector{(0,0), 1, 60,105}
-\turtle{(0,0), \plr{(1,105)}}
-\sector{(0,0), 1, 60,360}
+\shade\sector{(0,0), 1, 60, 105}
+\turtle{(0,0), \plr{(1, 105)}}
+\sector{(0,0), 1, 60, 360}
\tcaption{{\it Figure 5:} Pie Chart.}
\endmfpic
\endmfpframe
diff --git a/Master/texmf-dist/doc/generic/mfpic/install.txt b/Master/texmf-dist/doc/generic/mfpic/install.txt
index 7f98437d374..8c8df9a5c4f 100644
--- a/Master/texmf-dist/doc/generic/mfpic/install.txt
+++ b/Master/texmf-dist/doc/generic/mfpic/install.txt
@@ -1,136 +1,102 @@
% File: install.txt
-% A part of mfpic 1.06 2011/03/08
+% A part of mfpic 1.10 2012/12/03
%
-This is version 1.06 of mfpic. See README.txt for a list of files and a
+This is version 1.10 of mfpic. See README for a list of files and a
brief description of each.
Generating and installing the files
-----------------------------------
-This sections is unnecessary if you just get mfpic.tds.zip, copy it to
-your local texmf directory , and unzip it there. You can find it on
-CTAN: /install/generic/mfpic.tds.zip
-
--- Put mfpic.ins, mfpic.dtx and grafbase.dtx in the same temporary
- directory and change to that directory. Run latex (or tex) on
- mfpic.ins, which should produce the five files
- mfpic.tex
- mfpic.sty
- grafbase.mf
- grafbase.mp
- dvipsnam.mp
-
- -- If you have an older version of mfpic, remove the old files with the
- same names as the above five from your TeX directories, or ensure
- that the following procedure overwrites them (back them up somewhere
- else first if you wish).
-
- -- Copy mfpic.tex where TeX and LaTeX will find it, and mfpic.sty where
- LaTeX will find it. On any TDS compliant system (such as TeX Live
- MacTeX, or MiKTeX) they can all be put in $TEXMF/tex/generic/mfpic/
- (where $TEXMF indicates a directory serving as a root of a texmf
- tree).
-
- -- Copy grafbase.mp and dvipsnam.mp where MetaPost will find them, for
- example $TEXMF/metapost/mfpic/ .
-
- -- Copy grafbase.mf where Metafont will find it. For example,
- $TEXMF/metafont/mfpic/ .
-
- -- Copy mfpguide.pdf, mfpic-doc.pdf. mfpcard.pdf where documentation is
- kept. For example, $TEXMF/doc/generic/mfpic/ . Optionally, copy
- the .tex versions of these, plus mfpdoc.sty, lcheaders.ist and coil.mps,
- as well as examples/*.* to the documentation area
- Also optional: copy the two .dtx files and mfpic.ins to the source area
- ($TEXMF/source/generic/mfpic/).
-
- -- Some distributions might have a copy of the file grafbase.mf in the
- directory $TEXMF/fonts/public/mfpic. If so, delete it or replace it
- with a copy of the new one. If some package needs that particular
- version, put it someplace where mf and mpost will _not_ find it and
- arrange for that package to find it when necessary.
-
- -- If required by your TeX system (MiKTeX, MacTeX, and TeXLive all DO
- require it): !!UPDATE THE TeX FILENAME DATABASE!!
-
-There is one optional step that may be useful (if you only wish to use
-mfpic to produce MetaPost pictures, you may skip this): find the file
-modes.mf on your system. Typically this will be in $TEXMF/metafont/misc/
-Find near the end a line similar to
+This sections is unnecessary if you get
+ http://mirror.ctan.org/install/graphics/mfpic.tds.zip
+when it becomes available. Just unzip it in a texmf directory.
+Alternatively, you can get the entire graphics/mfpic/ directory from
+http://mirror.ctan.org/ and move those files as described below
+
+-- If you have acquired only mfpic.ins, mfpic.dtx and grafbase.dtx, put
+ the three in the same temporary directory and change to that
+ directory. Run latex (or tex) on mfpic.ins, which should produce
+ these six files:
+ mfpic.tex grafbase.mf
+ mfpic.sty grafbase.mp
+ mfpicdef.tex dvipsnam.mp
+
+-- If you have an older version of mfpic, remove any old files with the
+ same names as the above from your TeX directories, or ensure that the
+ following procedure overwrites them (back them up first, if you wish).
+
+-- Copy mfpic.tex and mfpicdef.tex where TeX and LaTeX will find them,
+ and mfpic.sty where LaTeX will find it. On any TDS compliant system
+ (such as TeXLive, MacTeX and MiKTeX) they can all be put in
+ $TEXMF/tex/generic/mfpic/ (where $TEXMF indicates a directory serving
+ as a root of a texmf tree).
+
+-- Copy grafbase.mp and dvipsnam.mp where MetaPost will find them, for
+ example $TEXMF/metapost/mfpic/ .
+
+-- Copy grafbase.mf where Metafont will find it. For example,
+ $TEXMF/metafont/mfpic/ .
+
+-- Copy mfpguide.pdf, mfpic-doc.pdf. mfpcard.pdf where documentation is
+ kept. For example, $TEXMF/doc/generic/mfpic/ . Optionally, copy the
+ *.tex versions of these, plus mfpdoc.sty, lcheadings.ist and
+ coil.mps, as well as examples/*.* either to the documentation area or
+ to the same place as mfpic.tex. Also optional: copy the two .dtx
+ files and mfpic.ins to the source area
+ ($TEXMF/source/generic/mfpic/).
+
+-- If required by your TeX system (most do): update the tex filename
+ database.
+
+There is one optional step that may be useful if you plan to make use of
+mfpic's support for Metafont (you may skip this if you only wish to use
+its MetaPost support): find the file modes.mf on your system. Typically
+this will be in $TEXMF/metafont/misc/ . Find, near the end of that file,
+a line similar to
localfont := ljfour;
-Replace, if necessary, the string "ljfour" by one of the modes listed in
-that file. At minimum, select one whose resolution (DPI) matches your
-printer and/or the configuration of your dvi viewer. If you make such a
-change, regenerate the mf.base file (fmtutil on TeXLive or MacTeX;
+Replace, if necessary, the string "ljfour" by one of the modes defined
+in that file. At minimum, select one whose resolution (DPI) matches both
+your printer and the configuration of your dvi viewer. If you make such
+a change, regenerate the mf.base file (fmtutil on MacTeX or TeXLive;
MiKTeX Options in MiKTeX). On some systems this may be named plain.base.
Read mfpguide.pdf before trying anything further. If you are already
familiar with mfpic (version 0.2.10.9 or later) you can probably get
going right away.
-If you want to read the documented source code for mfpic, run latex on
-mfpic.dtx and grafbase.dtx (Peter Wilson's docmfp.sty is required
-for grafbase.dtx) 2 or 3 times each. Then run makeindex for each:
-
+If you want to read the documented source code for mfpic, run pdflatex
+on mfpic.dtx and grafbase.dtx three times each. Then run makeindex for
+each:
makeindex -s gind.ist -o mfpic.ind mfpic.idx
makeindex -s gind.ist -o grafbase.ind grafbase.idx
-
-and then latex again (once each). The docmfp package can be found at
-your favorite CTAN mirror. A copy of docmfp.sty is also on my web page
-(see README). (Some TeX distributions (e.g., TeXLive) contain a rogue
-copy of ltxdoc.cfg in the TeX input path (e.g., tex/latex/subfig), which
-can mess up the indexes of these documents. Move it from the texinputs
-area to the documentation area of your system.
+and then pdflatex again.
------------------------------------------------------------------------
-If you desire to remake the mfpic manual (and why in the world would you
-be wanting to do a daft thing like that?), make sure mfpic-doc.tex and
+If you desire to remake mfpic-doc.pdf, make sure mfpic-doc.tex and
mfpdoc.sty are in the current directory or where LaTeX can find them.
Make sure that coil.mps is also where LaTeX can find it. Edit, if you
-like, the paper size option in the \documentclass command in mfpic-doc.tex.
-(The document uses Times for the main font family, LuxiMono for a
-typewriter font, and CMSS for a sans serif font. Packages mathptmx amd
-luximono are required.) Then run pdflatex three times:
-
- pdflatex mfpic-doc (Hundreds of undefined labels messages)
- pdflatex mfpic-doc (Labels have changed message may occur)
- pdflatex mfpic-doc (All resolved)
-
-Now page numbers should be correct in the index, so run makeindex,
-making sure that lcheaders.ist is where makeindex can find it:
-
- makeindex -s lcheaders.ist -o mfpic-doc.ind mfpic-doc.idx
-
-then run latex two more times:
-
- pdflatex mfpic-doc (mfpic-doc.toc now has index added)
- pdflatex mfpic-doc (Document toc now correct)
-
-You can use latex instead of pdflatex, but you won't get clickable links
-in the result. (I was too lazy to make that work.)
-
-You could do something similar for mfpguide.tex (but that, too, would be
-daft):
-
- pdflatex mfpguide (produces guide.mp)
- mpost guide.mp (creates guide.1, guide.2, etc.)
- pdflatex mfpguide (includes figures, which changes pagination)
- pdflatex mfpguide (All resolved)
-
-This relies on mfpic so you should probably wait to do that until after
-you are accustomed to that process. (And then take a cold shower until
-this compulsion passes.) It also leaves a few dozen files guide.*, which
-you will want to delete.
-
-And finally, if you forgot:
-
- **************************************
- !! UPDATE THE TeX FILENAME DATABASE !!
- **************************************
+like, the paper size option in the \documentclass command in
+mfpic-doc.tex. (The document uses Times for the main font family,
+LuxiMono for a typewriter font, and CMSS for a sans serif font. Packages
+mathptmx amd luximono are required.) Then run
+ pdflatex mfpic-doc
+three times. Make sure lcheadings.ist is where makeindex can find it
+and run
+ makeindex -s lcheadings.ist -o mfpic-doc.ind mfpic-doc.idx
+Then
+ pdflatex mfpic-doc
+at least 2 more times.
+
+You could do something similar for mfpguide.tex:
+ pdflatex mfpguide
+ mpost guide.mp
+ pdflatex mfpguide
+ pdflatex mfpguide
+This relies on the mfpic package itself.
\sig
Dan Luecking (luecking at uark dot edu)
diff --git a/Master/texmf-dist/doc/generic/mfpic/lcheadings.ist b/Master/texmf-dist/doc/generic/mfpic/lcheadings.ist
index c9873b1de04..145317b8b11 100644
--- a/Master/texmf-dist/doc/generic/mfpic/lcheadings.ist
+++ b/Master/texmf-dist/doc/generic/mfpic/lcheadings.ist
@@ -1,8 +1,11 @@
% File: lcheadings.ist
-% A part of mfpic 1.06 2011/03/08
-%
-% Generic lowercase headings
+% A part of mfpic 1.10 2012/12/03
%
+%% Generic headings. The macros \headingprefix and \headingsuffix must
+%% be defined in the document or in a package that it uses.
+%%
heading_prefix "\n\\headingprefix{"
heading_suffix "}\\headingsuffix\n"
headings_flag -1
+%% headings_flag = +/-1 turns on headings. Positive for uppercase,
+%% negative for lowercase.
diff --git a/Master/texmf-dist/doc/generic/mfpic/mfpcard.pdf b/Master/texmf-dist/doc/generic/mfpic/mfpcard.pdf
index 69d9f311eec..3422bfacc10 100644
--- a/Master/texmf-dist/doc/generic/mfpic/mfpcard.pdf
+++ b/Master/texmf-dist/doc/generic/mfpic/mfpcard.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/mfpic/mfpcard.tex b/Master/texmf-dist/doc/generic/mfpic/mfpcard.tex
index 1e7504e9efc..6d79fc79df6 100644
--- a/Master/texmf-dist/doc/generic/mfpic/mfpcard.tex
+++ b/Master/texmf-dist/doc/generic/mfpic/mfpcard.tex
@@ -1,5 +1,5 @@
% File: mfpcard.tex
-% A part of mfpic 1.06 2011/03/08
+% A part of mfpic 1.10 2012/12/03
%
% (Ask your driver to print so that longer dimension is horizontal.)
\newdimen\paperlongside
@@ -199,9 +199,9 @@
\title{MFPIC Quick Reference}
-\centerline{(Copyright 2000--2011 by Daniel Luecking)}
+\centerline{(Copyright 2000--2012 by Daniel Luecking)}
\medskip
-This information was prepared for version 1.06 of \prog{mfpic}.
+This information was prepared for version 1.10 of \prog{mfpic}.
\section{Preamble commands}
@@ -484,6 +484,12 @@ These filling prefixes turn off automatic drawing of the curve.
\describe{} {\cs{hatch} $=$ \cs{xhatch}}
\describe{Shading}
{\cs{shade}\oarg{\meta{space}}$\ldots$}
+\describe{Gradients$^{\dag}$}
+ {\cs{gradient}\marg{\meta{clr},\meta{width},\meta{angle}}$\ldots$}
+\describe{}
+ {\cs{areagradient}\marg{\meta{clr},\meta{h-wd},\meta{v-wd}}$\ldots$}
+\describe{}
+ {\cs{radialgradient}\marg{\meta{clr},\meta{wd},\meta{center}}$\ldots$}
\describe{Polkadot fill}{\cs{polkadot}\oarg{\meta{space}}$\ldots$}
\describe{Fill with copies of a tile} {\cs{tess}\marg{\meta{tile}}$\ldots$}
\describe{\quad Define a tile*}
@@ -491,11 +497,14 @@ These filling prefixes turn off automatic drawing of the curve.
\meta{drawing commands} \cs{endtile}}
\smallskip
+$^{\dag}$ \meta{clr} is a function that returns a color for parameter(s)
+in $(0,1)$.\brk
* Creates a mini-mfpic, clipped if \meta{clip}${}={}${\tt true}.
\subsection{Storing and reusing a path}
\describe{Store a path} {\cs{store}\marg{\meta{name}}$\ldots$}
+\nobreak
\describe{\quad reusing a stored path} {\cs{mfobj}\marg{\meta{name}}}
\subsection{Subpaths}
diff --git a/Master/texmf-dist/doc/generic/mfpic/mfpdoc.sty b/Master/texmf-dist/doc/generic/mfpic/mfpdoc.sty
index 8814c8c89ff..405a80fe071 100644
--- a/Master/texmf-dist/doc/generic/mfpic/mfpdoc.sty
+++ b/Master/texmf-dist/doc/generic/mfpic/mfpdoc.sty
@@ -1,11 +1,10 @@
% File: mfpdoc.sty
-% A part of mfpic 1.06 2011/03/08
+% A part of mfpic 1.10 2012/12/03
%
-\ProvidesPackage{mfpdoc}[2011/03/08 v1.06 macros for mfpic documentation]
-\newcommand\mfpversion{1.06}
-\newcommand\mfpicversion{106}
-\newcommand\mfpfiledate {2011/03/08}
-
+\ProvidesPackage{mfpdoc}[2012/12/03 v1.10 macros for mfpic documentation]
+\newcommand\mfpversion{1.10}
+\newcommand\mfpicversion{110}
+\newcommand\mfpfiledate {2012/12/03}
\newif\if@chapters
\@chaptersfalse
\DeclareOption{chapters}{\@chapterstrue}
@@ -35,10 +34,10 @@
\advance\topmargin-\headheight
\advance\topmargin-\headsep
+\ifpdf
% These two are now defaults in TeX Live:
% \pdfminorversion 5
% \pdfobjcompresslevel 2
-\ifpdf
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth
\def\mfpHyOpts{%
@@ -70,7 +69,6 @@
{-1ex\@plus -.2ex \@minus -.1ex}%
{.4ex \@plus .1ex}%
{\normalfont\itshape\raggedright}}
-
%
% To allow \chapter command in article class, load this package with
% [chapters] option
@@ -103,9 +101,6 @@
}%
\vskip 1em\relax}
-\def\mfpindexheading{}
-\def\mfpindexpagemarks{}
-
\def\@listi{\leftmargin\leftmargini
\parsep \z@ \@plus\p@ \@minus\z@
\topsep 1ex \@plus.2ex \@minus 1ex
@@ -120,7 +115,7 @@
\def\mfpindexheading{}
\def\mfpindexpagemarks{}
-% If *headings.ist is used we need these:
+% If lcheadings.ist or ucheadings.ist is used we need these:
\def\headingprefix#1{\textbf{#1}}
\def\headingsuffix{\par\nobreak\smallskip}
@@ -180,8 +175,21 @@
\def\pdfLaTeX{pdf\kern.06em\LaTeX}
\def\ConTeXt{Con\kern-.16em \TeX \kern-0.06em t}
\def\eTeX{e\kern-.10em \TeX}
+ \def\LMcal{\fontencoding{OMS}\fontfamily{lmsy}\selectfont}
\def\CMcal{\fontencoding{OMS}\fontfamily{cmsy}\selectfont}
- \def\AmSTeX{{\CMcal A\kern-.1667em\lower.5ex\hbox{M}\kern-.125em S}-\TeX}
+%
+% Use CM mathcal for AMS logo
+% \def\AmSTeX{{\CMcal A\kern-.1667em\lower.5ex\hbox{M}\kern-.125em S}-\TeX}
+%
+% Use whatever is default for \mathcal:
+% \def\AmSTeX{%
+% $\mathcal{A}\kern-.1667em
+% \lower.5ex
+% \hbox{$\mathcal{M}$}\kern-.125em
+% \mathcal{S}$-\TeX}
+%
+% Use LM mathcal for AMS logo
+ \def\AmSTeX{{\LMcal A\kern-.1667em\lower.5ex\hbox{M}\kern-.125em S}-\TeX}
\def\PiCTeX{P\kern-.06em\lower.4ex\hbox{I}\kern-.075emC\kern-.06em\TeX}
\else
\def\TeX {\textsc{TeX}}
@@ -212,14 +220,24 @@
%% font commands
\def\mytt#1{\relax
- \ifmmode \mathtt{#1}
- \else {\upshape\ttfamily#1}\fi}
+ \ifmmode
+ \mathtt{#1}%
+ \else
+ {\upshape\ttfamily#1}%
+ \fi
+}
\def\mfc{% % Metafont/Post code
\begingroup
\ttfamily\catcode`\_=12 \grabit
}
\def\grabit#1{#1\endgroup}
-\def\_{{\upshape\ttfamily\char`\_}}
+% like \mfc, but no line breaks
+\def\codebox{%
+ \hbox\bgroup
+ \ttfamily\catcode`\_=12 \boxgrabit
+}
+\def\boxgrabit#1{#1\egroup}
+\def\_{\mytt{\char`\_}}
\def\prog#1{{\mdseries\scshape#1}} % programs, packages
\let\file\mytt % filenames
\def\opt#1{{\upshape\sffamily#1}} % package options
@@ -228,7 +246,7 @@
\let\email\file % email addresses
\let\mail \file % (ditto)
\let\dim \file % TeX and Metafont dimensions
-\let\kw \opt % MF key words, e.g., numeric
+\let\kw \opt % MF key word like numeric
%% TeX code %%%%%%%%%%%%%%%
{
@@ -254,7 +272,7 @@
\let\@mkboth\markboth
\def\sectionmark##1{\thispagestyle{plain}}
\def\subsectionmark##1{%
- \markright {\thesection\quad##1}}%
+ \markright {\thesubsection\enspace##1}}%
\def\subsubsectionmark##1{}}
\if@chapters
@@ -264,7 +282,7 @@
\@starttoc{toc}\clearpage\pagenumbering{arabic}}
\fi
-%% figures (none so far):
+%% figures:
\@fptop=-\@fpsep
\@addtoreset{figure}{section}
diff --git a/Master/texmf-dist/doc/generic/mfpic/mfpguide.pdf b/Master/texmf-dist/doc/generic/mfpic/mfpguide.pdf
index 677cda5f652..65f2568ddcc 100644
--- a/Master/texmf-dist/doc/generic/mfpic/mfpguide.pdf
+++ b/Master/texmf-dist/doc/generic/mfpic/mfpguide.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/mfpic/mfpguide.tex b/Master/texmf-dist/doc/generic/mfpic/mfpguide.tex
index c25b22ba7e4..01cba684717 100644
--- a/Master/texmf-dist/doc/generic/mfpic/mfpguide.tex
+++ b/Master/texmf-dist/doc/generic/mfpic/mfpguide.tex
@@ -1,5 +1,5 @@
% File: mfpguide.tex
-% A part of mfpic 1.06 2011/03/08
+% A part of mfpic 1.10 2012/12/03
%
% Tutorial on mfpic
\documentclass[letterpaper]{article}
@@ -17,26 +17,28 @@
\else
\usepackage[dvips,final]{graphics}
\fi
+
\usepackage[metapost]{mfpic}
\opengraphsfile{guide}
+
\dotsize1pt
\ifpdf
\expandafter\usepackage\expandafter
- [\mfpHyOpts]{hyperref}
+ [\mfpHyOpts,plainpages=false,naturalnames=true]{hyperref}
\expandafter\pdfstringdefDisableCommands\expandafter
{\mfpHyDisable}
+
\fi
\def\theHfigure{\thefigure}
+\begin{document}
+
\title{\Mfp: A Short Introduction}
-\author{Daniel H. Luecking\thanks{Copyright 2003--2011, Daniel H.
-Luecking (luecking at uark dot edu)}}
+\author{Daniel H. Luecking\thanks{luecking at uark dot edu}}
\date{\mfpfiledate}
-\begin{document}
-
\maketitle
\tableofcontents
@@ -100,17 +102,17 @@ close to figure~\ref{fig1}.
\end{mfpic}
\end{mfpfig}
-What can go wrong? According to Murphy's Law: anything. If \mfp{} is
-not properly installed, one could obtain messages of files not found. If
+What can go wrong? According to Murphy's Law: anything. If \mfp{} is not
+properly installed, one could obtain messages of files not found. If
that happens, determine (from your \TeX{} system's documentation) where
-\TeX{} input files should go and make sure that \file{mfpic.tex} and
-\file{mfpic.sty} reside there. Similarly, find out where \MP{} inputs
-should go and make sure that \file{grafbase.mp} and \file{dvipsnam.mp}
-reside there. Then run whatever command your \TeX{} system might require
-to ``update the filename database''. You may safely ignore the message
-from \mfp{} itself that \file{myfigs.1} is not found (on the first run
-of \pdfLaTeX). This file should be created only after running
-\texttt{mpost}.
+\TeX{} input files should go and make sure that \file{mfpic.sty},
+\file{mfpic.tex} and \file{mfpicdef.tex} reside there. Similarly, find
+out where \MP{} inputs should go and make sure that \file{grafbase.mp}
+and \file{dvipsnam.mp} reside there. Then run whatever command your
+\TeX{} system might require to ``update the filename database''. You may
+safely ignore the message from \mfp{} itself that \file{myfigs.1} is not
+found (on the first run of \pdfLaTeX). This file should be created only
+after running \texttt{mpost}.
If you get an error message from \LaTeX{}, carefully check your typing.
Also check whether an older version of \mfp{} might have been used
@@ -149,7 +151,7 @@ to be sure of seeing the changes.
One thing you might notice about figure~\ref{fig1} is that the ellipse
is positioned quite a bit above the base line of the text. This is
because \mfp{} reserves the amount of space specified in the arguments
-of the \env{mfpic} environment. These arguments are
+of the \env{mfpic} environment. These arguments were
\verb$[72]{-1}{1}{-1}{1}$, which means that each unit in the picture is
72 times the value of \cs{mfpicunit}, that is, about one inch. The first
pair of mandatory arguments, \verb${-1}{1}$, indicate the
@@ -413,8 +415,8 @@ also takes an optional argument: the number of degrees to rotate the
ellipse. Here we list some of the more common such figures. Remember
that all of them will produce some sort of line drawing if used alone.
They can be preceded by \verb$\dashed$ to make the lines dashed or
-\verb$dotted$ to make them dotted. If the figure is a closed curve,
-\verb$\gfill$ will fill them in.
+\verb$\dotted$ to make them dotted. If the figure is a closed curve,
+\verb$\gfill$ will fill it in.
\begin{verbatim}
\begin{mfpic}[72]{0}{4}{0}{1}
\rect{(0,0),(1,.75)}
@@ -431,7 +433,7 @@ Other possibilities are a three-point form (option \texttt{[t]}), a
polar form (option \texttt{[p]}), and a center-point-sweep form (option
\texttt{[c]}, specify a center, starting point, and angle). See the
manual for details. The default (what would be assumed if no optional
-argument is given) is \oarg{s} and is called the point-sweep form.
+argument is given) is \oarg{s} and is called the ``point-sweep'' form.
\begin{mfpfig}{fig11}
\begin{mfpic}[72]{0}{4}{0}{1}
\rect{(0,0),(1,.75)}
@@ -788,7 +790,7 @@ This illustrates another property of \mfp{} macros: the combination of a
rendering prefix and a figure is also treated the same as a figure in
its own right: the same figure as the one that follows. In fact, the
only difference between \cs{rect} and \cs{draw}\cs{rect} in this
-example is that the second one has a minor (!) side effect: the
+example is that the second one has a minor(!) side effect: the
rectangle is drawn.
Finally, try to guess what happens if we add another prefix at the
@@ -1151,7 +1153,7 @@ Anyway, here are a few examples, illustrating the use of \cs{arrow}, and
some of its optional arguments.
\begin{verbatim}
\begin{mfpic}{0}{4}{0}{4}
- \arrow[r5]\circle{(1,1),.5}
+ \arrow[r-5]\circle{(1,1),.5}
\arrow[b4pt]\arrow\polyline{(3,2),(3,0)}
\arrow[cred]\reverse\arrow\polyline{(0,3),(2,3)}
\arrow[l 5pt]\rect{(4,2),(2,4)}
@@ -1161,7 +1163,7 @@ See figure~\ref{fig31} for the results of this example. There are four
possible optional arguments, the first character inside the brackets
tells what option the rest of the argument applies to. The first example
above starts with `\texttt{r}', which stands for `rotate' and asks for
-the arrowhead to be rotated 5 degrees (positive rotation means
+the arrowhead to be rotated $-5$ degrees (positive rotation means
anticlockwise, negative means clockwise). This is frequently useful for
arrows on curved paths, as the default direction (tangent to the path)
often just looks wrong). The second example starts with `\texttt{b}',
@@ -1180,7 +1182,7 @@ the arrowhead to 5 points (from the \verb$3pt$ default).%
case where it will cause no harm.}
\begin{mfpfig}{fig31}
\begin{mfpic}{0}{4}{0}{4}
- \arrow[r5]\circle{(1,1),.5}
+ \arrow[r-5]\circle{(1,1),.5}
\arrow[b4pt]\arrow\polyline{(3,2),(3,0)}
\arrow[cred]\reverse\arrow\polyline{(0,3),(2,3)}
\arrow[l 5pt]\rect{(4,2),(2,4)}
@@ -1407,20 +1409,24 @@ Here's an example comparing the two smooth methods (figure~\ref{fig34}).
A word about the labels: we turned off \opt{mplabels} with the command
\verb$\nomplabels$, because we used a command (\verb$\cs$) defined for
this document and not known to basic \TeX{} or \LaTeX. The labels
-therefore are position by \LaTeX{} while it assembles this document,
+therefore are positioned by \LaTeX{} while it assembles this document,
instead of by \MP{} which would call a separate instance of \TeX{} or
\LaTeX{} where \cs{cs} was unknown. We could have kept \opt{mplabels},
provided we had used \verb$\mfpverbtex$ to write the appropriate
\LaTeX{} preamble to the \file{.mp} output. It would need to be some
subset of the preamble of this document.
-\chapter{Appendices}
+
+\chapter*{Appendices}
+\addcontentsline{toc}{section}{Appendices}
In addition to \pdfLaTeX, \Mfp{} works with plain \pdfTeX, \LaTeX, and
plain \TeX{}. Instead of \MP{} as the figure processor, \MF{} can also
be used. Let's start with the difference between using \mfp{} in a
plain~\TeX{} document and using it in a \LaTeX{} document.
+\renewcommand\thesubsection{\Alph{subsection}}
+
\section{\Mfp{} in plain \TeX}
Here is a sample plain \pdfTeX{} document with results the same as our
@@ -1433,7 +1439,7 @@ first ``Hello, world'' example. Let's call this file \file{plfirst}
\mfpic[72]{-1}{1}{-1}{1}
\ellipse{(0,0),1,.5}
\endmfpic
- \closegraphsfile
+\closegraphsfile
\end
\end{verbatim}
The main difference is the lack of \LaTeX{} commands. The crucial
diff --git a/Master/texmf-dist/doc/generic/mfpic/mfpic-doc.pdf b/Master/texmf-dist/doc/generic/mfpic/mfpic-doc.pdf
index 03c8f7a498b..58105a908d1 100644
--- a/Master/texmf-dist/doc/generic/mfpic/mfpic-doc.pdf
+++ b/Master/texmf-dist/doc/generic/mfpic/mfpic-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/mfpic/mfpic-doc.tex b/Master/texmf-dist/doc/generic/mfpic/mfpic-doc.tex
index f4aeb3a2ff4..603a98e59d0 100644
--- a/Master/texmf-dist/doc/generic/mfpic/mfpic-doc.tex
+++ b/Master/texmf-dist/doc/generic/mfpic/mfpic-doc.tex
@@ -1,5 +1,5 @@
% File: mfpic-doc.tex
-% A part of mfpic 1.06 2011/03/08
+% A part of mfpic 1.10 2012/12/03
%
% Documentation of mfpic macros
\documentclass[letterpaper]{article}
@@ -12,11 +12,12 @@
\usepackage{mathptmx}
\usepackage[scaled]{luximono}
\renewcommand\sfdefault{cmss}
-\newcommand\sgn{\mathop{\mathrm{sgn}}\nolimits}
% Fake chapters (really sections):
\usepackage[chapters]{mfpdoc}
\pagestyle{mfpdoc}
+\newcommand\sgn{\mathop{\mathrm{sgn}}\nolimits}
+
\usepackage{makeidx}
\makeindex
@@ -32,7 +33,8 @@
\stepcounter{secnumdepth}
\title{\Mfp{}: Pictures in \TeX{}\\ with Metafont and
-MetaPost\thanks{Copyright 2002--2011, Daniel H. Luecking}}
+MetaPost\thanks{Copywrite 2002--2012, Daniel H. Luecking}}
+
\author{%
Daniel H. Luecking%
@@ -56,6 +58,7 @@ Daniel H. Luecking%
\chapter{Introduction}\label{introduction}
\thispagestyle{plain}
+
\section{Why?}\label{why}
Tom got the idea for \mfp{}%
@@ -99,6 +102,7 @@ access them. Consequently, switches (options) have been added to access
some of them. When these are used, output files may no longer be
compatible with \MF{}.
+
\section{Who?}\label{author}
The original \mfp{} (and still the core of the current version) was written
@@ -118,6 +122,7 @@ The addition of \MP{} support was carried out by Dan Luecking around
since then, with help from Geoffrey and a few others mentioned in the
Acknowledgements.
+
\section{What?}\label{manifest}
See the \file{README} file for a list of files in the distribution and a
@@ -130,12 +135,13 @@ to \mfp{}'s capabilities: \file{mfpic.dtx}, \file{mfpic.ins} and
\LaTeX{}.\\
\file{grafbase.mf}, required only if \MF{} will be processing
figures.\\
- \file{grafbase.mp} and \file{dvipsnam.mp}, needed only if \MP{} will
- be the processor.
+ \file{grafbase.mp}, \file{dvipsnam.mp} and \file{mfpicdef.tex}, needed
+ only if \MP{} will be the processor.
\end{display}
-The file \file{install.txt} gives some guidance on the proper location for the
+The README file also gives some guidence on the proper location for the
installation of these files.
+
\section{How?}\label{process}
Some guidance on writing files that contain \mfp{} figures can be found
@@ -159,8 +165,8 @@ this.%
\footnote{The document \textit{Some experiences on running Metafont
and MetaPost}, by Peter Wilson, can be useful for beginners. Fetch
\file{CTAN/info/metafp.pdf}. `\file{CTAN}' means the Comprehensive
- \TeX{} Archive Network. You can access \file{CTAN} by pointing your
- web browser at \url{http://mirror.ctan.org/}\,.}) %
+ \TeX{} Archive Network. You can find the mirror nearest you by
+ pointing your browser at \url{http://www.ctan.org/}\,.}) %
Typically, you just type
\begin{verbatim}
mpost pics.mp
@@ -284,7 +290,7 @@ handled by \MP{}).
\smallskip
\emph{Note}: In this manual, when describing \mfp{} operations, we will
-often refer to ``\MF{}'' when we really mean ``\MF{} or \MP{}''. This
+often refer to `\MF{}' when we really mean ``\MF{} or \MP{}''. This
will especially be the case whenever we need to refer to commands in the
two languages which are substantially the same, but occasionally we will
even talk about ``running \MF{}'' when we mean running one or the other
@@ -292,7 +298,7 @@ program \texttt{mf} or \texttt{mpost} to process the figures. If we need
to discriminate between the two processors, (for example when they have
different behavior) we will make the difference explicit.
-A similar shorthand is used when referring to ``\TeX{}''. It should not be
+A similar shorthand is used when referring to `\TeX{}'. It should not be
taken to mean ``plain \TeX{}'', but rather whatever version of \TeX{} is used
to process the source file: plain \TeX{}, \LaTeX{}, \pdfTeX{}, or
\pdfLaTeX{}. Also \AmSTeX{}, \prog{eplain} and some other variants. When
@@ -319,10 +325,10 @@ options are processed. You can create such a file containing an
have as default. Actual options to \cs{usepackage} will override these
defaults, of course. And so will any of the commands below.
-Finally, if a file named \file{mfpic.usr} can be found, it will be input at the
-end of the loading of \mfp{}. The user can create such a file containing
-any of the commands of this section that he would like to have as
-default, plus any other \TeX{} code.
+Finally, if a file named \file{mfpic.usr} can be found, it will be input
+at the end of the loading of \mfp{}. The user can create such a file
+containing any of the commands of this section that he would like to
+have as default, plus any other \TeX{} code.
\section{\opt{metapost}, \opt{metafont}, \cs{usemetapost}, \cs{usemetafont}.}%
@@ -381,6 +387,7 @@ preamble of \LaTeX{} code take care to make sure \MP{} calls \LaTeX{}
purpose, or an environmental variable named \texttt{TEX} may be set
equal to \texttt{latex} in the command shell of your operating system.).
+
\section{\opt{overlaylabels}, \cs{overlaylabels}, \cs{nooverlaylabels}.}
\label{overlaylabels}
\index{overlaylabels@\opt{overlaylabels}}%
@@ -413,6 +420,7 @@ subsequent figures, inside a figure they affect all subsequent text in
that figure. The commands and option are ignored under the metafont
option.
+
\section{\opt{truebbox}, \cs{usetruebbox}, \cs{notruebbox}.}%
\label{truebbox}%
\index{truebbox@\opt{truebbox}}%
@@ -474,6 +482,7 @@ environment they should come before the \cs{tcaption} command and affect
only it, otherwise they affect all subsequent figures. They should not
be used in the argument of a \cs{tcaption} command.
+
\section{\opt{raggedcaptions}, \cs{useraggedcaptions},
\cs{noraggedcaptions}.}\label{raggedcaptions}
\index{raggedcaptions@\opt{raggedcaptions}}%
@@ -481,17 +490,18 @@ be used in the argument of a \cs{tcaption} command.
\index{noraggedcaptions@\cs{noraggedcaptions}}
The \opt{raggedcaptions} option causes multiline captions created by
-\cs{tcaption} to have raggedright lines. If \opt{centeredcaptions}
-is on, both sides will be ragged. The command \cs{noraggedcaptions}
-restores the default: all lines except the last justified. The last is
-either centered or flush left according to whether
-\opt{centeredcaptions} is on or off.
+\cs{tcaption} to have all lines ragged\-right. If \opt{centeredcaptions}
+is on, both sides will be ragged. This option can be turned off with the
+command \cs{noraggedcaptions}. This is the default: to have all lines
+except the last justified. The last line is either centered or flush
+left according to whether \opt{centeredcaptions} is on or off.
The commands can be issued anywhere. If inside an \env{mfpic}
environment they should come before the \cs{tcaption} command and affect
only it, otherwise they affect all subsequent figures. They should not
be used in the argument of a \cs{tcaption} command.
+
\section{\opt{debug}, \cs{mfpicdebugtrue},
\cs{mfpicdebugfalse}.}\label{debug}
\index{debug@\opt{debug}}%
@@ -506,6 +516,7 @@ a definition to the command \cs{mfpicdebug} prior to loading. Any
definition will work because \prog{mfpic} only checks whether it is
defined.
+
\section{\opt{clearsymbols}, \cs{clearsymbols}, \cs{noclearsymbols}.}
\index{clearsymbols@\opt{clearsymbols}}%
\index{clearsymbols@\cs{clearsymbols}}%
@@ -568,6 +579,7 @@ debugged, some time might be saved (with either \opt{metafont} or
\opt{metapost}) by not writing the output file again, then \opt{nowrite}
can be used.
+
\section{\opt{mfpreadlog}, \cs{mfpreadlog}.}\label{readlog}
\index{mfpreadlog@\opt{mfpreadlog}}%
\index{mfpreadlog@\cs{mfpreadlog}}
@@ -644,8 +656,8 @@ only), \kw{path}, \kw{picture} and \kw{boolean}.%
is sometimes called the vacuous type, but doesn't allow (or need)
variables of this type.}
In \MP{} version 1.000, a tenth data type was added, \kw{cmykcolor}, and
-the \kw{color} data type can be referred to as `\kw{rgbcolor}' when a
-distinction is necessary.
+the \kw{color} data type can be referred to as `\kw{rgbcolor}' if one
+wants to emphasize the distinction.
A \emph{variable} is a symbolic name, which can be a single letter such
as \mfc{A}, or a descriptive name like \mfc{origin}. Any sequence of
@@ -889,17 +901,17 @@ environment, after which the number is increased by one for each new
\env{mfpic} environment. This number is used internally to include the
picture. It is also transmitted to the output file where it is used as
the argument to a \gbc{beginmfpic} command. In \MF{} this number becomes
-the position of the character in the font file, while in \MP{} it is the
-extension on the graphic file that is output. The above command tells
-\mfp{} to ignore this sequence and number the next \env{mfpic}
+the position of the character in the font file, while in \MP{} it is
+part of the name of the graphic file that is output. The above command
+tells \mfp{} to ignore this sequence and number the next \env{mfpic}
figure with \meta{num} (and the one after that $\meta{num}+1$, etc.). It
is up to the user to make sure no number is repeated, as no checking is
done. Numbers greater than 255 may cause errors, as \TeX{} assumes that
-characters are represented by 8-bit numbers. If the first figure is to
-be numbered something other than $1$, then, under the \opt{metapost}
-option, this command should come before \cs{opengraphsfile}, as that
-command checks for the existence of the first numbered figure to
-determine if there are figures to be included.
+characters are represented by numbers no larger than that. If the first
+figure is to be numbered something other than $1$, then, under the
+\opt{metapost} option, this command should come before
+\cs{opengraphsfile}, as that command checks for the existence of the
+first numbered figure to determine if there are figures to be included.
\begin{cd}\pagelabel{everymfpic}
\cs{everymfpic}\marg{\meta{commands}}\\
@@ -909,11 +921,11 @@ determine if there are figures to be included.
\end{cd}
These commands store the \meta{commands}. The first arranges for these
-commands to be issued first thing in every \env{mfpic} environment and
-the second arranges for its commands to be issued as the last thing in
-every such environment. These could be any commands that make sense
-inside that environment. Their purpose is mainly to save typing if there
-is identical setup being performed in every picture.
+commands to be issued at the start of every \env{mfpic} environment and
+the second arranges for its commands to be issued at the end of every
+such environment. These could be any commands that make sense inside
+that environment. The purpose of these commands is to save typing if
+there is identical setup being performed in every picture.
\begin{cd}\pagelabel{envusage}
\cs{begin}\marg{mfpic}\texttt{...}\cs{end}\marg{mfpic}%
@@ -927,19 +939,21 @@ with \mfp{} illustrates this use of an \env{mfpic} environment in
\LaTeX{}.
\medskip
-A word about \TeX{} groups inside \env{mfpic} environments. These can be
-useful to limit the scope of declarations or of changes to some
-variables. However, they do not limit the scope of changes to the figure
-file that is being written, so there is a danger that \TeX{} and \MF{}
-will have different values. There are also some \mfp{} command that need
-to be at the outermost level. Thus, grouping should generaly be avoided
-except for those groups provided by \mfp{} commands.
+One should be careful using \TeX{} groups inside \env{mfpic}
+environments. These can be useful to limit the scope of declarations or
+of changes to some variables. However, they do not limit the scope of
+changes to the figure file that is being written, so there is a danger
+that \TeX{} and \MF{} will have different values. There are also some
+\mfp{} commands that need to be at the outermost level. Thus, grouping
+should generally be avoided except for those groups provided by \mfp{}
+commands.
\medskip
For the remainder of the macros, the numerical parameters are expressed
in graph units, the units of the local coordinate system specified by
\cs{mfpic}, unless otherwise indicated.
+
\section{Common objects.}\label{figures}
The \mfp{} macros that draw things can be roughly divided into two
@@ -1028,7 +1042,7 @@ are:
\gbc{SolidSquare}\index{SolidSquare@\gbc{SolidSquare}},
\gbc{SolidTriangle}\index{SolidTriangle@\gbc{SolidTriangle}},
\gbc{SolidStar}\index{SolidStar@\gbc{SolidStar}},
- \gbc{Cross}\index{Cross@\gbc{Cross}} and
+ \gbc{Cross}\index{Cross@\gbc{Cross}}, and
\gbc{Plus}\index{Plus@\gbc{Plus}}.
\end{display}
The names should be self-explanatory, the `\gbc{Solid}' ones are filled
@@ -1093,7 +1107,7 @@ example, after the command \cs{pointdef}\marg{A}\texttt{(1,3)}, \cs{A}
expands to \texttt{(1,3)}, while \cs{Ax} and \cs{Ay} expand to
\texttt{1} and \texttt{3}, respectively. If \opt{mplabels} is in effect
one can use \cs{A} to specify where to place a text label, but if \TeX{}
-is placing labels one must use \texttt{ (\cs{Ax},\cs{Ay})}. In most
+is placing labels one must use \texttt{(\cs{Ax},\cs{Ay})}. In most
other cases, one can use \cs{A} where a pair or point is required.
\begin{cd}\pagelabel{polyline}
@@ -1131,15 +1145,15 @@ diagonally opposite corners. The same rectangle can be specified in four
different ways: either pair of opposite corners in either order.
It is occasionally helpful to know that connected paths like those
-produced by \cs{polyline} or \cs{rect} have a \emph{start} and an
-\emph{end} as well as \emph{sense} (or direction). The path produced by
-\cs{polyline} starts at the first listed point and ends at last, having
-the direction determined by the order of the points. For \cs{rect} the
-sense may be clockwise or anticlockwise depending on the corners used:
-it starts by moving horizontally from the first listed point.
-Several \mfp{} macros (such as those that add arrowheads) treat the
-beginning and the end of a path differently, or adjust their behavior
-according to the sense of the curve.
+produced by \cs{polyline} or \cs{rect} have a \emph{start} and a
+\emph{finish} as well as \emph{sense} (or direction). The path produced
+by \cs{polyline} starts at the first listed point and ends at last,
+having the direction determined by the order of the points. For
+\cs{rect} the sense may be clockwise or anticlockwise depending on the
+corners used: it starts by moving horizontally from the first listed
+point. Several \mfp{} macros (such as those that add arrowheads) treat
+the beginning and the end of a path differently, or adjust their
+behavior according to the sense of the curve.
\begin{cd}\pagelabel{regpolygon}
\cs{regpolygon}\marg{\meta{num}}\marg{\meta{name}}%
@@ -1400,14 +1414,15 @@ value. The last two commands are abbreviations for
\cs{setaxismarks}\marg{x}\marg{\meta{pos}} and
\cs{setaxismarks}\marg{y}\marg{\meta{pos}}, respectively.
-Not all combinations make sense (for example, \texttt{ontop} for the
-right side axis). In these cases, no error message is produced:
-\gbc{ontop} and \gbc{onleft} give the same results, as do \gbc{onbottom}
-and \gbc{onright}. The parameters \gbc{inside} and \gbc{outside} make no
-sense for the $x$- and $y$-axes, but if they are used then \gbc{inside}
-means \gbc{ontop} for the $x$-axis and \gbc{onright} for the $y$-axis.
-These words are actually \MF{} numeric variables and the variables
-\gbc{ontop} and \gbc{onleft}, for example, have the same value.
+Not all combinations make sense (for example, \gbc{ontop} for the right
+side axis). In these cases, no error message is produced. These words
+are actually \MF{} numeric variables and the variables \gbc{ontop} and
+\gbc{onleft}, for example, have the same value. Thus, using \gbc{ontop}
+for the right axis will have the same effect as \gbc{onleft}. Similarly,
+\gbc{onright} and \gbc{onbottom} are the same. The parameters
+\gbc{inside} and \gbc{outside} usually make no sense for the $x$- and
+$y$-axes, but if they are used then \gbc{inside} means \gbc{ontop} for
+the $x$-axis and \gbc{onright} for the $y$-axis.
\begin{cd}\pagelabel{grid}
\cs{grid}\oarg{\meta{size}}\marg{\meta{xsep},\meta{ysep}}\\
@@ -1535,7 +1550,7 @@ The following draws a rotational field, omitting the inside of the
circle of radius $1$, where the arrows would be excessively long, and
especially avoiding $(0,0)$ where the vector field is undefined.
\begin{verbatim}
-\vectorfield[2.5pt]{.25,.25}{.5*(-y,x)/(x**2 + y**2)}{x**2 + y**2 >= 1}
+\vectorfield[2.5pt]{.25,.25}{.5*(-y,x)/(x**2+y**2)}{x**2+y**2 >= 1}
\end{verbatim}
The following is the same field, represented by arrows whose locations
are regularly spaced in polar coordinates.
@@ -1665,7 +1680,7 @@ increased by $180$ degrees
\item[\oarg{a}] The alternative polar form differs from the polar form
above only in the order of the arguments. This seems (to me) a more
reasonable order, and matches the order \cs{sector} requires (see below).
-The p option is retained for backward compatibility.
+The \texttt{[p]} option is retained for backward compatibility.
\item[\oarg{c}] The \textit{center-point-angle form} draws the circular
arc with center \meta{$c$}, starting at the point \meta{$p_1$}, and
@@ -1682,16 +1697,16 @@ form.
\item[\oarg{r}] The \textit{point-radius form} draws an arc on the
circle that \cs{circle}\oarg{r} would produce. The arc starts at the
point \meta{$p_0$} and ends at \meta{$p_1$}. Of the two possible arcs on
-that circle, it produces the shorter one that covers an angle $\theta$
-from $0$ to $180$ degrees measured anticlockwise around the center
-of the circle. A negative radius is a mathematical error, but the result
-is the short arc on the other circle with a clockwise sense.
-
-\item[\oarg{q}] The \textit{alternative point-radius form} is the same as
-\oarg{r} except it produces the longer arc, that covers an angle
-$\theta$ between $180$ and $360$ degrees measured anticlockwise around
-the center of the circle. A negative radius is a mathematical error, but
-the result is the longer arc on the other circle with a clockwise sense.
+that circle, it produces the shorter one: the one with an angle $\theta$
+less than $180$ degrees measured anticlockwise around the center of the
+circle. A negative radius is a mathematical error, but the result is the
+short arc on the other circle with a clockwise sense.
+
+\item[\oarg{q}] The \textit{alternative point-radius form} is the same
+as \oarg{r} except it produces the longer arc: the one with angle
+$\theta$ larger than $180$ degrees measured anticlockwise around the
+center of the circle. A negative radius is a mathematical error, but the
+result is the longer arc on the other circle with a clockwise sense.
\end{description}
For both options \oarg{r} and \oarg{q} the angle is computed and then
@@ -1727,9 +1742,33 @@ ellipse by \meta{$\theta$} degrees anticlockwise around its center.
Ellipses may also be created by differentially scaling a circle and
perhaps rotating the result. See subsection~\ref{transformation}.
-
-When dealing with arcs and circles, it is useful to work in polar
-coordinates:
+\begin{cd}\pagelabel{fullellipse}
+\cs{fullellipse}\marg{\meta{$C$},\meta{$M_1$},\meta{$M_2$}}\\%
+\cs{halfellipse}\marg{\meta{$M_1$},\meta{$M_2$},\meta{$M_3$}}\\%
+\cs{quarterellipse}\marg{\meta{$M_1$},\meta{$A$},\meta{$M_2$}}%
+\index{fullellipse@\cs{fullellipse}}%
+\index{halfellipse@\cs{halfellipse}}%
+\index{quarterellipse@\cs{quarterellipse}}%
+\end{cd}
+
+For any parallelogram there is a unique ellipse incribed in it which is
+tangent to the sides at their midpoints. The above allows one to obtain
+that ellipse and parts of it. The input to \cs{fullellipse} is the
+center \meta{$C$} of that parallelogram and the midpoints \meta{$M_1$}
+and \meta{$M_2$} of two adjacent sides. For $\cs{halfellipse}$, one
+supplies the midpoints \meta{$M_1$}, \meta{$M_2$}, and \meta{$M_3$} of
+three successive sides. Lastly, \cs{quarterellipse} requires the
+midpoints of two adjacents sides and the corner \meta{$A$} between them.
+Internally, a quarter-circle is transformed to produce the
+quarter-ellipse and the other two are built up out of two or four such
+quarter-ellipses.
+
+The reasoning behind my choice of parameters is based on the anticipated
+use of these commands. For example, I wanted \cs{quarterellipse} to be
+used to round a corner represented by the three points $M_1$,
+$A$ and $M_2$. In order for the quarter-ellipse to have
+the same direction at $M_1$ and $M_2$ as the polygon $M_1AM_2$, the
+associated parallelogram has to have midpoints at $M_1$ and $M_2$.
\begin{cd}\pagelabel{plr}
\cs{plr}\marg{(\meta{$r_0$},\meta{$\theta_0$}),%
@@ -1737,13 +1776,14 @@ coordinates:
\index{plr@\cs{plr}}%
\end{cd}
-The macro \cs{plr} causes \MF{} to replace the specified list of polar
-coordinate pairs by the equivalent list of rectangular (cartesian)
-coordinate pairs. Through \cs{plr}, commands designed for rectangular
-coordinates can be applied to data represented in polar coordinates. It
-must be cautioned that this wholesale conversion of a list applies only
-to commands that take a list consisting of an arbitrary number of
-points, such as \cs{polyline}.
+When dealing with arcs and circles, it is useful to work in polar
+coordinates. The macro \cs{plr} causes \MF{} to replace the specified
+list of polar coordinate pairs by the equivalent list of rectangular
+(cartesian) coordinate pairs. Through \cs{plr}, commands designed for
+rectangular coordinates can be applied to data represented in polar
+coordinates. It must be cautioned that this wholesale conversion of a
+list applies only to commands that take a list consisting of an
+arbitrary number of points, such as \cs{polyline}.
The effect of \cs{plr} is to apply a \MF{} command, \gbc{polar}, to each
point in the list, producing a new list. This \MF{} command can also be
@@ -1775,8 +1815,34 @@ points with positive $y$-coordinate In this case, the \meta{center} must
be in the upper half-plane and the \meta{radius} must still be less than
$1$. If you are not versed in hyperbolic geometry, be warned that the
actual diameter of the resulting circle is on the order of $2y/(1-R)$,
-where $R$ is the \meta{radius}. This can be quite large even for modest
-values of $R$ and $y$.
+where $R$ is the \meta{radius} and $y$ is the $y$-coordinate of
+\meta{center}. This can be quite large even for modest values of $R$ and
+$y$.
+
+Finally, an arc-producing macro. This is also related to the hyperbolic
+geometry of a disk or a half-plane. The hyperbolic geometry includes a
+notion of distance that allow one to determine `shortest' path between
+two points. This shortest path is called a `geodesic' and it turns out
+(in the case of the upper half-plane or a disk) to be an arc of a
+circle: the unique circle that passes through both points and meets the
+boundary (of the half-plane or disk) at right angles.
+
+\begin{cd}\pagelabel{hypergeodesic}
+\cs{hypergeodesic}\marg{$z_1$,$z_2$}\\
+\cs{hypergeodesic}*\marg{$z_1$,$z_2$}%
+\index{hypergeodesic@\cs{hypergeodesic}}%
+\end{cd}
+
+This produces the hyperbolic geodesic from $z_1=(x_1,y_1)$ to
+$z_2=(x_2,y_2)$. For guaranteed results both points should be in the
+unit disk (i.e., $|z_1| < 1$ and $|z_2| < 1$) or, for the star form,
+both in the upper half-plane (i.e., $y_1 > 0$ and $y_2 > 0$). However,
+if these are not satisfied an arc of the circle described above will be
+drawn whenever not prevented by a numeric overflow. The star form
+produces the geodesic for points in the upper half-plane. The normal
+form produces the geodesic for points in the unit disk (inside of the
+circle of radius $1$ and center $(0,0)$). One can use transforms of
+these to get geodesics suitable for other disks and other half-planes.
\subsection{Curves}\label{curves}
@@ -1816,6 +1882,7 @@ loaded, but that can be changed with the following command.
This sets the default tension for all commands that take an optional
tension parameter.
+\medskip
Sometimes one would like a convex set of points to produce a convex
curve. This will not always be the case with \cs{curve} or \cs{cyclic}.
You can verify this with the following example, where the list of points
@@ -1906,7 +1973,7 @@ it needs to be inside an \env{mfpic} environment. Starting with version
0.9 of \mfp{} this is no longer required, but the command name
\cs{mfpbarchart} must be used outside (in case some other package also
defines \cs{barchart}). One can use any of the four synonyms listed that
-start with `\cs{mfp}'. The command to draw the bars is still required to
+start with `\cs{mfp}'. The commands to draw the bars are still required to
be inside an \env{mfpic} environment.
\meta{h-or-v} should be \texttt{v} if you want the ends of the bars to
@@ -1933,7 +2000,7 @@ reverse them by making \meta{sep} negative, and making \meta{start} the
top edge of the first bar.
The fraction \meta{r} should be between $-1$ and $1$. A negative value
-reverses the direction from the `leading edge' of the bar to the
+reverses the direction from the ``leading edge'' of the bar to the
`trailing edge'. For example, if one bar chart is created with
\begin{ex}
\cs{barchart}\oarg{1,1,-.4}\marg{h}\marg{$\ldots$}
@@ -2018,6 +2085,27 @@ then the absolute coordinates \texttt{(\meta{x},\meta{y})} in the graph
where the point of the wedge should be placed.
+\subsection{Braces}
+
+This figure is intended to group some graphical objects and label them.
+
+\begin{cd}\pagelabel{gbrace}
+\cs{gbrace}\marg{\meta{$z_1$},\meta{C},\meta{$z_2$}}%
+\index{grbace@\cs{gbrace}}%
+\end{cd}
+
+This figure macro creates the shape of a brace (i.e., a `$\}$') with its
+ends at \meta{$z_1$} and \meta{$z_2$} and its `center' cusp at
+\meta{C}. The three points must be expressed as ordered pairs or as
+\MF{} pair expressions, and must be separated by commas. The `width' of
+the brace (the distance from \meta{C} to the line through the other
+two points) is computed automatically and should not be $0$. The cusp of
+the brace will not necessarily be in the center of the brace. Users
+position it with their choice of \meta{C}. The cusp should not be
+positioned too close to one of the endpoints as this can distort the
+brace.
+
+
\section{Colors in \mfp{}.}\label{colors}
\subsection{\CMP{} color functions}\label{mpcolors}
@@ -2053,9 +2141,9 @@ numeric: $0$ for black, $1$ for white).
All the names in the \LaTeX{} \prog{color} package's \file{dvipsnam.def}
have also been predefined by \mfp{} as color variable names. Since \MP{}
-allows color expressions, colors may be added (as long as they are the
-same type) and multiplied by numerics. Multiplication by a number
-between $0$ and $1$ darkens a \kw{rgbcolor}, but lightens a
+allows color expressions, colors may be added together (as long as they
+are the same type) and multiplied by numerics. Multiplication by a
+number between $0$ and $1$ darkens a \kw{rgbcolor}, but lightens a
\kw{cmykcolor}.
Moreover, several \MP{} color functions have been defined in
@@ -2162,8 +2250,8 @@ returns either that number (recent \MP) or that multiple of \mfc{white}
(early \MP). In \MF{}, all three pass the (presumably numeric) argument
\meta{clr} unchanged.
-All three functions return some kind of black if \meta{clr} is not some
-kind of color, or has an unknown value.
+All three functions return some version of black if \meta{clr} is not a
+color of some type, or has an unknown value.
\subsection{Establishing \mfp{} default colors}\label{defaultcolors}
@@ -2185,6 +2273,7 @@ kind of color, or has an unknown value.
\index{backgroundcolor@\cs{backgroundcolor}}%
\end{cd}
+
These macros set the default color for various drawing elements. Any
curve (with one exception, those drawn by \cs{plotdata}), whether solid,
dashed, dotted, or plotted in symbols, will be in the color set by
@@ -2264,10 +2353,10 @@ The mandatory \meta{model} and \meta{colorspec} are as above.
\medskip
A final caution, the colors of an \mfp{} figure are stored in the
\file{.mp} output file, and are not related to colors used or defined by
-the \LaTeX{} \prog{color} package. In particular a color defined only by
-\LaTeX{}'s \cs{definecolor} command will remain unknown to \mfp{}.
-Conversely, \LaTeX{} commands will not recognize any color defined only
-by \cs{mfpdefinecolor}.
+any \LaTeX{} package (such as \prog{color} or \prog{xcolor}). In
+particular a color defined only by \LaTeX{}'s \cs{definecolor} command
+will remain unknown to \mfp{}. Conversely, \LaTeX{} commands will not
+recognize any color defined only by \cs{mfpdefinecolor}.
\subsection{\CMF{} colors}\label{MFcolor}
@@ -2343,7 +2432,7 @@ useful for understanding the \mfp{} system.
appending macros (see next), they invoke a default rendering of the
path (usually a drawing as a solid stroke) as the side effect.
-\item[Apending macros] These\index{prefix macro} pass their input
+\item[Appending macros] These\index{prefix macro} pass their input
unchanged as their output. Their side effect is the appending of
some object such as an arrow head or tail. Currently only the
various prefix macros whose names begin with \texttt{arrow} are
@@ -2368,6 +2457,7 @@ useful for understanding the \mfp{} system.
\end{description}
+
\subsection{Closure of paths}\label{closure}
It should be pointed out that the closure macros will leave already
@@ -2437,16 +2527,20 @@ circle through those three points.
\label{reversal}
\begin{cd}\pagelabel{reverse}
-\cs{reverse}$\ldots$%
+\cs{reverse}$\ldots$\\
+\cs{reversepath}\ldots%
\index{reverse@\cs{reverse}}
+\index{reversepath@\cs{reversepath}}
\end{cd}
This modifies the following path by reversing its sense. This will
affect the direction of arrows: bi-directional arrows can be coded with
\cs{arrow}\cs{reverse}\cs{arrow}$\ldots$, where the leftmost \cs{arrow}
prefix applies to the \emph{reversed} path. The order of endpoints for
-the following \env{connect} environment will also be affected.
-
+a \env{connect} environment will also be affected. The command
+\cs{reversepath} is exactly the same. It has been added (in vresion 1.10) to
+more closely match the names of other modification macros (see
+subsection~\ref{transformation}).
\begin{cd}\pagelabel{connect}
\cs{connect} $\ldots$ \cs{endconnect}%
@@ -2545,7 +2639,7 @@ produced by \cs{arc}, as in the following example:
\ \cs{draw}\oarg{red}\cs{partpath}\marg{0,.333}\\
\ \cs{circle}\marg{(0,0),1}
\end{ex}
-This will draw 1/3 of the circle in red and the rest in blue.
+This will draw 1/3 of this circle in red and the rest of it in blue.
\CMF{} cannot check if a path is really a circular arc. The \MF{} code,
like that of \cs{makesector} (see subsection~\ref{closure}), selects
@@ -2556,6 +2650,39 @@ the end of any following path to its beginning (or a straight line if
the three chosen points happen to lie in a straight line). However, the
result needn't bear any significant relation to the original path.
+\begin{cd}\pagelabel{interpolatepath}
+\cs{interpolatepath}\marg{\meta{frac},\meta{path1}}\dots
+\index{interpolatepath@\cs{interpolatepath}}
+\end{cd}
+
+This modifying macro takes the following path (call it \meta{path0}) and
+computes a new path that is \meta{frac} of the way ``between'' it and
+the argument \meta{path1}. The argument \meta{path1} would usually be
+the name of a \MF{} path variable used to store a figure (see \cs{store}
+from subsection~\ref{transformation}). However it can actually be any
+legal \MF{} path expression. The argument \meta{frac} is a number. If
+\meta{frac} is $0$, nothing is done and the following path \meta{path0}
+is produced; if \meta{frac} is $1$, then the argument \meta{path1} is
+produced. For values of \meta{frac} between $0$ and $1$ the resulting
+path is somewhere between the two. Numbers larger than $1$ or less than
+$0$ produce an extrapolated path. An ordered pair can be supplied
+instead of the argumant \meta{path1}: it will be interpreted as a
+trivial path. If \meta{path0} (the following figure) is closed and if
+\meta{path1} is an ordered pair or a closed path, then the resulting
+path will also be closed. Otherwise it will not be.
+
+What this command actually interpolates are the key points of the paths
+and the directions of travel at those key points. Therefore, if the two
+paths are visually very similar but have very different node structure,
+then the interpolated path can be quite unexpectedly different from both
+of them. For example
+\begin{verbatim}
+ \store{ABC}\circle{(0,0),1}
+ \interpolatepath{.5,ABC}\reverse\circle{(0,0),1}
+\end{verbatim}
+produces a straight line from $(1,0)$ to $(-1,0)$ (and back again).
+
+
\subsection{Arrows}\label{arrows}
@@ -2574,7 +2701,7 @@ the value of the \TeX{} dimension \cs{headlen}, initially \dim{3pt}. The
optional parameter \meta{rotate} allows the arrowhead to be rotated
anticlockwise around its point an angle of \meta{rotate} degrees. The
default is 0. The optional parameter \meta{backset} allows the arrowhead
-to be `set back' from its original point, thus allowing (for example)
+to be ``set back'' from its original point, thus allowing (for example)
double arrowheads. This parameter is in the form of a \TeX{}
dimension---its default value is \dim{0pt}. If an arrowhead is both
rotated and set back, it is set back in the direction after the
@@ -2739,6 +2866,7 @@ used to override \mfp{}'s automatic rendering rules. See
section~\ref{transformation}, page~\pageref{norenderexample} for an
example where one might need to do this.
+
\subsection{Drawing}\label{drawing}
\begin{cd}\pagelabel{draw}
@@ -2765,11 +2893,11 @@ separation (distance between centers of the two penstrokes) is twice the
pen diameter. This normally leaves one line thickness of white space
between. You can change this with the \oarg{\meta{sep}} argument. In
order to make the space between the lines transparent, this command is
-implemented by calculating two curves that parallel the given curve and
-drawing those. For technical reasons, that calculation is rather lengthy
-so this is somewhat inefficient and users of slow machines might want to
-avoid it. See also comments at \cs{parallelpath} in
-subsection~\ref{reversal}.
+implemented by calculating two curves that are parallel to the given
+curve and drawing those. For technical reasons, that calculation is
+rather lengthy so this is somewhat inefficient and users of slow
+machines might want to avoid it. See also comments at \cs{parallelpath}
+in subsection~\ref{reversal}.
\begin{cd}\pagelabel{dashed}
\cs{dashed}\oarg{\meta{length},\meta{space}}$\ldots$%
@@ -2956,8 +3084,8 @@ path might be open and may need to be explicitly closed, for example by
\begin{display}
\cs{belowfcn}, \cs{border}, \cs{btwnfcn}, \cs{btwnplrfcn},
\cs{chartbar} (and its aliases),\\
- \cs{circle}, \cs{ellipse}, \cs{levelcurve}, \cs{makesector},
- \cs{piewedge}, \cs{plrregion},\\
+ \cs{circle}, \cs{ellipse}, \cs{fullellipse}, \cs{levelcurve},
+ \cs{makesector},\cs{piewedge},\\ \cs{plrregion},
\cs{polygon}, \cs{pshcircle}. \cs{rect}, \cs{regpolygon},
\cs{sector}, \cs{tlabelcircle},\\
\cs{tlabelellipse}, \cs{tlabeloval}, and \cs{tlabelrect}.
@@ -3075,6 +3203,10 @@ present. However, if one wishes only to override the default color one
can use an empty first optional argument (completely empty, no spaces or
comma).
+An angle of $0$ yields horizontal lines, nonzero angles indicate
+rotations from horizontal where, as usual, positive angles indicate
+anticlockwise rotation.
+
\begin{cd}\pagelabel{hatch}
\cs{lhatch}\oarg{\meta{hatchsp}}\oarg{\meta{color}}$\ldots$\\
\cs{rhatch}\oarg{\meta{hatchsp}}\oarg{\meta{color}}$\ldots$\\
@@ -3104,10 +3236,112 @@ pattern. It is exactly the same as \cs{rhatch} followed by \cs{lhatch}
using the same \meta{hatchsp} and \meta{color}.
Hatching should normally be used very sparingly, or never if
-alternatives are available (color, shading). However, hatching or
-polkadotting on top of another filling macro is almost the only way to
-fill in two regions that \emph{automatically} shows the overlap area.
-Hatching is at least less garish than polkadots.
+alternatives are available (color, shading). However, hatching on top of
+another filling macro is a common way to fill in \emph{two} regions in
+such a way that the overlap area is clearly evident. Hatching is at
+least less garish than polkadots.
+
+\begin{cd}\pagelabel{gradient}
+\cs{gradient}\marg{\meta{clrfcn},\meta{width},\meta{angle}}$\ldots$%
+\index{gradient@\cs{gradient}}%
+\end{cd}
+
+Neither \MP{} nor \MF{} can do true gradients, but this rendering macro
+obtains a good approximation by filling adjacent narrow strips in a
+range of colors. The argument \meta{width} is the width of those strips,
+and it should be specified in absolute units, \meta{angle} is the angle
+of these strips (horizontal being $0$ degrees). The first argument
+takes a little explanation.
+
+The \meta{clrfcn} should be the name of a function, say \mfc{gr},
+such that \mfc{gr(t)} returns a color\footnote{It can also return a
+number between $0$ and $1$, which will result in shades of gray.} for
+any value of $t$ from $0$ to $1$ (inclusive). Such a function can be
+defined with \cs{fdef} (see subsection~\ref{defining}). The first strip
+will have the color returned for \mfc{t}${}=0$ and the last will have
+the color returned for \mfc{t}${}=1$. One kind of gradient fill is
+obtained by a simple interpolation between two colors in the same model:
+\begin{verbatim}
+\fdef{gr}{t}{(1-t)*red + t*blue}
+\gradient{gr,3pt,45}\circle{(0,0),1}
+\end{verbatim}
+This example will start the gradient with red and end it with blue. For
+an angle of $0$ the starting color is at the bottom and the ending color
+at the top, for other angles simply rotate that description. The above
+circle will be red at the lower right and blue at the upper left.
+
+This type of gradient is called an \emph{axial} gradient. The following
+is another kind, based on a color function of \emph{two} variables over
+an area.
+
+\begin{cd}\pagelabel{areagradient}
+\cs{areagradient}\marg{\meta{clrfcn},\meta{h-dim},\meta{v-dim}}$\ldots$%
+\index{areagradient@\cs{areagradient}}%
+\end{cd}
+
+Instead of filling with strips of different colors, \cs{areagradient}
+fills with ``pixels'' of different colors. These are rectangles that
+have size \meta{h-dim} by \meta{v-dim}, which values must be specified
+in absolute units. These rectangles are filled with the color determined
+by \meta{clrfcn}. This must be a function of \emph{two} parameters that
+returns a color for values of these parameters from $0$ to $1$
+(inclusive). For example,
+\begin{verbatim}
+\fdef{agr}{t,u}%
+ {(1-t)(1-u)*white + (1-t)*u*red + t*(1-u)*green + t*u*blue}
+\gradient{agr,3pt,4pt}\rect{(0,0),(1,2)}
+\end{verbatim}
+The color returned for $(0,0)$ is at the lower left and the color
+returned for $(1,1)$ is at the upper right. In the above example, the
+rectangle will be white at the lower left, red at the upper left, green
+at the lower right and blue at the upper right.
+
+Our last gradient is something like the first, but in polar coordinates.
+The colors vary with the distance from a center point.
+
+\begin{cd}\pagelabel{radialgradient}
+\cs{radialgradient}\marg{\meta{clrfcn},\meta{width},\meta{center}}$\ldots$%
+\index{radialgradient@\cs{radialgradient}}%
+\end{cd}
+
+This gradient fills with concentric circular strips whose center is
+\meta{center} and whose thickness is \meta{width}. The \meta{clrfcn} is
+as in \cs{gradient}. The circle of radius \meta{width} and center
+\meta{center} is filled with the color returned for parameter value $0$.
+The largest concentric circular strip is filled with the color returned
+for parameter value $1$.
+
+These commands all initially compute a bounding figure for the curve. In
+the first case it is a rotated rectangle, in the second case an upright
+rectangle, and in the third case a circle centered at the given point.
+The interiors of the rectangles are considered to have coordinates
+$(t,u)$ that vary from $(0,0)$ at the lower left to $(1,1)$ at the upper
+right. The inside of the circle is considered to have the polar
+coordinate $r$ ranging from $0$ at the center to $1$ at the boundary.
+The relevant coordinate(s) are fed to the specified \meta{clrfcn} and
+the returned color is used to fill the relevant portion of the rectangle
+or circle. The whole picture is then clipped to the boundaries of the
+given closed curve and the result added to the picture.
+
+The process is somewhat wasteful of memory in \MP{}, as each strip or
+pixel's path is kept in memory and written to the output file. This can
+be quite large for \cs{areagradient} if the pixel dimensions are too
+small. For example, covering a one inch square with pixels 1 point on
+each side takes over 5000 paths and the resulting EPS is over 100,000
+bytes in size. I would recommend dimensions on the order of 2 to 3
+points. Larger dimensions are not as visually appealing, and smaller
+dimensions waste memory with little improvement in appearence.
+
+This command works in \MF{} using a \meta{clrfcn} that returns numeric
+values in the range $0$ to $1$. The result is much like
+\cs{gfill}\oarg{\meta{clr}} (see the beginning of this section) except
+the dots simulating a gray fill will vary in size corresponding to the
+\meta{clrfcn}. The result will be disappointing unless there is
+considerable contrast between the lightest and darkest grays of the
+gradient. Therefore, it is recommended that the color function cover the
+entire range from $0$ to $1$ (black to white). There are no particular
+memory problems with gradients in \MF{}, at least no more so than gray
+fills.
\subsection{Changing the default rendering}\label{default}
@@ -3128,15 +3362,15 @@ Initially, \mfp{} uses the \cs{draw} command (stroking) as the default
operation when a figure is to be rendered. However, this can be changed
to any combination of \mfp{} rendering commands or indeed any \TeX{}
commands, by using the \cs{setrender} command. This redefinition is
-local inside an \env{mfpic} environment, so it can be enclosed in braces
-to restrict its range. Outside an \env{mfpic} environment it is a global
-redefinition.
+local when it occurs inside an \env{mfpic} environment, so there it can
+be enclosed in braces to restrict its range. Outside an \env{mfpic}
+environment it is a global redefinition.
For example, suppose one uses \cs{setrender}\marg{\cs{dashed}\cs{shade}}
in a \env{mfpic} environment. If the command \cs{circle}\marg{(0,0),1}
-occurs later, it will produce a shaded circle with a dashed outline. If
-an explicit rendering prefix is given in a drawing command, it will
-override this default.
+occurs later in that environment, it will produce a shaded circle with a
+dashed outline. If an explicit rendering prefix is given in a drawing
+command, it will override this default.
\subsection{Examples}\label{examples}
@@ -3167,6 +3401,7 @@ stand for any legal \MF{} expression, in which the only unknown
variables are those indicated (\texttt{x} in the first case, and \texttt{t} in
the second).
+
\subsection{Defining functions}\label{defining}
\begin{cd}\pagelabel{fdef}
@@ -3181,7 +3416,7 @@ the only free parameters are those named. The return type of the
function is the same as the type of the expression. What is allowed for
the function name \meta{fcn} is more restrictive than \MF{}'s rule for
variable names. Roughly speaking, it should consist of letters and
-underscore characters only. (In particular, for those that know what
+underscore characters only. (In particular, for those who know what
this means, the name should have no suffixes.) Try to make the name
distinctive to avoid redefining internal \MF{} commands.
@@ -3283,9 +3518,10 @@ macros, defining a path to which prefixes may be applied.
\index{function@\cs{function}}
\end{cd}
-This figure macro produces the graph of $y = f(x)$, where $f$ is a \MF{} numeric
-function or expression of one numeric argument, which must be denoted by
-a literal \texttt{x}. The default \meta{spec} is \texttt{s}. For example
+This figure macro produces an approximation to the graph of $y = f(x)$,
+where $f$ is a \MF{} numeric function or expression of one numeric
+argument, which must be denoted by a literal \texttt{x}. The default
+\meta{spec} is \texttt{s}. For example
\begin{verbatim}
\function{0,pi,pi/10}{sin x}
\end{verbatim}
@@ -3306,9 +3542,10 @@ argument. This can be a pair of expressions $x(\mathtt{t})$ and
$y(\mathtt{t})$ enclosed in parentheses and separated by a comma, with
the literal variable \texttt{t}. Alternatively, the last argument can be
a \MF{} function or expression in \texttt{t} that returns a pair.%
- \footnote{There are very few of these. \CMF{} provides \mfc{dir t},
- which is essentially \mfc{(cosd t, sind t)}. \Mfp{} adds \gbc{cis t}
- which is \gbc{(cos t, sin t)}.}
+ \footnote{There are very few of these. \CMF{} provides
+ \codebox{dir t}, which is essentially
+ \codebox{(cosd t, sind t)}. \Mfp{} adds \codebox{cis t} which
+ is \codebox{(cos t, sin t)}.}
The default \meta{spec} is \texttt{s}. For example
\begin{verbatim}
\parafcn{0,1,.1}{(2t, t+t*t)}
@@ -3503,7 +3740,7 @@ but much further apart when measured along the curve.
The first of these plots the graph of the solution of the differential
equation
$$
- \frac{dy}{dx} = f(x,y)\,,\quad y(x_0) = y_0\,.
+ \frac{dy}{dx} = f(x,y)\,,\quad y(x_0) = y_0\,.
$$
The \meta{$\Delta s$} parameter is a step size and the \meta{$N$}
parameter is the number of steps. The step size is \emph{not} an
@@ -3542,7 +3779,7 @@ $\mathbf{F}(x,y,t)$ by its negative.
The purpose of making \meta{$\Delta s$} a distance rather than an
$x$-increment or a $t$-increment (as the Runge-Kutta method is taught in
-the usual numerical analysis course) is stability: even very simple
+the usual mathematics courses) is stability: even very simple
differential equations can have graphs the tend to $\infty$ in finite
time. These macros, however, never travel more than a distance $N\Delta
s$ from the starting point.
@@ -3780,6 +4017,12 @@ The command \cs{coloredlines} will produce a warning under the
that all curves are drawn in \gbc{drawcolor} by default: the
\cs{plotdata} command after \cs{coloredlines} has been issued.
+Note that \mfp{} always creates a path internally. It is possible that
+your data is not path-like and what you want is a scatter-plot. Simply
+use \cs{datapointsonly} and the effect is the same: \MP{} builds a
+polygonal path connecting all the points in your file, but when it plots
+the path, it only places a dot (or other symbol) at each data point.
+
If, for some reason, you do not like the default starting line style
(say you want to start with a color other than black), you can use one
of the following commands.
@@ -3815,11 +4058,11 @@ changed: \texttt{dashes}, \texttt{colors} or \texttt{symbols}. The
second argument is a list of dash patterns, colors, or symbols. The dash
patterns should be names of patterns defined through the use of
\cs{dashpattern}. The colors can be any color names already known to
-\MP{}, or defined through \cs{mfpdefinecolor}. The symbols can be any of
-those listed with the \cs{plotsymbol} command (see
-subsection~\ref{points}), or any known \MF{} path variable. The colors
-can also be \MP{} color constants or expressions, and the symbols can be
-expressions of type path. In recent \MP{} these `colors' can be
+\MP{}, or color names defined using \cs{mfpdefinecolor}.
+The symbols can be any of those listed with the \cs{plotsymbol} command
+(see subsection~\ref{points}), or any known \MF{} path variable. The
+colors can also be \MP{} color constants or expressions, and the symbols
+can be expressions of type path. In recent \MP{} these `colors' can be
\kw{numeric} (selecting gray), \kw{rgbcolor} or \kw{cmykcolor}. Within a
\env{mfpic} environment, the changes made are local to that environment.
Outside, they affect all subsequent environments.
@@ -3844,6 +4087,7 @@ same meaning here (for \cs{plotdata}) as they do for \cs{datafile}
(above). The sequence numbering for \cs{sequence} starts over with each
new curve.
+
\section{Labels and Captions.}\label{labels}
\subsection{Setting text}\label{text}
@@ -4732,6 +4976,7 @@ shifted path:
\arrow\norender\shiftpath{(0,1)}\arrow\draw\lines{(0,0),(8,8)}
\end{verbatim}
+
\section{Parameters.}\label{parameters}
There are many parameters in \mfp{} which the user can modify to
@@ -4961,8 +5206,8 @@ are \dim{0.5pt} and \dim{3pt}.
\index{griddotsize@\cs{griddotsize}}%
\end{cd}
-This dimension gives the default for the sizes of dots in the \cs{grid}
-and \cs{plrgridpoints} commands. The initial value is \dim{0.5pt}.
+This dimension gives the default sizes of dots in the \cs{grid} and
+\cs{plrgridpoints} commands. The initial value is \dim{0.5pt}
\begin{cd}\pagelabel{symbolspace}
\cs{symbolspace}%
@@ -5100,7 +5345,7 @@ required. For the first version, the extra equations give the path zero
curvature at the endpoints (a \emph{relaxed} spline). For the closed
version, the extra equations are those that close the curve smoothly.
The portions of the spline that connect one node to the next are
-parametrized cubic B/'eziers, they are computed so that the first and
+parametrized cubic B\'eziers, they are computed so that the first and
second derivatives (with respect to the parameter) of adjacent curves
match at the common node.
@@ -5138,6 +5383,7 @@ argument. The corresponding statements are true of \cs{qbclosed}: it is
meant to close a quadratic B-spline and \cs{qbclosed}\cs{qspline} should
produce the same result as \cs{closedqspline} with the same argument.
+
\subsection{B\'eziers}
The power user, having noticed that \cs{curve} and \cs{cyclic} insert
@@ -5213,6 +5459,7 @@ of the control points. Cubic B\'eziers are how curves are represented in
PostScript files, and how a number of vector drawing programs represent
curves.
+
\subsection{Raw \MF{} code}\label{mfcode}
\begin{cd}\pagelabel{mfsrc}
@@ -5256,6 +5503,7 @@ Check out the sample \file{forfun.tex} for a more extensive example. It
should produce the word `\textsf{mfpic}' in blue, outlined in green in a
box with yellow background.
+
\subsection{Creating \MF{} variables}\label{variables}
\begin{cd}\pagelabel{setmfvariable}
@@ -5425,16 +5673,16 @@ the given points in that order. And then
\end{verbatim}
will draw the lines connecting these four points. The index may
optionally be put in square brackets and may be separated from the name
-by any number of spaces. That is, \verb$\polyline{X[1],X[2]}$
-and \verb$\polyline{X 1,X 2}$ are the same as \verb$\polyline{X1,X2}$
-to \MF{}. If a numeric \emph{expression} is used instead of an explicit
+by any number of spaces. That is, \verb$\polyline{X[1],X[2]}$ and
+\verb$\polyline{X 1,X 2}$ are the same as \verb$\polyline{X1,X2}$ to
+\MF{}. If a numeric \emph{expression} is used instead of an explicit
number, square brackets \emph{must} surround it: \gbc{X[1+1]},
-\gbc{X[2]}, \gbc{X2} and \gbc{X 2} are all the same. For all these array
-commands, the variable \gbc{X} by itself (not followed by any digit or
-brackets) becomes a numeric variable equal to the number of elements in
-the array. Except for \cs{globalsetarray}, the arrays are defined
-locally if these commands occur in an \env{mfpic} environment, global
-otherwise.
+\gbc{X[2]}, \gbc{X2} and \codebox{X 2} are all the same. For all these
+array commands, the variable \gbc{X} by itself (not followed by any
+digit or brackets) becomes a numeric variable equal to the number of
+elements in the array. Except for \cs{globalsetarray}, the arrays are
+defined locally if these commands occur in an \env{mfpic} environment,
+global otherwise.
Array variables may be used only where the values are processed only by
\MF{} or \MP{}, they are unknown to \TeX{}. In particular, they cannot be
@@ -5497,6 +5745,7 @@ vertical (also change `right' to `top', etc.):
had one side on an axis.
\end{itemize}
+
\subsection{Miscelaneous pair expressions}\label{pairexpressions}
A useful \MF{} operator that produces points is the intermediation
@@ -5505,18 +5754,18 @@ operator, whose syntax is
\texttt{(\meta{num})[\meta{$p_1$},\meta{$p_2$}]}
\end{cd}
That is, a number or numeric expression in parentheses followed by
-literal brackets (this is \emph{not} an optional argument) containing two points
-or pair expressions separated by a comma. It returns an intermediate point on
-the line through \meta{$p_1$} and \meta{$p_2$}. The formula for the
-returned value is $p_1 + \mbox{\meta{num}}(p_2 - p_1)$. The midpoint is
-obtained with $\mbox{\meta{num}} = .5$. If the \meta{num} is a pure
-number, the parentheses can be omitted, but they are required if it is
-any other numeric expression. Values of \meta{num} larger than 1 or
-less than zero produce points on the line that lie outside the segment
-from $p_1$ to $p_2$. This operator can also be applied to numbers or (in
-\MP{}) to colors (of the same type). So that \mfc{(2/3)[3,6] = 5} and
-\mfc{.7[green,blue] = (0,.3,.7)}. See section~\ref{colors} for a
-description of colors in \MP{} and \MF{}.
+literal brackets (this is \emph{not} an optional argument) containing
+two points or pair expressions separated by a comma. It returns an
+intermediate point on the line through \meta{$p_1$} and \meta{$p_2$}.
+The formula for the returned value is $p_1 + \mbox{\meta{num}}(p_2 -
+p_1)$. The midpoint is obtained with $\mbox{\meta{num}} = .5$. If the
+\meta{num} is a pure number, the parentheses can be omitted, but they
+are required if it is any other numeric expression. Values of \meta{num}
+larger than 1 or less than zero produce points on the line that lie
+outside the segment from $p_1$ to $p_2$. This operator can also be
+applied to numbers or (in \MP{}) to colors (of the same type). So that
+\codebox{(2/3)[3,6] = 5} and \codebox{.7[green,blue] = (0,.3,.7)}. See
+section~\ref{colors} for a description of colors in \MP{} and \MF{}.
\begin{cd}
\gbc{pathpoint(\meta{frac},\meta{name})}
@@ -5553,19 +5802,30 @@ complex numbers. Also \gbc{t} denotes an angle in radians. There are
both numeric and pair valued functions, the type of each is noted after
the description:
+\def\Arg{\mathop{\mathrm{Arg}}}
+
\noindent
\begin{tabular}{@{}lp{4.2in}}
\gbc{Arg z} & The principle argument of $z$ in radians (numeric).\\
\gbc{Log z} & The principle logarithm of $z$ (pair).\\
\gbc{cis t} & $(\cos t, \sin t)$, same as \gbc{dir degrees(t)} (pair).\\
\gbc{zexp w} & The complex exponential, $e^w$ (pair).\\
-\gbc{sgn z} & The signum, $\sgn (0,0) = (0,0)$ otherwise $\sgn z = z/|z|$ (pair).\\
+\gbc{zsqrt w} & The (principal) complex square root: that $z$ with
+ $-\pi/2 \le \Arg z \le \pi/2$ and $z^2 = w$ (pair).\\
+\gbc{sgn z} & The signum, $\sgn (0,0) = (0,0)$ otherwise
+ $\sgn z = z/|z|$ (pair).\\
\gbc{conj z} & The complex conjugate, $\bar z$ (pair).\\
\gbc{Moebius(a) z} & The M\"obius transformation $(z+a)/(1+\bar{a}z)$ (pair)\\
\gbc{pshdist(z,w)} & The pseudohyperbolic distance between $z$ and
- $w$: $|z-w| / |1-\bar{w}z|$ (numeric).
+ $w$: $|z-w| / |1-\bar{w}z|$ (numeric).\\
+\gbc{kelvin(z)} & The Kelvin transform $1/\bar z$ (pair)
\end{tabular}
+\CMF{} will happily add and subtract pairs but to multiply and divide
+complex numbers requires new operations. These are given by \codebox{(z
+zmul w)} and \codebox{(z zdiv w)}. They operate on pairs and produce
+pairs.
+
\subsection{Manipulating \MF{} picture variables}
@@ -5701,6 +5961,7 @@ One can use the \LaTeX{} environment construct \cs{begin}\marg{mfpimage}
$\ldots$ \cs{end}\marg{mfpimage} in a LaTeX document instead of
\cs{mfpimage} $\ldots$ \cs{endmfpimage}.
+
\subsection{\CMF{} loops}\label{loops}
All the \mfp{} loop commands create a loop (in the \MF{} language) in
@@ -5775,11 +6036,11 @@ reverts to its previous state outside the loop. That is, if it existed
before the loop, it regains its previous value after the loop, and if it
was undefined before the loop, it is again undefined after.
-The single word ``\mfc{upto}'' can be used as an abbreviation for
-``\mfc{step 1 until}'' and ``\mfc{downto}'' for ``\mfc{step -1 until}''
+The single word `\mfc{upto}' can be used as an abbreviation for
+``\codebox{step 1 until}'' and `\mfc{downto}' for ``\codebox{step -1 until}''
in for-loop headers. Spaces are not significant in for-loop headers,
except to distinguish the keywords (e.g. \mfc{step}) from variable names
-that might be use (e.g., for \meta{start}).
+that might be used (e.g., for \meta{start}).
\begin{cd}\pagelabel{mfpwhile}
\cs{mfpwhile}\marg{\meta{condition}}\\
@@ -5873,6 +6134,7 @@ by code that causes \MF{} to execute it several times with different
values for the variable. From \TeX{}'s point of view, there is only one
\mfp{} drawing command.
+
\subsection{Miscellaneous}\label{misc}
\begin{cd}\pagelabel{mfmode}
@@ -5925,8 +6187,8 @@ locally, one can globally copy it to another variable with
\index{globalassignmpvalue@\cs{globalassignmpvalue}}%
\end{cd}
-The command names spelled with ``\texttt{mp}'' are no different than the
-ones spelled with ``\texttt{mf}''. You can use either spelling with
+The command names spelled with `\texttt{mp}' are no different than the
+ones spelled with `\texttt{mf}'. You can use either spelling with
either the \opt{metafont} or \opt{metapost} option.
These commands causes the \meta{MF-expr} to be written to the output
@@ -5961,9 +6223,9 @@ The `\texttt{global}' version makes the definition of the
it can be used in other pictures. The plain versions create commands
that are only locally defined. Past versions of this manual stated that
you can say
-\begin{ex}
+\begin{display}
\cs{global}\cs{assignmfvalue}
-\end{ex}
+\end{display}
to define the macro globally. This turns out not to be true in all
cases. If a global definition is needed, use the global versions above.
@@ -6008,7 +6270,7 @@ object and the path intersect in more than one point, as little as
possible (usually%
\footnote{\MF{}'s methods for finding the `first' point of
intersection do not always find the actual first one.}) %
-is cut off. This is reliable only when there is only one point of
+is cut off. This is reliable only when there is a unique point of
intersection.
These macros can be used to create a curve that starts or ends
@@ -6036,32 +6298,67 @@ For \cs{randomizepath} the \meta{weirdness} parameter controls how the
control vectors are modified. Roughly speaking the control vectors are
randomly rotated up to $30\langle\mathit{weirdness}\rangle$ degrees and
randomly scaled up or down by a factor of
-$2^{\langle\mathit{weirdness}\rangle}$. (A `control vector' is a vector
-pointing from a node to one of its control points.) However, this is
-done in a way that preserves smoothness at each node where the path is
-smooth. Values of \meta{weirdness} greater than 1 are probably too
-weird.
+$2^{\langle\mathit{weirdness}\rangle}$. (A ``control vector'' is a
+vector pointing from a node to one of its control points.) However, this
+is done in a way that preserves smoothness at each node where the path
+is smooth. Values of \meta{weirdness} greater than 1 are probably much
+too weird.
\begin{cd}\pagelabel{brownianmotion}
-\cs{brownianmotion}\marg{\meta{start},\meta{num},\meta{scale}}%
-\index{brownianmotion@\cs{brownianmotion}}
-\end{cd}
-
-This figure macro uses another kind of randomness. The path starts at
-the point \meta{start}, then proceeds in a straight line in a random
-direction a random distance. The random process used is a normaldeviate
-in each coordinate, scaled by \meta{scale}. This is repeated \meta{num}
-times. Thus, \meta{start} is a coordinate pair in graph coordinates,
-\meta{num} is a positive whole number and \meta{scale} is a positive
-real number. In rare cases, the random distance can be quite large, but
-on average it will be about $0.56\times{}$\meta{scale}. The size
-(bounding box) of the resultant path can also be, in rare cases,
-quite large, but it is usually on the order of $\sqrt{\meta{num}}$ times
-\meta{scale}.
-
-The path produced is technically not Brownian motion, but rather a
-`random walk'. However, for small \meta{scale} and large \meta{num} it
-approximates Brownian motion.
+\cs{brownianmotion}\marg{\meta{start},\meta{num},\meta{scale}}\\%
+\cs{browniangraph}\marg{\meta{num},\meta{scale}}\\%
+\cs{randomwalk}\marg{\meta{start},\meta{num},\meta{scale}}%
+\index{brownianmotion@\cs{brownianmotion}}%
+\index{browniangraph@\cs{browniangraph}}%
+\index{randomwalk@\cs{randomwalk}}
+\end{cd}
+
+These figure macros build a few standard kinds of random paths. The
+\cs{brownianmotion} path starts at the point \meta{start}, then proceeds
+in a straight line in a random direction a random distance. This is
+repeated \meta{num} times to form a polyline. The random process used is
+a Gaussian in each coordinate, scaled so that the random distance has a
+standard deviation equal to \meta{scale}. Thus, \meta{start} is a
+coordinate pair in graph coordinates, \meta{num} is a positive whole
+number and \meta{scale} is a positive real number (in graph units). In
+rare cases, the random distance can become quite large, but on average
+it will be about $0.56\times{}$\meta{scale}. The size of the resultant
+path (its bounding box) can also be, in rare cases, quite large, but it
+is usually on the order of $\sqrt{\meta{num}}$ times \meta{scale}.
+
+The second path, \cs{browniangraph}, represents the graph of a
+one-dimensional Brownian motion. It is random only in the vertical
+direction as the rightward motion represents the uniform passage of
+time. It starts at $(0,0)$ and the \meta{scale} is both the constant
+rightward step as well as the standard deviation for the $y$-coordinate.
+Users will need to apply a shift if they want to change the starting
+point, and a vertical scaling if they want a scale factor different from
+the step size.
+
+Despite their names, the paths produced are technically not Brownian
+motion, but rather `Gaussian random walks'. However, for small
+\meta{scale} and large \meta{num} they can be used to approximate
+Brownian motion.
+
+Finally, \cs{randomwalk} is just like \cs{brownianmotion} except that
+only the direction is random. The distance is always equal to
+\meta{scale}.%
+ \footnote{This is only one kind of an infinite variety of possible
+ random walks. See \url{http://en.wikipedia.org/wiki/Random_walk} for a
+ discussion. \Mfp{} implementation of other kinds is left to the
+ interested user (for example, using \cs{turtle} with random
+ displacements).}
+
+There can be a problem with the size of \meta{num} in these three
+macros. Numbers greater than a certain \MF/\MP{} parameter called
+\verb$max_points$ (see the discussing at \cs{levelcurve} in
+section~\ref{plotting}) will produce an error from \MF{} or \MP{}. But
+also sharp turns will take up space in something called the
+\emph{rounding table}. This has no bearing on \MP{}, and in \MF{} it
+only matters if the parameter \mfc{autorounding} is positive. \Mfp{}
+leaves \mfc{autorounding} at the default of $2$, since this value makes
+drawings in \MF{} look best. In this case, the value of \meta{num}
+should be less than about $500$.
\begin{cd}\pagelabel{mftitle}
\cs{mftitle}\marg{\meta{title}}%
@@ -6173,6 +6470,15 @@ enough to have this capability. Under the \opt{metafont} option, this
command is simply ignored, but \mfp{} has no way of checking the \MP{}
version on its own.
+If you are using \LaTeX{}, the \verb$\includegraphics$ command requires
+that the included figure file be recognized as \MP{} output. In practice,
+this usually means its extension \emph{must} be \texttt{.mps}. As an
+exception, it may also be the current figure number (the default if
+\verb$\setfilenametemplate$ is not used), because \mfp{} has always
+arranged for that to be recognized. The user may also issue a
+\verb$\DeclareGraphicsRule$ command to get other extensions recognized.
+See the documentation of the \prog{graphics} package.
+
\begin{cd}\pagelabel{preparemfpicgraphic}
\cs{preparemfpicgraphic}\marg{\meta{filename}}%
@@ -6244,7 +6550,7 @@ get written to the \file{.mf} (or \file{.mp}) output and cause a \MF{}
\end{verbatim}
The braces prevent \TeX{}'s argument parsing from seeing the first comma
-as a delimiter, but upon writing to the \file{.mf}, the \cs{identity}
+as a delimiter, but upon writing to the \file{.mf}, any \cs{identity}
commands are expanded and only the contents appear in the output. (\TeX{}
parses the argument to assign meanings to \cs{Ax} and \cs{Ay}.)
@@ -6264,6 +6570,7 @@ for the commands to do these things.
\thispagestyle{plain}
\chapter{Appendices}\label{appendices}
+
\section{Acknowledgements.}\label{acknowledgements}
Tom would like to thank all of the people at Dartmouth as well as out in
@@ -6305,12 +6612,14 @@ for the \cs{assignmfvalue} command, and Zaimi Sami~Alex for suggestions.
But mostly, he'd like to thank Tom Leathrum for starting it all.
+
\section{Changes History.}\label{changes}
See the file \file{changes.txt} for a somewhat sporadic history of
changes to \mfp{}. See the file \file{README} for changes added since
the previous version, and for any known problems.
+
%\clearpage
\section{Summary of Options.}\label{summary}
@@ -6377,6 +6686,7 @@ all later environments.
\cs{opengraphsfile}. \cr
}}
+
%\clearpage
\section{Plotting Styles for \cs{plotdata}.}\label{styles}
@@ -6451,6 +6761,7 @@ path variables. (The order changed between versions 0.6 and 0.7.)
\mfc{pointtype8}& \mfc{SolidTriangle}
\end{tabular}
+
\section{Special Considerations When Using \CMF{}.}\label{mfconsiderations}
The most important restriction in \MF{} is on the size of a picture.
@@ -6461,7 +6772,7 @@ fonts prepared for a LaserJet4 (600 DPI), this means 6.825 inches
(17.3355cm). For a 1200 DPI pronter, the limit is 3.4125 inches.
A similar limit holds for numbers input, and the values of variables:
-\MF{} will return an error for ``\mfc{sin 4096}''. Intermediate values
+\MF{} will return an error for `\mfc{sin 4096}'. Intermediate values
can be greater (\mfc{sin (2*2048)} will cause no error), but final,
stored results are subject to the limit. An \mfp{} example that
generated an error recently was:
@@ -6494,6 +6805,8 @@ working \MP{} installation):
\medskip\noindent
\begin{tabular}{@{}lp{4.2in}}
+\TeX{} format &support needed\\
+\hline
plain \TeX{} &The file \file{epsf.tex} or \file{epsf.sty}\\
\LaTeX{}209 &(No longer supported, but plain \TeX{} methods
might work)\\
@@ -6503,26 +6816,34 @@ plain \TeX{} &The file \file{epsf.tex} or \file{epsf.sty}\\
plain \pdfTeX{} &\raggedright The files \file{supp-pdf.mkii} or
\file{supp-pdf.tex} and (possibly)
\file{supp-mis.tex}\tabularnewline
-In all cases &\raggedright The files \file{grafbase.mp} and
- \file{dvipsnam.mp} plus, of course,
- \file{mfpic.tex} (and \file{mfpic.sty} for
- \LaTeX{})
+In all cases &\raggedright The files \file{grafbase.mp},
+ \file{dvipsnam.mp} and \file{mfpicdef.tex} plus,
+ of course, \file{mfpic.tex} (and \file{mfpic.sty}
+ for \LaTeX{})
\end{tabular}
\medskip
The files \file{grafbase.mp} and \file{dvipsnam.mp} should be in a
-directory searched by \MP{}. The remaining files should be in directories
-searched by the appropriate \TeX{} variant. If \MP{} cannot find the
+directory searched by \MP{}. If \MP{} cannot find the
file \file{grafbase.mp}, then by default it will try to input
-\file{grafbase.mf}, which is generally futile (or fatal).
+\file{grafbase.mf}, which is generally fatal (and always futile).
+
+The remaining files should be in directories searched by the appropriate
+\TeX{} variant. The file \file{mfpicdef.tex} is input by \TeX{} when
+\MP{} is processing labels in \file{.mp} files created by \mfp{}. The
+user is free to add commands of his own to that file, but be warned that
+updates to \mfp{} will overwrite it. Better to create ones own file (say
+\file{mydefs.tex}) and arrange its input via
+\verb$\mfpverbtex{\input mydefs.tex}$
In case \pdfLaTeX{} is used, the \prog{graphics} package is given the
\opt{pdftex} option. This option requires the file \file{pdftex.def}
which currently inputs one of the \file{supp-pdf} files. Early versions
of \file{supp-pdf.tex} will input \file{supp-mis.tex}. These three files
should be supplied with most \TeX{} installations.%
- \footnote{At this writing, these files, plus a few others,
- can found at \file{CTAN/macros/pdftex/graphics/}.} %
+ \footnote{They are part of the Con\TeX{}t distribuition. At this writing,
+ these files, plus a few others, can also be found at\\
+ \file{CTAN/graphics/metapost/contrib/tools/mptopdf/tex/context/base/}.} %
Older versions had some bugs in connection with the \prog{babel}
package. One workaround was to load the \prog{graphics} package and
\mfp{} before \prog{babel}.
@@ -6533,6 +6854,7 @@ load whichever one it decides is required. In the \LaTeXe{} case, \mfp{}
will load the \prog{graphics} package. If the user wishes
\prog{graphicx}, then that package must be loaded before \mfp{}.
+
\subsection{\CMP{} is not \MF{}}
\PS{} is not a pixel oriented language and so neither is \MP{}. The model
@@ -6574,6 +6896,7 @@ rectangle. On the other hand, filling is done right up to the boundary.
In this example, the dashed lines are drawn on top of part of the fill.
In the reverse order, the fill would cover part of the dashed outline.
+
\subsection{Graphic inclusion}\label{graphics}
It may be impossible to completely cater to all possible methods of
@@ -6617,9 +6940,10 @@ we add code to each figure, so that these graphics are correctly
recognized as \EPS{} or \prog{MPS}. For example, to the figure with
extension \file{.1}, we add the equivalent of one of the following
\begin{itemize}
-\item[] \cs{DeclareGraphicsRule}\marg{.1}\marg{eps}\marg{.1}\marg{} in \LaTeXe{}.
-\item[] \cs{DeclareGraphicsRule}\marg{.1}\marg{mps}\marg{.1}\marg{} in
-\pdfLaTeX{}.
+ \item[] \cs{DeclareGraphicsRule}\marg{.1}\marg{eps}\marg{.1}\marg{} in
+ \LaTeXe{}.
+ \item[] \cs{DeclareGraphicsRule}\marg{.1}\marg{mps}\marg{.1}\marg{} in
+ \pdfLaTeX{}.
\end{itemize}
After running the command \cs{setmfpicgraphic}, \mfp{} runs
@@ -6650,8 +6974,8 @@ independent of the size of a picture. To rescale all pictures, one need
only change \cs{mfpicunit} and rerun \TeX{} and \MP{}.
A better reason might be to allow the conversion of your \MP{} figures
-to some other format. Then redefining \cs{setmfpicgraphic}
-could enable including the appropriate file in the appropriate format.
+to some other format. Then redefining \cs{setmfpicgraphic} could enable
+including the appropriate file in the appropriate format.
The filename argument mentioned above is actually the result obtained by
running the macro \cs{setfilename}\index{setfilename@\cs{setfilename}}.
@@ -6689,13 +7013,18 @@ filename between the asterisks.
\subsection{The literature}
-This author has personal knowledge of only one mathematical article
+This author has personal knowledge of one mathematical article
which definitely uses \mfp{} to create diagrams, and that is this
author's joint paper with J.~Duncan and C.~M.~McGregor: \textit{On the
value of pi for norms in $\mathbf{R}^2$} in the College Mathematics
Journal, vol.~35, pages 84--92. Oddly enough, it was McGregor and not I
who chose to use \mfp{} for the illustrations.
+There also exists a book that makes use of \mfp{}: \textit{Introduction
+to functional equations: theory and problem solving strategies for
+mathematical competitions and beyond} by Costas Efthimiou,
+MSRI/Mathematical Circles Library, vol. 6, 2011.
+
There are at least two major publications where \mfp{} has garnered more
than a cursory mention. The most up-to-date is a section in \textit{The
\LaTeX{} Graphics Companion} by Michel Goossens, Sebastian Rahtz and
@@ -6727,8 +7056,8 @@ given for \cs{wedge}:
\end{ex}
The macro \cs{plr}\marg{(\meta{$r_0$},\meta{$\theta_0$}),%
-(\meta{$r_1$},\meta{$\theta_1$}),$\ldots$} is used to convert polar
-coordinate pairs to rectangular coordinates, so the commands
+(\meta{$r_1$},\meta{$\theta_1$}),$\ldots$} is now used to convert polar
+coordinate pairs to rectangular coordinates and the commands
\cs{plrcurve}, \cs{plrcyclic}, \cs{plrlines} and \cs{plrpoint} were
dropped from \mfp{}. Now use
\begin{ex}
@@ -6789,6 +7118,7 @@ There is a misprint: \cs{axisheadlin} should be \cs{axisheadlen}.
Finally, the \LaTeX{} template on page 496 is no longer the only
possiblity: recent \mfp{} may be loaded with \cs{usepackage}.
+
\subsection{Other programs}
There exists a program, \prog{fig2mfpic} that produces \mfp{} code as
@@ -6810,6 +7140,7 @@ file (don't ask me what it consists of) and apparently processes it with
\renewcommand\mfpindexheading{%
\section{Index of commands, options and parameters.}}
+
\let\oldcs\cs
\renewcommand{\cs}[1]{\leavevmode\mytt{\llap{\char`\\}#1}}
@@ -6828,6 +7159,7 @@ file (don't ask me what it consists of) and apparently processes it with
\let\item\@idxitem
\makeatother
+
\subsection{Figures}
\item \cs{arc}, \pageref{arc}
@@ -6836,6 +7168,7 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{belowfcn}, \pageref{belowfcn}
\item \cs{border}, \pageref{axisline}
\item \cs{brownianmotion}, \pageref{brownianmotion}
+ \item \cs{browniangraph}, \pageref{brownianmotion}
\item \cs{btwnfcn}, \pageref{btwnfcn}
\item \cs{btwnplrfcn}, \pageref{btwnfcn}
\item \cs{cbeziers}, \cs{closedcbeziers}, \pageref{cbeziers}
@@ -6854,10 +7187,14 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{ellipse}, \pageref{ellipse}
\item \cs{fcncurve}, \pageref{fcncurve}
\item \cs{fcnspline}, \pageref{fcnspline}
+ \item \cs{fullellipse}, \pageref{fullellipse}
\item \cs{function}, \pageref{function}
\item \cs{ganttbar}, \pageref{chartbar}
+ \item \cs{gbrace}, \pageref{gbrace}
\item \cs{graphbar}, \pageref{chartbar}
+ \item \cs{halfellipse}, \pageref{fullellipse}
\item \cs{histobar}, \pageref{chartbar}
+ \item \cs{hypergeodesic}, \pageref{hypergeodesic}
\item \cs{levelcurve}, \pageref{levelcurve}
\item \cs{lines}, \pageref{polyline}
\item \cs{mfbezier}, \cs{closedmfbezier}, \pageref{mfbezier}
@@ -6871,7 +7208,9 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{polyline}, \pageref{polyline}
\item \cs{pshcircle}, \pageref{pshcircle}
\item \cs{qbeziers}, \cs{closedqbeziers}, \pageref{qbeziers}
+ \item \cs{quarterellipse}, \pageref{fullellipse}
\item \cs{qspline}, \cs{closedqspline}, \pageref{qspline}
+ \item \cs{randomwalk}, \pageref{brownianmotion}
\item \cs{rect}, \pageref{rect}
\item \cs{regpolygon}, \pageref{regpolygon}
\item \cs{sector}, \pageref{sector}
@@ -6881,8 +7220,10 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{tlabelrect}, \pageref{tlabelrect}
\item \cs{turtle}, \pageref{turtle}
+
\subsection{Renderings}
+ \item \cs{areagradient}, \pageref{areagradient}
\item \cs{corkscrew}, \pageref{corkscrew}
\item \cs{dashed}, \pageref{dashed}
\item \cs{dotted}, \pageref{dotted}
@@ -6892,12 +7233,14 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{gclip}, \pageref{gclip}
\item \cs{gendashed}, \pageref{gendashed}
\item \cs{gfill}, \pageref{gfill}
+ \item \cs{gradient}, \pageref{gradient}
\item \cs{hatch}, \pageref{hatch}
\item \cs{lhatch}, \pageref{hatch}
\item \cs{plot}, \pageref{plot}
\item \cs{plotdata}, \pageref{plotdata}
\item \cs{plotnodes}, \pageref{plotnodes}
\item \cs{polkadot}, \pageref{polkadot}
+ \item \cs{radialgradient}, \pageref{radialgradient}
\item \cs{rhatch}, \pageref{hatch}
\item \cs{sinewave}, \pageref{zigzag}
\item \cs{shade}, \pageref{shade}
@@ -6906,6 +7249,7 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{xhatch}, \pageref{hatch}
\item \cs{zigzag}, \pageref{zigzag}
+
\subsection{Arrows}
\item \cs{arrow}, \pageref{arrow}
@@ -6913,6 +7257,7 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{arrowmid}, \pageref{arrowhead}
\item \cs{arrowtail}, \pageref{arrowhead}
+
\subsection{Modifying figures}
\item \cs{bclosed}, \pageref{lclosed}
@@ -6920,6 +7265,7 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{connect}, \cs{endconnect}, \pageref{connect}
\item \cs{cutoffafter}, \pageref{cutoffafter}
\item \cs{cutoffbefore}, \pageref{cutoffafter}
+ \item \cs{interpolatepath}, \pageref{interpolatepath}
\item \cs{lclosed}, \pageref{lclosed}
\item \cs{makesector}, \pageref{makesector}
\item \cs{parallelpath}, \pageref{parallelpath}
@@ -6929,6 +7275,7 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{randomlines}, \pageref{random}
\item \cs{reflectpath}, \pageref{shiftpath}
\item \cs{reverse}, \pageref{reverse}
+ \item \cs{reversepath}, \pageref{reverse}
\item \cs{rotatepath}, \pageref{shiftpath}
\item \cs{scalepath}, \pageref{shiftpath}
\item \cs{sclosed}, \pageref{lclosed}
@@ -6943,6 +7290,7 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{yscalepath}, \pageref{shiftpath}
\item \cs{yslantpath}, \pageref{shiftpath}
+
\subsection{Lengths}
\item \cs{axisheadlen}, \pageref{axisheadlen}
@@ -6963,6 +7311,7 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{sideheadlen}, \pageref{sideheadlen}
\item \cs{symbolspace}, \pageref{symbolspace}
+
\subsection{Coordinate transformation}
\item \cs{applyT}, \pageref{applyT}
@@ -6983,6 +7332,7 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{zscale}, \pageref{applyT}
\item \cs{zslant}, \pageref{applyT}
+
\subsection{Symbols, axes, grids, marks}
\item \cs{axes}, \pageref{axes}
@@ -7014,6 +7364,7 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{yaxis}, \pageref{axes}
\item \cs{ymarks}, \pageref{axismarks}
+
\subsection{Symbol names}
\item \gbc{Arrowhead}, \pageref{arrowhead}
@@ -7038,6 +7389,7 @@ file (don't ask me what it consists of) and apparently processes it with
\item \gbc{Star}, \pageref{plotsymbol}
\item \gbc{Triangle}, \pageref{plotsymbol}
+
\subsection{Setting options}
\item \cs{clearsymbols}, \pageref{clearsymbols}
@@ -7063,6 +7415,7 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{useraggedcaptions}, \pageref{raggedcaptions}
\item \cs{usetruebbox}, \pageref{truebbox}
+
\subsection{Setting values}
\item \cs{axismargin}, \pageref{axismargin}
@@ -7096,6 +7449,7 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{setymarks}, \pageref{setaxismarks}
\item \cs{shadewd}, \pageref{shadewd}
+
\subsection{Setting colors}
\item \cs{backgroundcolor}, \pageref{drawcolor}
@@ -7107,6 +7461,7 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{pointcolor}, \pageref{drawcolor}
\item \cs{tlabelcolor}, \pageref{drawcolor}
+
\subsection{Defining arrays}
\item \cs{barchart}, \pageref{barchart}
@@ -7126,6 +7481,7 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{piechart}, \pageref{piechart}
\item \cs{setarray}, \pageref{setarray}
+
\subsection{Changing behavior}
\item \cs{coloredlines}, \pageref{coloredlines}
@@ -7158,6 +7514,7 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{usingnumericdefault}, \pageref{usingpairdefault}
\item \cs{usingpairdefault}, \pageref{usingpairdefault}
+
\subsection{Files and environments}
\item \cs{closegraphsfile}, \pageref{opengraphsfile}
@@ -7167,6 +7524,7 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{setfilename}, \pageref{setfilename}
\item \cs{setfilenametemplate}, \pageref{setfilenametemplate}
+
\subsection{Text}
\item \cs{axislabels}, \pageref{axislabels}
@@ -7177,6 +7535,7 @@ file (don't ask me what it consists of) and apparently processes it with
\item \cs{tlabel}, \pageref{tlabel}
\item \cs{tlabels}, \pageref{tlabel}
+
\subsection{Miscellaneous}
\item \cs{assignmfvalue}, \cs{assignmpvalue}, \pageref{assignmfvalue}
diff --git a/Master/texmf-dist/metafont/mfpic/grafbase.mf b/Master/texmf-dist/metafont/mfpic/grafbase.mf
index 87492e00849..25f9a9cf768 100644
--- a/Master/texmf-dist/metafont/mfpic/grafbase.mf
+++ b/Master/texmf-dist/metafont/mfpic/grafbase.mf
@@ -8,7 +8,7 @@
%%
%% -------------------------------------------------------------------
%%
-%% Copyright 2002--2011, Daniel H. Luecking
+%% Copyright 2002--2012, Daniel H. Luecking
%%
%% Mfpic may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3c of this license or (at
@@ -29,13 +29,14 @@ fi
boolean grafbase; grafbase := true;
string fileversion, filedate;
-fileversion := "1.06"; filedate := "2011/02/25";
+fileversion := "1.10"; filedate := "2012/12/03";
message " Loading grafbase macros, version " & fileversion & ", " &
filedate & ".";
message " ";
-def GBmsg expr s = message "Grafbase (" & jobname & "): " & s; enddef;
+def GBmsg expr s = message "Grafbase (" & jobname & "): " & s;
+enddef;
def GBwarn expr s = GBmsg "Warning, " & s; enddef;
def GBerrmsg (expr s) expr t = errhelp t;
errmessage "Grafbase (" & jobname & "): " & s; errhelp "";
@@ -57,7 +58,7 @@ def checkversions (expr g)=
fi
enddef;
-checkversions (106);
+checkversions (110);
if unknown base_name : input plain;
elseif not string base_name: input plain;
@@ -81,12 +82,13 @@ vardef mftitle expr t =
if string t: t; message t; fi
enddef;
-boolean METAPOST;
-METAPOST := known color Geamparalele din Babadag;
+boolean METAFONT, METAPOST;
+METAPOST := known color Carl Philipp Emanuel Bach;
+if METAPOST: METAFONT := false; else: METAFONT := true; fi
if METAPOST:
GBerrmsg ("wrong compiler.")
- "This file is for Metafont. For Metapost use grafbase.mp.";
+ "This file is for Metafont. For Metapost, use grafbase.mp.";
fi
if unknown mode:
@@ -306,12 +308,13 @@ vardef chpair (text proc) (expr p) =
(proc (xpart p), proc (ypart p))
enddef;
-vardef floorpair (expr p) = (floor (xpart p), floor (ypart p)) enddef;
-vardef ceilingpair (expr p) =
- (ceiling (xpart p), ceiling (ypart p))
+vardef floorpair (expr p) = (floor (xpart p), floor (ypart p))
+enddef;
+vardef ceilingpair (expr p) = (ceiling (xpart p), ceiling (ypart p))
enddef;
-def hroundpair (expr p) = (hround (xpart p), hround (ypart p)) enddef;
+def hroundpair (expr p) = (hround (xpart p), hround (ypart p))
+enddef;
vardef goodpair (expr p) = hroundpair(p.t_) enddef;
vardef emin (expr a, b) = if a < b: a else: b fi enddef;
@@ -333,7 +336,8 @@ vardef maxpair (suffix p) = setpair (_mp) p1;
pairmax (_mp, p[p])
enddef;
-primarydef Z xprod W = (xpart Z * ypart W - xpart W * ypart Z) enddef;
+primarydef Z xprod W = (xpart Z * ypart W - xpart W * ypart Z)
+enddef;
def force_initial (expr p) (suffix f) =
hide( setnumeric (_n) length f;
@@ -422,7 +426,7 @@ def endimage =
enddef;
def makeimage (suffix name) (expr refpt) =
- setpair (_image_reference_point) zconv(refpt);
+ setpair (_image_reference_point) zconv (refpt);
setpicture (name) beginimage
enddef;
def concludeimage =
@@ -679,7 +683,8 @@ vardef textrectx (expr a, b, c, rot, xy, lbl, rad, loc) =
fi
readjustdims (ll, ur) (label_sep - labelpath_sep);
- invvconv (thegblabel (ref_shift(a, b, c, ll, ur), rot, f)) shifted loc
+ invvconv (thegblabel (ref_shift(a, b, c, ll, ur), rot, f))
+ shifted loc
enddef;
def textovalx = xellipse (true) enddef;
@@ -704,7 +709,8 @@ vardef xellipse (expr aspect, a, b, c, r, xy, lbl, mult, loc) =
f := ellipse (cc, aa, bb, 0);
fi
readjustdims (ll, ur) (label_sep - labelpath_sep);
- invvconv (thegblabel (ref_shift(a, b, c, ll, ur), r, f)) shifted loc
+ invvconv (thegblabel (ref_shift(a, b, c, ll, ur), r, f))
+ shifted loc
fi
enddef;
@@ -776,16 +782,16 @@ vardef csc primary X = cscd (X*radian) enddef;
vardef degrees (expr t) = t*radian enddef;
vardef radians (expr t) = t/radian enddef;
-vardef invcos primary X = (acos X)/radian enddef;
-vardef invsin primary X = (asin X)/radian enddef;
-vardef invtan primary X = (atan X)/radian enddef;
+vardef invcos primary X = radians (acos X) enddef;
+vardef invsin primary X = radians (asin X) enddef;
+vardef invtan primary X = radians (atan X) enddef;
vardef exp primary X = mexp (256 * X) enddef;
vardef ln primary X = (mlog X) / 256 enddef;
-def log = ln enddef;
+vardef log primary X = ln (X) enddef;
vardef logbase (expr B) primary X = (mlog X)/(mlog B) enddef;
-def logtwo = logbase( 2) enddef;
-def logten = logbase(10) enddef;
+vardef logtwo primary X = logbase( 2) (X) enddef;
+vardef logten primary X = logbase(10) (X) enddef;
vardef cosh primary X =
setnumeric (temp) 2 exp (-abs(X));
@@ -858,15 +864,35 @@ vardef Arg primary Z = (angle Z)/radian enddef;
vardef Log primary Z = (ln (abs Z), Arg Z) enddef;
vardef cis primary T = dir (T*radian) enddef;
vardef zexp primary Z = (exp (xpart Z)) * cis (ypart Z) enddef;
-vardef sgn primary Z = if not (Z = origin): unitvector fi Z enddef;
+vardef sgn primary Z = if not (Z = origin): unitvector fi Z
+enddef;
+vardef zsqrt primary Z =
+ if Z = origin: origin else: sqrt(abs(Z)) * dir ((angle Z)/2) fi
+enddef;
vardef conj primary Z = (xpart Z, -ypart Z) enddef;
+primarydef Z zmul W = Z zscaled W enddef;
+primarydef Z zdiv W =
+ Z zmul ( unitvector (conj W) / (abs W) )
+enddef;
+
vardef Moebius (expr A) primary Z =
save _D; pair _D;
_D := (1, 0) + (Z zscaled (conj A));
(Z + A)/(abs _D) rotated (- angle _D)
enddef;
vardef pshdist (expr Z,W) = abs(Moebius(-W)(Z)) enddef;
+vardef pshdist_hp (expr Z,W) = abs(Z-W)/abs(Z-conj(W)) enddef;
+vardef kelvin (expr Z) =
+ save tmp_; tmp_ = abs(Z);
+ if tmp_ = 0:
+ (infinity, infinity)
+ elseif tmp_ < reallysmall:
+ infinity*unitvector Z
+ else:
+ (1/tmp_)*unitvector Z
+ fi
+enddef;
vardef polar primary p = (xpart p) * dir (ypart p) enddef;
def id (expr x) = x enddef;
@@ -894,7 +920,8 @@ enddef;
def bcoords = hide ( T_push (ztr) ) enddef;
def ecoords = hide ( T_pop (ztr); vtr := vectorpart ztr ) enddef;
-vardef vectorpart primary T = T shifted -(origin transformed T) enddef;
+vardef vectorpart primary T = T shifted -(origin transformed T)
+enddef;
def apply_t (text Transformer) =
ztr := identity Transformer transformed ztr;
@@ -1208,6 +1235,80 @@ def thatchf (suffix v) (expr CT, sp, a, b) =
endgroup
enddef;
+def axialgradientf (suffix clr, v) (expr theta, sp, a, b) =
+ begingroup
+ save _hh, _sp, _nn, _y;
+ _hh := ypart b - ypart a;
+ _sp := signof (_hh) abs(sp);
+ _nn := emax (1, round (_hh/_sp));
+ _sp := _hh/_nn + signof (_hh) epsilon;
+ _nn := _nn-1;
+ setpath (_p) rect ((xpart a, 0),(xpart b, _sp));
+ _y := ypart a;
+ for _i = 0 upto _nn:
+ if (clr(_i/_nn)) < white :
+ addto v also shaded (clr(_i/_nn)) ( _p shifted (0,_y))
+ rotated theta;
+ fi
+ _y := _y + _sp;
+ endfor
+ mono (v);
+ endgroup
+enddef;
+
+def areagradientf (suffix clr, v) (expr sp, tp, a, b) =
+begingroup
+ save _ww, _hh, _sp, _tp, _nn, _mm, _x, _y;
+ _ww := xpart b - xpart a;
+ _hh := ypart b - ypart a;
+ _sp := signof (_ww) abs(sp);
+ _tp := signof (_hh) abs(tp);
+ _nn := emax (1, round (_ww/_sp));
+ _mm := emax (1, round (_hh/_tp));
+ _sp := _ww/_nn + signof (_ww) epsilon;
+ _tp := _hh/_mm + signof (_hh) epsilon;
+ _mm := _mm-1; _nn := _nn-1;
+ setpath (_p) rect (origin,(_sp,_tp));
+ _x := xpart a; y_a := ypart a;
+ for _i = 0 upto _nn:
+ _y := y_a;
+ for _j = 0 upto _mm:
+ if (clr(_i/_nn,_j/_mm)) < white:
+ addto v also shaded (clr(_i/_nn,_j/_mm)) (_p shifted (_x,_y));
+ fi
+ _y := _y + _tp;
+ endfor
+ _x := _x + _sp;
+ endfor
+ mono (v);
+endgroup
+enddef;
+
+path unitcircle;
+unitcircle := fullcircle scaled 2;
+def radialgradientf (suffix clr, v) (expr sp, ctr, rad) =
+ begingroup
+ save _sp, _r, _nn;
+ _nn := emax (1, round (rad/sp));
+ _sp := rad/_nn + epsilon;
+ _nn := _nn - 1;
+ _r := _sp;
+ % fill the small center circle first
+ if (clr(0)) < white :
+ addto v also shaded (clr(0)) (unitcircle scaled _r shifted ctr);
+ fi
+ for _i = 1 upto _nn:
+ if (clr(_i/_nn)) < white :
+ addto v also shaded (clr(_i/_nn))
+ (unitcircle scaled (_r + _sp) -- reverse unitcircle scaled _r
+ --cycle) shifted ctr;
+ fi
+ _r := _r + _sp;
+ endfor
+ mono (v);
+ endgroup
+enddef;
+
def tile (suffix atile) (expr unit, width, height, clipit) =
picture atile.pic; atile.pic := nullpicture;
pair atile.dims;
@@ -1241,6 +1342,7 @@ vardef pnt@# (expr p) = point @# of p enddef;
vardef pre@# (expr p) = precontrol @# of p enddef;
vardef post@# (expr p) = postcontrol @# of p enddef;
+numeric bbox_split; bbox_split := 4;
def getbbox (suffix ll, ur) expr g =
setsplit (_s) bbox_split;
ur := ll := pnt 0 (g);
@@ -1248,17 +1350,31 @@ def getbbox (suffix ll, ur) expr g =
ll := pairmin (ll, pnt[_j] (g)); ur := pairmax (ur, pnt[_j] (g));
endfor
for _j = 1 upto _s*(length g):
- ctrlsbbox (subpath ((_j-1)/_s, _j/_s) of g) (ll, ur);
+ ctrlsbbox (ll, ur) subpath ((_j-1)/_s, _j/_s) of g;
endfor
if showbbox: noclip ( safedraw rect (ll, ur) ); fi
enddef;
-numeric bbox_split; bbox_split := 2;
-def ctrlsbbox (expr p) (suffix ll, ur) =
+def ctrlsbbox (suffix ll, ur) expr p =
ll := pairmin ( pairmin (ll, post0 (p)), pre 1 (p) );
ur := pairmax ( pairmax (ur, post0 (p)), pre 1 (p) );
enddef;
+def getradius (suffix rad) expr g =
+ setsplit (_s) bbox_split;
+ rad := abs (pnt0 (g));
+ for _j = 1 upto length g:
+ rad := emax(rad, abs(pnt[_j] (g)));
+ endfor
+ for _j = 1 upto _s*(length g):
+ ctrlsradius (rad) subpath ((_j-1)/_s, _j/_s) of g;
+ endfor
+enddef;
+
+def ctrlsradius (suffix rad) expr p =
+ rad := emax( emax (rad, abs(post0 (p))), abs(pre1 (p) ))
+enddef;
+
def safedraw = colorsafedraw (drawcolor) enddef;
def colorsafedraw (expr clr) expr d =
begingroup
@@ -1323,7 +1439,8 @@ def colorzigzag (expr clr) = colorwiggle (false, clr, 0) enddef;
def sinewave = colorsinewave (drawcolor) enddef;
def colorsinewave = colorwiggle (true) enddef;
-vardef colorwiggle (expr smth, clr, tens, blen, elen, len, wid) expr f =
+vardef colorwiggle (expr smth, clr, tens, blen, elen, len, wid) expr f
+=
convertpath (g) f;
setuplengtharray (cumlen, totlen, ct) g;
save B;
@@ -1514,6 +1631,50 @@ def colorxhatch (expr clr, sp) =
colorthatch (clr) (sp, 45) colorthatch (clr) (sp, -45)
enddef;
+vardef axialgradient (suffix clr) (expr sp, theta) expr f =
+ convertpath (g) f;
+ if not cycle g: NoCycle("axialgradient") g;
+ else:
+ newpicture (_grd);
+ setbbox (ll, ur) g rotated -theta;
+ axialgradientf (clr, _grd) (theta, sp, ll, ur);
+ DoClip (_grd); clipto (_grd) (g);
+ safeunfill g;
+ _orto (active_plane, _grd);
+ fi
+ f
+enddef;
+
+vardef areagradient (suffix clr) (expr sp, tp) expr f =
+ convertpath (g) f;
+ if not cycle g: NoCycle("areagradient") g;
+ else:
+ newpicture (_agr);
+ setbbox (ll, ur) g;
+ areagradientf (clr, _agr) (sp, tp, ll, ur);
+ DoClip (_agr); clipto (_agr) (g);
+ safeunfill g;
+ _orto (active_plane, _agr);
+ fi
+ f
+enddef;
+
+vardef radialgradient (suffix clr) (expr sp, ctr) expr f =
+ convertpath (g) f;
+ if not cycle g: NoCycle("radialgradient") g;
+ else:
+ setpair (_ctr) zconv (ctr);
+ newpicture (_agr);
+ save _rad;
+ getradius (_rad) g shifted - _ctr;
+ radialgradientf (clr, _agr) (sp, _ctr, _rad);
+ DoClip (_agr); clipto (_agr) (g);
+ safeunfill g;
+ _orto (active_plane, _agr);
+ fi
+ f
+enddef;
+
vardef NoTile (suffix atile) expr g =
GBwarn str atile & " is not a valid tile for tess()."
& " The path will be drawn instead.";
@@ -1624,8 +1785,8 @@ vardef makelengtharray (suffix clen) suffix p =
numeric clen[];
clen := _s * length p; clen0 := 0;
for _i = 1 upto clen:
- clen[_i] := clen[_i-1] + abs (pnt[_i/_s] (p) - pnt[(_i-1)/_s] (p)) /
- _rescale_factor;
+ clen[_i] := clen[_i-1] + abs (pnt[_i/_s] (p) - pnt[(_i-1)/_s] (p))
+ / _rescale_factor;
endfor
clen[clen]
enddef;
@@ -2201,6 +2362,25 @@ vardef brownianpath (expr start, num, sc) =
endfor
mkpoly (false, _brp)
enddef;
+vardef randomwalk (expr start, num, dst) =
+ setnumeric (_rdw) 1;
+ setpair (_tmp) start;
+ pair _rdw[]; _rdw1 := _tmp;
+ for _idx := 1 upto num:
+ _tmp := _tmp + dst*dir(uniformdeviate(360));
+ _rdw[incr _rdw] := _tmp;
+ endfor
+ mkpoly (false, _rdw)
+enddef;
+vardef browniangraph (expr num, scst) =
+ setnumeric (_brg) 1;
+ pair _tmp, _brg[]; _tmp := _brg1 := (0,0);
+ for _idx := 1 upto num:
+ _tmp := _tmp + scst*(1,normaldeviate);
+ _brg[incr _brg] := _tmp;
+ endfor
+ mkpoly (false, _brg)
+enddef;
vardef mksmooth (expr tens, cyclic) (suffix pts) =
if pts = 1: onepointpath (cyclic, pts1)
@@ -2237,8 +2417,8 @@ vardef mkconvex (expr tens, cyclic) (suffix pts) =
_B[_j] := sqrt(abs((pts[_j]-pts[_j-1])xprod(pts[_j+1]-pts[_j])));
endfor
if cyclic:
- _B1 := sqrt(abs((pts1 - pts[pts])xprod(pts2 - pts1)));
- _B[pts] := sqrt(abs((pts[pts]-pts[pts-1])xprod(pts1 - pts[pts])));
+ _B1 := sqrt(abs((pts1 - pts[pts])xprod(pts2 - pts1)));
+ _B[pts] := sqrt(abs((pts[pts]-pts[pts-1])xprod(pts1 - pts[pts])));
else:
_B1 := _B2;
_B[pts] := _B[pts-1];
@@ -2282,12 +2462,16 @@ enddef;
numeric default_tension; default_tension := 1;
def curve = tcurve (default_tension) enddef;
vardef tcurve (expr tens, cyclic) (text t) =
- setpairs (_tc) (t); mksmooth (tens, cyclic, _tc)
+ setpairs (_tc) (t);
+ if _tc=0: NoPoints("curve", _tc); fi
+ mksmooth (tens, cyclic, _tc)
enddef;
def ccurve = tccurve (default_tension) enddef;
vardef tccurve (expr tens, cyclic) (text t) =
- setuniquepairs (_tcc) (t); mkconvex (tens, cyclic, _tcc)
+ setuniquepairs (_tcc) (t);
+ if _tcc=0: NoPoints("ccurve", _tcc); fi
+ mkconvex (tens, cyclic, _tcc)
enddef;
vardef mkbezier (expr tens, cyclic) (suffix pts) =
@@ -2309,8 +2493,8 @@ vardef mkqbezier (expr cyclic) (suffix pts) =
if pts=1: {0,0}
else:
for _i = 2 step 2 until pts - 1:
- ..controls 1/3[pts[_i], pts[_i-1] ] and 1/3[pts[_i], pts[_i+1] ]..
- pts[_i+1]
+ ..controls 1/3[pts[_i], pts[_i-1]]
+ and 1/3[pts[_i], pts[_i+1]].. pts[_i+1]
endfor
if cyclic:
..controls 1/3[ pts[pts], pts[pts - 1] ]
@@ -2389,6 +2573,7 @@ def tfcncurve = functioncurve enddef;
vardef functioncurve (expr ftens) (text t) =
settension (_ftens) ftens; if _ftens < 1/3: _ftens := 1/3; fi
setuniquepairs (_fc) (t);
+ if _fc=0: NoPoints ("functioncurve", _fc); fi
if _fc > 1: _fc0 := _fc1; _fc[_fc+1] := _fc[_fc]; fi
mkfcnpath (_ftens) (_fc)
enddef;
@@ -2560,7 +2745,7 @@ enddef;
def arccps = arc enddef;
vardef arcpps (expr begpt, endpt, sweep) =
- if begpt = endpt: begpt--endpt
+ if (begpt = endpt) or (sweep = 0): begpt--endpt
else:
setpair (cd) unitvector (endpt-begpt);
if abs(sweep) <= 45:
@@ -2649,20 +2834,42 @@ vardef circlepps (expr one, two, sweep) =
enddef;
vardef circlepp (expr small, one, two, rad) =
- arcpp (small, one, two, rad) & arcpp (not small, two, one, rad) & cycle
+ arcpp (small, one, two, rad) & arcpp (not small, two, one, rad)
+ & cycle
enddef;
def circleppr (expr one, two, rad, small) =
circleppr (one, two, rad, small)
enddef;
+vardef quarterellipse(expr A,B,C) =
+ save T_;
+ transform T_;
+ (1,0) transformed T_ = A;
+ (1,1) transformed T_ = B;
+ (0,1) transformed T_ = C;
+ quartercircle scaled 2 transformed T_
+enddef;
+
+vardef halfellipse (expr A,B,C) =
+ save P_; pair P_;
+ P_ = (C - A)/2;
+ quarterellipse (A, B - P_, B) & quarterellipse (B, B + P_, C)
+enddef;
+
+vardef fullellipse (expr C, A, B) =
+ save P_; pair P_;
+ P_ := 2[A,C];
+ halfellipse (A,B,P_) & halfellipse (P_,2[B,C],A) & cycle
+enddef;
+
vardef pathcenter expr p =
save a, cntr, n; pair cntr, a[];
n := length p;
a1 = pnt 0 (p);
a3 = pnt [n/2] (p);
if cycle p:
- a2 = pnt [n/4] (p);
+ a2 = pnt [ n/4] (p);
a4 = pnt [3n/4] (p);
else:
a2 := a3;
@@ -2716,43 +2923,93 @@ vardef pshcircle (expr disk, ctr, rad) =
elseif abs(ctr) >= 1 :
if abs(ctr) > 1:
GBerrmsg ("Impossible center of pseudohyperbolic circle.")
- "The center of a pseudohyperbolic circle must be in "
+ "The center of this pseudohyperbolic circle must be in "
& "the unit disk.";
fi
onepointpath (true,ctr)
else:
- % compute Euclidean center and radius (and a denominator used twice
- % in calculations).
save _r, _dnm;
_r := abs(ctr);
_dnm := 1 - _r*_r*rad*rad;
- circle ( (1 - rad*rad)/_dnm*ctr, rad*(1 - _r*_r)/_dnm)
+ circle ((1 - rad*rad)/_dnm*ctr, rad*(1 - _r*_r)/_dnm)
fi
else:
if rad >= 1 :
- GBerrmsg ("Impossible pseudohyperbolic circle.")
+ GBerrmsg ("Impossible radius of pseudohyperbolic circle.")
"The radius of a pseudohyperbolic circle must be less than 1.";
onepointpath (true,ctr)
elseif ypart ctr <= 0:
if ypart ctr < 0:
- GBerrmsg ("Impossible pseudohyperbolic circle.")
- "The center of a pseudohyperbolic circle must be in "
+ GBerrmsg ("Impossible center of pseudohyperbolic circle.")
+ "The center of this pseudohyperbolic circle must be in "
& "the upper half-plane.";
fi
onepointpath (true,ctr)
else:
- % compute Euclidean center and radius (and a denominator used twice
- % in calculations).
- % Euclidean center at xpart ctr + (1 + R^2)/(1 - R^2)*ypart ctr
- % Euclidean radius 4R/(1 - R^2)*ypart ctr
save _y, _dnm;
_y := ypart ctr;
_dnm := 1 - rad*rad;
- circle ( (xpart ctr, (1 + rad*rad)/_dnm * _y), 2rad/_dnm*_y)
+ circle ((xpart ctr, (1 + rad*rad)/_dnm * _y), 2rad/_dnm*_y)
fi
fi
enddef;
+vardef UHPgeodesic (expr A, B) =
+ if xpart A = xpart B:
+ A--B
+ else:
+ save ang_, C_; pair C_;
+ if abs(ypart A) < abs(ypart B):
+ C_ := conj B;
+ else:
+ C_ := conj A;
+ fi
+ if ypart C_ = 0: % both on x-axis
+ ang_ := anglefromto(up, B - A);
+ else:
+ ang_ := anglefromto(A - C_, B - C_);
+ fi
+ arcpps(A, B, 2ang_)
+ fi
+enddef;
+
+vardef UDgeodesic (expr A, B) =
+ save a_, b_;
+ a_ := abs(A); b_ = abs(B);
+ if (a_ = 0) or (b_ = 0):
+ A--B
+ elseif angle A = angle B:
+ A--B
+ else: % note: A, B and B-A are all nonzero from this point
+ save ang_;
+ if a_ = 1:
+ ang_ := anglefromto (if b_>1: A else: -A fi, B-A)
+ elseif b_ = 1:
+ ang_ := anglefromto (A-B, if a_>1: B else: -B fi)
+ else:
+ save C_; pair C_;
+ % reflecting A
+ if a_ < eps:
+ C_ := unitvector A;
+ ang_1 := anglefromto(a_*A - C_, a_*B - C_);
+ else:
+ C_ := (1/a_)*unitvector A;
+ ang_1 := anglefromto(A - C_, B - C_);
+ fi
+ % reflecting B
+ if b_ < eps:
+ C_ := unitvector B;
+ ang_2 := anglefromto(b_*A - C_, b_*B - C_);
+ else:
+ C_ := (1/b_)*unitvector B;
+ ang_2 := anglefromto(A - C_, B - C_);
+ fi
+ ang_ := if abs(ang_1) < abs(ang_2): ang_1 else: ang_2 fi;
+ fi
+ arcpps(A, B, 2ang_)
+ fi
+enddef;
+
vardef barycenter expr t =
save m; m := length t if not cycle t: + 1 fi;
pnt0(t)/m for k = 1 upto m - 1: + pnt[k](t)/m endfor
@@ -2762,6 +3019,26 @@ vardef sector (expr center, rad, frtheta, totheta) =
center -- arcalt (center, rad, frtheta, totheta) -- cycle
enddef;
+vardef mkbrace (expr S, C, E) =
+ save R_, U_, V_, Z_;
+ pair U_, V_, Z_[];
+ U_ := unitvector (E-S);
+ V_ := U_ rotated 90;
+
+ R_ := 0.5*(C-S) dotprod V_;
+ if R_ = 0:
+ S--C
+ else:
+ if R_ < 0 : V_ := -V_; R_ := -R_; fi
+ V_ := R_*V_; U_ := R_*U_;
+ Z_1 := S + V_ + U_;
+ Z_2 := C - V_ - U_;
+ Z_3 := C - V_ + U_;
+ Z_4 := E + V_ - U_;
+ S{V_}..{U_}Z_1--Z_2{U_}..{V_}C{-V_}..{U_}Z_3--Z_4{U_}..{-V_}E
+ fi
+enddef;
+
vardef mkfcn (expr sm, tens) (expr bmin, bmax, bst) (text pf) =
save _p; pair _p[]; _p := 0;
save _dx, _n, _r; numeric _dx, _n, _r;
@@ -2834,7 +3111,7 @@ tolerancefactor := .02;
vardef mklevelset (expr sm, tens, X, Y, t, a, b, c, d) =
save _inside_;
vardef _inside_ (expr U, V) =
- inside_levelset (U, V) and between (a, b) (U) and between (c, d) (V)
+ inside_levelset(U, V) and between(a, b)(U) and between(c, d)(V)
enddef;
if not _inside_ (X, Y):
GBwarn "Invalid seed point for levelset.";
@@ -2902,16 +3179,16 @@ vardef tRKIV (expr sm, tens, zstart, ds, N) (text _RHS_) =
for _idx := 2 upto _trj:
_dt := ds/emax(1,abs(_RHS_(_tt,_ztr)));
_th := _tt + .5_dt;
- _dz1 := _dt*_RHS_(_tt, _ztr); % displacement based on current point
+ _dz1 := _dt*_RHS_(_tt, _ztr); % displacement for current point
_ztmp := _ztr + .5_dz1; % 1st midpoint
% use _th instead of twice calculating (_tt + .5_dt)
- _dz2 := _dt*_RHS_(_th, _ztmp); % displacement based on 1st midpoint
+ _dz2 := _dt*_RHS_(_th, _ztmp); % displacement for 1st midpoint
_ztmp := _ztr + .5_dz2; % 2nd midpoint
- _dz3 := _dt*_RHS_(_th, _ztmp); % displacement based on 2nd midpoint
+ _dz3 := _dt*_RHS_(_th, _ztmp); % displacement for 2nd midpoint
_ztmp := _ztr + _dz3; % temporary end point
- % get time for next loop now since we need it right away in next line:
+ % get time for next loop now since we need it in the next line:
_tt := _tt + _dt;
- _dz4 := _dt*_RHS_(_tt, _ztmp); % displacement based on end point
+ _dz4 := _dt*_RHS_(_tt, _ztmp); % displacement for end point
% get next point
_ztr := _ztr + (_dz1 + 2_dz2 + 2_dz3 + _dz4)/6;
_trj[_idx] := _ztr;
@@ -3165,7 +3442,8 @@ vardef colorGheadpath
f
enddef;
-path cut_path; cut_path := (.5,0)--(.5,.71)--(-.5,.71)--(-.5,0)--cycle;
+path cut_path;
+cut_path := (.5,0)--(.5,.71)--(-.5,.71)--(-.5,0)--cycle;
def tailpath (suffix sh) = colortailpath (sh) (headcolor) enddef;
vardef colortailpath (suffix sh) (expr clr, sc, rot, pos) expr f =
@@ -3283,6 +3561,85 @@ vardef randomlines (expr maxshift) expr f =
fi
enddef;
+vardef interpolatedpath (expr t, P) expr Q =
+ if not path Q:
+ GBerrmsg ("Improper argument to interpolatedpath.")
+ "The last argument to interpolatedpath must be a path.";
+ if pair P: onepointpath(false, P)
+ else:
+ if path P:
+ P
+ else:
+ onepointpath (false, origin)
+ fi
+ fi
+ elseif pair P:
+ interpolated_pair_path (t, cycle Q, P, Q)
+ elseif not path P:
+ GBerrmsg ("Improper argument to interpolatedpath.")
+ "The second argument to interpolatedpath must be a pair "
+ & "or a path.";
+ Q
+ else:
+ if t=0: Q
+ elseif t=1: P
+ else:
+ save P_, Q_; path P_, Q_;
+ P_ := detrivialized P;
+ Q_ := detrivialized Q;
+ if length P_ = 0:
+ interpolated_pair_path (t, cycle Q, pnt0(P_), Q)
+ elseif length Q_ = 0:
+ interpolated_pair_path (t, cycle Q, pnt0(Q_), P)
+ else:
+ save G, H, n, m, k, r;
+ path G[], H[];
+ G := H := 0;
+ n := length P_; m := length Q_;
+ k := gcd(n, m);
+ r := m/k;
+ for I=0 upto n-1:
+ for J=0 upto r-1:
+ G[incr G] := subpath (I+J/r, I+(J+1)/r) of P_;
+ endfor
+ endfor
+ r := n/k;
+ for I=0 upto m-1:
+ for J=0 upto r-1:
+ H[incr H] := subpath (I+J/r, I+(J+1)/r) of Q_;
+ endfor
+ endfor
+ for N = 1 upto G-1:
+ force_equal_ends(G[N], G[N+1]);
+ force_equal_ends(H[N], H[N+1]);
+ endfor
+ interpolated_segment (t, G1, H1)
+ for N = 2 upto G: & interpolated_segment (t, G[N], H[N])
+ endfor if (pnt0(G1)=pnt1(G[G])) and (cycle Q): & cycle fi
+ fi
+ fi
+ fi
+enddef;
+
+vardef interpolated_pair_path (expr t, cyclic, P, Q) =
+ save N; N := length Q;
+ if N=0: onepointpath (cyclic, (t)[pnt0(Q),P])
+ else:
+ (t)[pnt0(Q),P]..controls (t)[post0(Q),P] and
+ for n=1 upto N - 1:
+ (t)[pre[n](Q),P]..(t)[pnt[n](Q),P]..controls (t)[post[n](Q),P]
+ and
+ endfor
+ (t)[pre[N](Q),P].. if cyclic: cycle else: (t)[pnt[N](Q),P] fi
+ fi
+enddef;
+
+vardef interpolated_segment (expr t, S, T) =
+ (t)[ pnt0(S), pnt0(T)]..controls
+ (t)[ post0(S), post0(T)] and (t)[ pre1(S), pre1(T)]..
+ (t)[ pnt1(S), pnt1(T)]
+enddef;
+
vardef parasegment (expr d, segs, f) =
if d = 0: f
else:
@@ -3305,7 +3662,7 @@ vardef parapath (expr d) expr f =
path g[], h, p[], q[];
numeric a, s, t;
pair u, v, w, w[];
- s := emax (3, emin (segment_split, ceiling (max_points/5/length f)));
+ s := emax(3, emin(segment_split, ceiling(max_points/5/length f)));
p := 0;
for i = 1 upto length f:
h := subpath (i-1, i) of f;
@@ -3475,8 +3832,8 @@ Plus.clear := (right--(1,1)--(-1,1)--(left)--cycle) scaled .65;
Cross := ((0,0)--(dir 45)--(dir -135)--(0,0)--(dir -45)--(dir 135))
scaled .65;
-Cross.clear := ((0,0)--(dir -45)--dir(45)--(dir 135)--(dir -135)--cycle)
- scaled .65;
+Cross.clear :=
+ ((0,0)--(dir -45)--dir(45)--(dir 135)--(dir -135)--cycle) scaled .65;
Asterisk := ((0,0)--up--down--(0,0)--(dir 30)--(dir -150)
--(0,0)--(dir -30)--(dir 150)) scaled .6;
@@ -3512,7 +3869,8 @@ save _A; pair _A[];
SolidStar := mkstar (5, 2, _A) scaled .84;
Star := undo_cycle SolidStar;
Star.clear := polyline (true)
- (_A9, _A10, _A1, _A2, _A3, (xpart _A3, 1), (xpart _A9, 1)) scaled .84;
+ (_A9, _A10, _A1, _A2, _A3, (xpart _A3, 1), (xpart _A9, 1))
+ scaled .84;
SolidStar.clear := Star.clear;
forsuffixes S =
@@ -3620,7 +3978,8 @@ def barchart (expr firstbar, sep, r, vert)(text data) =
path chartbar[];
chartbar := 0; barwd := r*sep;
for _itm = data:
- barend[incr chartbar] := if pair _itm: ypart _itm else: _itm fi;
+ barend[incr chartbar]
+ := if pair _itm: ypart _itm else: _itm fi;
barbegin[chartbar] := if pair _itm: xpart _itm else: 0 fi;
endfor
barbegin := barend := barlength := barstart := chartbar;
diff --git a/Master/texmf-dist/metapost/mfpic/dvipsnam.mp b/Master/texmf-dist/metapost/mfpic/dvipsnam.mp
index ce41b42cd0a..be004a7e099 100644
--- a/Master/texmf-dist/metapost/mfpic/dvipsnam.mp
+++ b/Master/texmf-dist/metapost/mfpic/dvipsnam.mp
@@ -8,7 +8,7 @@
%%
%% -------------------------------------------------------------------
%%
-%% Copyright 2002--2011, Daniel H. Luecking
+%% Copyright 2002--2012, Daniel H. Luecking
%%
%% Mfpic may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3c of this license or (at
diff --git a/Master/texmf-dist/metapost/mfpic/grafbase.mp b/Master/texmf-dist/metapost/mfpic/grafbase.mp
index ad20b43df1b..64f6395181a 100644
--- a/Master/texmf-dist/metapost/mfpic/grafbase.mp
+++ b/Master/texmf-dist/metapost/mfpic/grafbase.mp
@@ -8,7 +8,7 @@
%%
%% -------------------------------------------------------------------
%%
-%% Copyright 2002--2011, Daniel H. Luecking
+%% Copyright 2002--2012, Daniel H. Luecking
%%
%% Mfpic may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3c of this license or (at
@@ -29,13 +29,14 @@ fi
boolean grafbase; grafbase := true;
string fileversion, filedate;
-fileversion := "1.06"; filedate := "2011/02/25";
+fileversion := "1.10"; filedate := "2012/12/03";
message " Loading grafbase macros, version " & fileversion & ", " &
filedate & ".";
message " ";
-def GBmsg expr s = message "Grafbase (" & jobname & "): " & s; enddef;
+def GBmsg expr s = message "Grafbase (" & jobname & "): " & s;
+enddef;
def GBwarn expr s = GBmsg "Warning, " & s; enddef;
def GBerrmsg (expr s) expr t = errhelp t;
errmessage "Grafbase (" & jobname & "): " & s; errhelp "";
@@ -57,7 +58,7 @@ def checkversions (expr g)=
fi
enddef;
-checkversions (106);
+checkversions (110);
if unknown base_name : input plain;
elseif not string base_name: input plain;
@@ -81,13 +82,14 @@ vardef mftitle expr t =
if string t: t; message t; fi
enddef;
-boolean METAPOST;
-METAPOST := known color Geamparalele din Babadag;
+boolean METAFONT, METAPOST;
+METAPOST := known color Carl Philipp Emanuel Bach;
+if METAPOST: METAFONT := false; else: METAFONT := true; fi
-if not METAPOST:
+if METAFONT:
GBerrmsg ("wrong compiler.")
- "This file is for Metapost. For Metafont use grafbase.mf.";
+ "This file is for Metapost. For Metafont, use grafbase.mf.";
fi
numeric metapostversion;
@@ -163,7 +165,7 @@ enddef;
boolean showbbox; showbbox := false;
-if not has_cmyk: let rgbcolor = color; let cmykcolor = color; fi
+if not has_cmyk: let rgbcolor = color; let cmykcolor = color; fi
def _wc_ = withcolor enddef;
color currentcolor, drawcolor, fillcolor, hatchcolor,
@@ -189,6 +191,15 @@ enddef;
vardef rgbgray (expr g) = (snapto g) * white enddef;
vardef cmykgray (expr g) = cmyk(0,0,0,1 - snapto g) enddef;
+def colorchoice (expr clr) (text D)(text N)(text R)(text C) =
+ if unknown clr: D
+ elseif numeric clr: N
+ elseif rgbcolor clr: R
+ elseif cmykcolor clr: C
+ else: D
+ fi
+enddef;
+
if has_cmyk :
vardef grayscalegray (expr g) = snapto g enddef;
vardef gray (expr g) = grayscalegray (g) enddef;
@@ -196,15 +207,6 @@ if has_cmyk :
(snapto c, snapto m, snapto y, snapto k)
enddef;
- def colorchoice (expr clr) (text D)(text N)(text R)(text C) =
- if unknown clr: D
- elseif numeric clr: N
- elseif rgbcolor clr: R
- elseif cmykcolor clr: C
- else: D
- fi
- enddef;
-
vardef makecmyk primary clr =
colorchoice (clr)(cmykblack)(cmykgray(clr))
(rgbtocmyk(redpart clr,greenpart clr,bluepart clr))
@@ -212,14 +214,14 @@ if has_cmyk :
enddef;
vardef makergb primary clr =
colorchoice (clr)(rgbblack)(rgbgray(clr))(clr)
- (cmyktorgb(cyanpart clr, magentapart clr, yellowpart clr,
- blackpart clr))
+ (cmyktorgb(cyanpart clr, magentapart clr,
+ yellowpart clr, blackpart clr))
enddef;
vardef makegray primary clr =
colorchoice (clr)(grayscaleblack)(grayscalegray(clr))
(rgbtogray (redpart clr, greenpart clr, bluepart clr))
- (cmyktogray(cyanpart clr, magentapart clr, yellowpart clr,
- blackpart clr))
+ (cmyktogray(cyanpart clr, magentapart clr,
+ yellowpart clr, blackpart clr))
enddef;
vardef iscolor expr clr =
(rgbcolor clr) or (cmykcolor clr) or (numeric clr) or (boolean clr)
@@ -228,19 +230,12 @@ else:
vardef gray (expr g) = rgbgray(g) enddef;
vardef grayscalegray (expr g) = rgbgray(g) enddef;
vardef cmyk (expr c, m, y, k) = rgb (1-c-k, 1-m-k, 1-y-k) enddef;
- def colorchoice (expr clr) (text D)(text N)(text R) =
- if unknown clr: D
- elseif numeric clr: N
- elseif rgbcolor clr: R
- else: D
- fi
- enddef;
vardef makergb primary clr =
- colorchoice (clr)(rgbblack)(rgbgray(clr))(clr)
+ colorchoice (clr)(rgbblack)(rgbgray(clr))(clr)()
enddef;
vardef makegray primary clr =
colorchoice (clr)(rgbblack)(rgbgray(clr))
- (rgbtogray (redpart clr, greenpart clr, bluepart clr))
+ (rgbtogray (redpart clr, greenpart clr, bluepart clr))()
enddef;
def makecmyk = makergb enddef;
vardef iscolor expr clr = (color clr) enddef;
@@ -344,9 +339,9 @@ vardef chpair (text proc) (expr p) =
(proc (xpart p), proc (ypart p))
enddef;
-vardef floorpair (expr p) = (floor (xpart p), floor (ypart p)) enddef;
-vardef ceilingpair (expr p) =
- (ceiling (xpart p), ceiling (ypart p))
+vardef floorpair (expr p) = (floor (xpart p), floor (ypart p))
+enddef;
+vardef ceilingpair (expr p) = (ceiling (xpart p), ceiling (ypart p))
enddef;
vardef emin (expr a, b) = if a < b: a else: b fi enddef;
@@ -368,7 +363,8 @@ vardef maxpair (suffix p) = setpair (_mp) p1;
pairmax (_mp, p[p])
enddef;
-primarydef Z xprod W = (xpart Z * ypart W - xpart W * ypart Z) enddef;
+primarydef Z xprod W = (xpart Z * ypart W - xpart W * ypart Z)
+enddef;
def force_initial (expr p) (suffix f) =
hide( setnumeric (_n) length f;
@@ -452,7 +448,7 @@ def endimage =
enddef;
def makeimage (suffix name) (expr refpt) =
- setpair (_image_reference_point) zconv(refpt);
+ setpair (_image_reference_point) zconv (refpt);
setpicture (name) beginimage
enddef;
def concludeimage =
@@ -775,7 +771,8 @@ vardef textrectx (expr a, b, c, rot, xy, lbl, rad, loc) =
fi
readjustdims (ll, ur) (label_sep - labelpath_sep);
- invvconv (thegblabel (ref_shift(a, b, c, ll, ur), rot, f)) shifted loc
+ invvconv (thegblabel (ref_shift(a, b, c, ll, ur), rot, f))
+ shifted loc
enddef;
def textovalx = xellipse (true) enddef;
@@ -800,7 +797,8 @@ vardef xellipse (expr aspect, a, b, c, r, xy, lbl, mult, loc) =
f := ellipse (cc, aa, bb, 0);
fi
readjustdims (ll, ur) (label_sep - labelpath_sep);
- invvconv (thegblabel (ref_shift(a, b, c, ll, ur), r, f)) shifted loc
+ invvconv (thegblabel (ref_shift(a, b, c, ll, ur), r, f))
+ shifted loc
fi
enddef;
@@ -874,16 +872,16 @@ vardef csc primary X = cscd (X*radian) enddef;
vardef degrees (expr t) = t*radian enddef;
vardef radians (expr t) = t/radian enddef;
-vardef invcos primary X = (acos X)/radian enddef;
-vardef invsin primary X = (asin X)/radian enddef;
-vardef invtan primary X = (atan X)/radian enddef;
+vardef invcos primary X = radians (acos X) enddef;
+vardef invsin primary X = radians (asin X) enddef;
+vardef invtan primary X = radians (atan X) enddef;
vardef exp primary X = mexp (256 * X) enddef;
vardef ln primary X = (mlog X) / 256 enddef;
-def log = ln enddef;
+vardef log primary X = ln (X) enddef;
vardef logbase (expr B) primary X = (mlog X)/(mlog B) enddef;
-def logtwo = logbase( 2) enddef;
-def logten = logbase(10) enddef;
+vardef logtwo primary X = logbase( 2) (X) enddef;
+vardef logten primary X = logbase(10) (X) enddef;
vardef cosh primary X =
setnumeric (temp) 2 exp (-abs(X));
@@ -956,15 +954,35 @@ vardef Arg primary Z = (angle Z)/radian enddef;
vardef Log primary Z = (ln (abs Z), Arg Z) enddef;
vardef cis primary T = dir (T*radian) enddef;
vardef zexp primary Z = (exp (xpart Z)) * cis (ypart Z) enddef;
-vardef sgn primary Z = if not (Z = origin): unitvector fi Z enddef;
+vardef sgn primary Z = if not (Z = origin): unitvector fi Z
+enddef;
+vardef zsqrt primary Z =
+ if Z = origin: origin else: sqrt(abs(Z)) * dir ((angle Z)/2) fi
+enddef;
vardef conj primary Z = (xpart Z, -ypart Z) enddef;
+primarydef Z zmul W = Z zscaled W enddef;
+primarydef Z zdiv W =
+ Z zmul ( unitvector (conj W) / (abs W) )
+enddef;
+
vardef Moebius (expr A) primary Z =
save _D; pair _D;
_D := (1, 0) + (Z zscaled (conj A));
(Z + A)/(abs _D) rotated (- angle _D)
enddef;
vardef pshdist (expr Z,W) = abs(Moebius(-W)(Z)) enddef;
+vardef pshdist_hp (expr Z,W) = abs(Z-W)/abs(Z-conj(W)) enddef;
+vardef kelvin (expr Z) =
+ save tmp_; tmp_ = abs(Z);
+ if tmp_ = 0:
+ (infinity, infinity)
+ elseif tmp_ < reallysmall:
+ infinity*unitvector Z
+ else:
+ (1/tmp_)*unitvector Z
+ fi
+enddef;
vardef polar primary p = (xpart p) * dir (ypart p) enddef;
def id (expr x) = x enddef;
@@ -992,7 +1010,8 @@ enddef;
def bcoords = hide ( T_push (ztr) ) enddef;
def ecoords = hide ( T_pop (ztr); vtr := vectorpart ztr ) enddef;
-vardef vectorpart primary T = T shifted -(origin transformed T) enddef;
+vardef vectorpart primary T = T shifted -(origin transformed T)
+enddef;
def apply_t (text Transformer) =
ztr := identity Transformer transformed ztr;
@@ -1224,6 +1243,71 @@ def thatchf (suffix v) (expr CT, sp, a, b) =
endgroup
enddef;
+def axialgradientf (suffix clr, v) (expr theta, sp, a, b) =
+ begingroup
+ save _hh, _sp, _nn, _y;
+ _hh := ypart b - ypart a;
+ _sp := signof (_hh) abs(sp);
+ _nn := emax (1, round (_hh/_sp));
+ _sp := _hh/_nn + signof (_hh) epsilon;
+ _nn := _nn-1;
+ setpath (_p) rect ((xpart a, 0),(xpart b, _sp));
+ _y := ypart a;
+ for _i = 0 upto _nn:
+ addto v contour (_p shifted (0,_y)) rotated theta
+ withcolor clr(_i/_nn);
+ _y := _y + _sp;
+ endfor
+ endgroup
+enddef;
+
+def areagradientf (suffix clr, v) (expr sp, tp, a, b) =
+begingroup
+ save _ww, _hh, _sp, _tp, _nn, _mm, _x, _y;
+ _ww := xpart b - xpart a;
+ _hh := ypart b - ypart a;
+ _sp := signof (_ww) abs(sp);
+ _tp := signof (_hh) abs(tp);
+ _nn := emax (1, round (_ww/_sp));
+ _mm := emax (1, round (_hh/_tp));
+ _sp := _ww/_nn + signof (_ww) epsilon;
+ _tp := _hh/_mm + signof (_hh) epsilon;
+ _mm := _mm-1; _nn := _nn-1;
+ setpath (_p) rect (origin,(_sp,_tp));
+ _x := xpart a; y_a := ypart a;
+ for _i = 0 upto _nn:
+ _y := y_a;
+ for _j = 0 upto _mm:
+ addto v contour (_p shifted (_x,_y)) withcolor
+ clr(_i/_nn,_j/_mm);
+ _y := _y + _tp;
+ endfor
+ _x := _x + _sp;
+ endfor
+endgroup
+enddef;
+
+path unitcircle;
+unitcircle := fullcircle scaled 2;
+def radialgradientf (suffix clr, v) (expr sp, ctr, rad) =
+ begingroup
+ save _sp, _r, _nn;
+ _nn := emax (1, round (rad/sp));
+ _sp := rad/_nn + epsilon;
+ _nn := _nn - 1;
+ _r := _sp;
+ % fill the small center circle first
+ addto v contour (unitcircle scaled _r shifted ctr)
+ withcolor clr(0);
+ for _i = 1 upto _nn:
+ addto v contour
+ (unitcircle scaled (_r + _sp) -- reverse unitcircle scaled _r
+ --cycle) shifted ctr withcolor clr(_i/_nn);
+ _r := _r + _sp;
+ endfor
+ endgroup
+enddef;
+
def tile (suffix atile) (expr unit, width, height, clipit) =
picture atile.pic; atile.pic := nullpicture;
pair atile.dims;
@@ -1257,11 +1341,27 @@ vardef pnt@# (expr p) = point @# of p enddef;
vardef pre@# (expr p) = precontrol @# of p enddef;
vardef post@# (expr p) = postcontrol @# of p enddef;
+numeric bbox_split; bbox_split := 4;
def getbbox (suffix ll, ur) expr g =
ll := llcorner g; ur := urcorner g;
if showbbox: noclip ( safedraw rect (ll, ur) ); fi
enddef;
+def getradius (suffix rad) expr g =
+ setsplit (_s) bbox_split;
+ rad := abs (pnt0 (g));
+ for _j = 1 upto length g:
+ rad := emax(rad, abs(pnt[_j] (g)));
+ endfor
+ for _j = 1 upto _s*(length g):
+ ctrlsradius (rad) subpath ((_j-1)/_s, _j/_s) of g;
+ endfor
+enddef;
+
+def ctrlsradius (suffix rad) expr p =
+ rad := emax( emax (rad, abs(post0 (p))), abs(pre1 (p) ))
+enddef;
+
def safedraw = colorsafedraw (drawcolor) enddef;
def colorsafedraw (expr clr) expr d =
begingroup
@@ -1319,7 +1419,8 @@ def colorzigzag (expr clr) = colorwiggle (false, clr, 0) enddef;
def sinewave = colorsinewave (drawcolor) enddef;
def colorsinewave = colorwiggle (true) enddef;
-vardef colorwiggle (expr smth, clr, tens, blen, elen, len, wid) expr f =
+vardef colorwiggle (expr smth, clr, tens, blen, elen, len, wid) expr f
+=
convertpath (g) f;
setuplengtharray (cumlen, totlen, ct) g;
save B;
@@ -1474,6 +1575,47 @@ def colorxhatch (expr clr, sp) =
colorthatch (clr) (sp, 45) colorthatch (clr) (sp, -45)
enddef;
+vardef axialgradient (suffix clr) (expr sp, theta) expr f =
+ convertpath (g) f;
+ if not cycle g: NoCycle("axialgradient") g;
+ else:
+ newpicture (_grd);
+ setbbox (ll, ur) g rotated -theta;
+ axialgradientf (clr, _grd) (theta, sp, ll, ur);
+ DoClip (_grd); clipto (_grd) (g);
+ _orto (active_plane, _grd);
+ fi
+ f
+enddef;
+
+vardef areagradient (suffix clr) (expr sp, tp) expr f =
+ convertpath (g) f;
+ if not cycle g: NoCycle("areagradient") g;
+ else:
+ newpicture (_agr);
+ setbbox (ll, ur) g;
+ areagradientf (clr, _agr) (sp, tp, ll, ur);
+ DoClip (_agr); clipto (_agr) (g);
+ _orto (active_plane, _agr);
+ fi
+ f
+enddef;
+
+vardef radialgradient (suffix clr) (expr sp, ctr) expr f =
+ convertpath (g) f;
+ if not cycle g: NoCycle("radialgradient") g;
+ else:
+ setpair (_ctr) zconv (ctr);
+ newpicture (_agr);
+ save _rad;
+ getradius (_rad) g shifted - _ctr;
+ radialgradientf (clr, _agr) (sp, _ctr, _rad);
+ DoClip (_agr); clipto (_agr) (g);
+ _orto (active_plane, _agr);
+ fi
+ f
+enddef;
+
vardef NoTile (suffix atile) expr g =
GBwarn str atile & " is not a valid tile for tess()."
& " The path will be drawn instead.";
@@ -1584,8 +1726,8 @@ vardef makelengtharray (suffix clen) suffix p =
numeric clen[];
clen := _s * length p; clen0 := 0;
for _i = 1 upto clen:
- clen[_i] := clen[_i-1] + abs (pnt[_i/_s] (p) - pnt[(_i-1)/_s] (p)) /
- _rescale_factor;
+ clen[_i] := clen[_i-1] + abs (pnt[_i/_s] (p) - pnt[(_i-1)/_s] (p))
+ / _rescale_factor;
endfor
clen[clen]
enddef;
@@ -2165,6 +2307,25 @@ vardef brownianpath (expr start, num, sc) =
endfor
mkpoly (false, _brp)
enddef;
+vardef randomwalk (expr start, num, dst) =
+ setnumeric (_rdw) 1;
+ setpair (_tmp) start;
+ pair _rdw[]; _rdw1 := _tmp;
+ for _idx := 1 upto num:
+ _tmp := _tmp + dst*dir(uniformdeviate(360));
+ _rdw[incr _rdw] := _tmp;
+ endfor
+ mkpoly (false, _rdw)
+enddef;
+vardef browniangraph (expr num, scst) =
+ setnumeric (_brg) 1;
+ pair _tmp, _brg[]; _tmp := _brg1 := (0,0);
+ for _idx := 1 upto num:
+ _tmp := _tmp + scst*(1,normaldeviate);
+ _brg[incr _brg] := _tmp;
+ endfor
+ mkpoly (false, _brg)
+enddef;
vardef mksmooth (expr tens, cyclic) (suffix pts) =
if pts = 1: onepointpath (cyclic, pts1)
@@ -2201,8 +2362,8 @@ vardef mkconvex (expr tens, cyclic) (suffix pts) =
_B[_j] := sqrt(abs((pts[_j]-pts[_j-1])xprod(pts[_j+1]-pts[_j])));
endfor
if cyclic:
- _B1 := sqrt(abs((pts1 - pts[pts])xprod(pts2 - pts1)));
- _B[pts] := sqrt(abs((pts[pts]-pts[pts-1])xprod(pts1 - pts[pts])));
+ _B1 := sqrt(abs((pts1 - pts[pts])xprod(pts2 - pts1)));
+ _B[pts] := sqrt(abs((pts[pts]-pts[pts-1])xprod(pts1 - pts[pts])));
else:
_B1 := _B2;
_B[pts] := _B[pts-1];
@@ -2246,12 +2407,16 @@ enddef;
numeric default_tension; default_tension := 1;
def curve = tcurve (default_tension) enddef;
vardef tcurve (expr tens, cyclic) (text t) =
- setpairs (_tc) (t); mksmooth (tens, cyclic, _tc)
+ setpairs (_tc) (t);
+ if _tc=0: NoPoints("curve", _tc); fi
+ mksmooth (tens, cyclic, _tc)
enddef;
def ccurve = tccurve (default_tension) enddef;
vardef tccurve (expr tens, cyclic) (text t) =
- setuniquepairs (_tcc) (t); mkconvex (tens, cyclic, _tcc)
+ setuniquepairs (_tcc) (t);
+ if _tcc=0: NoPoints("ccurve", _tcc); fi
+ mkconvex (tens, cyclic, _tcc)
enddef;
vardef mkbezier (expr tens, cyclic) (suffix pts) =
@@ -2273,8 +2438,8 @@ vardef mkqbezier (expr cyclic) (suffix pts) =
if pts=1: {0,0}
else:
for _i = 2 step 2 until pts - 1:
- ..controls 1/3[pts[_i], pts[_i-1] ] and 1/3[pts[_i], pts[_i+1] ]..
- pts[_i+1]
+ ..controls 1/3[pts[_i], pts[_i-1]]
+ and 1/3[pts[_i], pts[_i+1]].. pts[_i+1]
endfor
if cyclic:
..controls 1/3[ pts[pts], pts[pts - 1] ]
@@ -2353,6 +2518,7 @@ def tfcncurve = functioncurve enddef;
vardef functioncurve (expr ftens) (text t) =
settension (_ftens) ftens; if _ftens < 1/3: _ftens := 1/3; fi
setuniquepairs (_fc) (t);
+ if _fc=0: NoPoints ("functioncurve", _fc); fi
if _fc > 1: _fc0 := _fc1; _fc[_fc+1] := _fc[_fc]; fi
mkfcnpath (_ftens) (_fc)
enddef;
@@ -2524,7 +2690,7 @@ enddef;
def arccps = arc enddef;
vardef arcpps (expr begpt, endpt, sweep) =
- if begpt = endpt: begpt--endpt
+ if (begpt = endpt) or (sweep = 0): begpt--endpt
else:
setpair (cd) unitvector (endpt-begpt);
if abs(sweep) <= 45:
@@ -2613,20 +2779,42 @@ vardef circlepps (expr one, two, sweep) =
enddef;
vardef circlepp (expr small, one, two, rad) =
- arcpp (small, one, two, rad) & arcpp (not small, two, one, rad) & cycle
+ arcpp (small, one, two, rad) & arcpp (not small, two, one, rad)
+ & cycle
enddef;
def circleppr (expr one, two, rad, small) =
circleppr (one, two, rad, small)
enddef;
+vardef quarterellipse(expr A,B,C) =
+ save T_;
+ transform T_;
+ (1,0) transformed T_ = A;
+ (1,1) transformed T_ = B;
+ (0,1) transformed T_ = C;
+ quartercircle scaled 2 transformed T_
+enddef;
+
+vardef halfellipse (expr A,B,C) =
+ save P_; pair P_;
+ P_ = (C - A)/2;
+ quarterellipse (A, B - P_, B) & quarterellipse (B, B + P_, C)
+enddef;
+
+vardef fullellipse (expr C, A, B) =
+ save P_; pair P_;
+ P_ := 2[A,C];
+ halfellipse (A,B,P_) & halfellipse (P_,2[B,C],A) & cycle
+enddef;
+
vardef pathcenter expr p =
save a, cntr, n; pair cntr, a[];
n := length p;
a1 = pnt 0 (p);
a3 = pnt [n/2] (p);
if cycle p:
- a2 = pnt [n/4] (p);
+ a2 = pnt [ n/4] (p);
a4 = pnt [3n/4] (p);
else:
a2 := a3;
@@ -2680,40 +2868,90 @@ vardef pshcircle (expr disk, ctr, rad) =
elseif abs(ctr) >= 1 :
if abs(ctr) > 1:
GBerrmsg ("Impossible center of pseudohyperbolic circle.")
- "The center of a pseudohyperbolic circle must be in "
+ "The center of this pseudohyperbolic circle must be in "
& "the unit disk.";
fi
onepointpath (true,ctr)
else:
- % compute Euclidean center and radius (and a denominator used twice
- % in calculations).
save _r, _dnm;
_r := abs(ctr);
_dnm := 1 - _r*_r*rad*rad;
- circle ( (1 - rad*rad)/_dnm*ctr, rad*(1 - _r*_r)/_dnm)
+ circle ((1 - rad*rad)/_dnm*ctr, rad*(1 - _r*_r)/_dnm)
fi
else:
if rad >= 1 :
- GBerrmsg ("Impossible pseudohyperbolic circle.")
+ GBerrmsg ("Impossible radius of pseudohyperbolic circle.")
"The radius of a pseudohyperbolic circle must be less than 1.";
onepointpath (true,ctr)
elseif ypart ctr <= 0:
if ypart ctr < 0:
- GBerrmsg ("Impossible pseudohyperbolic circle.")
- "The center of a pseudohyperbolic circle must be in "
+ GBerrmsg ("Impossible center of pseudohyperbolic circle.")
+ "The center of this pseudohyperbolic circle must be in "
& "the upper half-plane.";
fi
onepointpath (true,ctr)
else:
- % compute Euclidean center and radius (and a denominator used twice
- % in calculations).
- % Euclidean center at xpart ctr + (1 + R^2)/(1 - R^2)*ypart ctr
- % Euclidean radius 4R/(1 - R^2)*ypart ctr
save _y, _dnm;
_y := ypart ctr;
_dnm := 1 - rad*rad;
- circle ( (xpart ctr, (1 + rad*rad)/_dnm * _y), 2rad/_dnm*_y)
+ circle ((xpart ctr, (1 + rad*rad)/_dnm * _y), 2rad/_dnm*_y)
+ fi
+ fi
+enddef;
+
+vardef UHPgeodesic (expr A, B) =
+ if xpart A = xpart B:
+ A--B
+ else:
+ save ang_, C_; pair C_;
+ if abs(ypart A) < abs(ypart B):
+ C_ := conj B;
+ else:
+ C_ := conj A;
+ fi
+ if ypart C_ = 0: % both on x-axis
+ ang_ := anglefromto(up, B - A);
+ else:
+ ang_ := anglefromto(A - C_, B - C_);
+ fi
+ arcpps(A, B, 2ang_)
+ fi
+enddef;
+
+vardef UDgeodesic (expr A, B) =
+ save a_, b_;
+ a_ := abs(A); b_ = abs(B);
+ if (a_ = 0) or (b_ = 0):
+ A--B
+ elseif angle A = angle B:
+ A--B
+ else: % note: A, B and B-A are all nonzero from this point
+ save ang_;
+ if a_ = 1:
+ ang_ := anglefromto (if b_>1: A else: -A fi, B-A)
+ elseif b_ = 1:
+ ang_ := anglefromto (A-B, if a_>1: B else: -B fi)
+ else:
+ save C_; pair C_;
+ % reflecting A
+ if a_ < eps:
+ C_ := unitvector A;
+ ang_1 := anglefromto(a_*A - C_, a_*B - C_);
+ else:
+ C_ := (1/a_)*unitvector A;
+ ang_1 := anglefromto(A - C_, B - C_);
+ fi
+ % reflecting B
+ if b_ < eps:
+ C_ := unitvector B;
+ ang_2 := anglefromto(b_*A - C_, b_*B - C_);
+ else:
+ C_ := (1/b_)*unitvector B;
+ ang_2 := anglefromto(A - C_, B - C_);
+ fi
+ ang_ := if abs(ang_1) < abs(ang_2): ang_1 else: ang_2 fi;
fi
+ arcpps(A, B, 2ang_)
fi
enddef;
@@ -2726,6 +2964,26 @@ vardef sector (expr center, rad, frtheta, totheta) =
center -- arcalt (center, rad, frtheta, totheta) -- cycle
enddef;
+vardef mkbrace (expr S, C, E) =
+ save R_, U_, V_, Z_;
+ pair U_, V_, Z_[];
+ U_ := unitvector (E-S);
+ V_ := U_ rotated 90;
+
+ R_ := 0.5*(C-S) dotprod V_;
+ if R_ = 0:
+ S--C
+ else:
+ if R_ < 0 : V_ := -V_; R_ := -R_; fi
+ V_ := R_*V_; U_ := R_*U_;
+ Z_1 := S + V_ + U_;
+ Z_2 := C - V_ - U_;
+ Z_3 := C - V_ + U_;
+ Z_4 := E + V_ - U_;
+ S{V_}..{U_}Z_1--Z_2{U_}..{V_}C{-V_}..{U_}Z_3--Z_4{U_}..{-V_}E
+ fi
+enddef;
+
vardef mkfcn (expr sm, tens) (expr bmin, bmax, bst) (text pf) =
save _p; pair _p[]; _p := 0;
save _dx, _n, _r; numeric _dx, _n, _r;
@@ -2798,7 +3056,7 @@ tolerancefactor := .02;
vardef mklevelset (expr sm, tens, X, Y, t, a, b, c, d) =
save _inside_;
vardef _inside_ (expr U, V) =
- inside_levelset (U, V) and between (a, b) (U) and between (c, d) (V)
+ inside_levelset(U, V) and between(a, b)(U) and between(c, d)(V)
enddef;
if not _inside_ (X, Y):
GBwarn "Invalid seed point for levelset.";
@@ -2866,16 +3124,16 @@ vardef tRKIV (expr sm, tens, zstart, ds, N) (text _RHS_) =
for _idx := 2 upto _trj:
_dt := ds/emax(1,abs(_RHS_(_tt,_ztr)));
_th := _tt + .5_dt;
- _dz1 := _dt*_RHS_(_tt, _ztr); % displacement based on current point
+ _dz1 := _dt*_RHS_(_tt, _ztr); % displacement for current point
_ztmp := _ztr + .5_dz1; % 1st midpoint
% use _th instead of twice calculating (_tt + .5_dt)
- _dz2 := _dt*_RHS_(_th, _ztmp); % displacement based on 1st midpoint
+ _dz2 := _dt*_RHS_(_th, _ztmp); % displacement for 1st midpoint
_ztmp := _ztr + .5_dz2; % 2nd midpoint
- _dz3 := _dt*_RHS_(_th, _ztmp); % displacement based on 2nd midpoint
+ _dz3 := _dt*_RHS_(_th, _ztmp); % displacement for 2nd midpoint
_ztmp := _ztr + _dz3; % temporary end point
- % get time for next loop now since we need it right away in next line:
+ % get time for next loop now since we need it in the next line:
_tt := _tt + _dt;
- _dz4 := _dt*_RHS_(_tt, _ztmp); % displacement based on end point
+ _dz4 := _dt*_RHS_(_tt, _ztmp); % displacement for end point
% get next point
_ztr := _ztr + (_dz1 + 2_dz2 + 2_dz3 + _dz4)/6;
_trj[_idx] := _ztr;
@@ -3128,7 +3386,8 @@ vardef colorGheadpath
f
enddef;
-path cut_path; cut_path := (.5,0)--(.5,.71)--(-.5,.71)--(-.5,0)--cycle;
+path cut_path;
+cut_path := (.5,0)--(.5,.71)--(-.5,.71)--(-.5,0)--cycle;
def tailpath (suffix sh) = colortailpath (sh) (headcolor) enddef;
vardef colortailpath (suffix sh) (expr clr, sc, rot, pos) expr f =
@@ -3246,6 +3505,85 @@ vardef randomlines (expr maxshift) expr f =
fi
enddef;
+vardef interpolatedpath (expr t, P) expr Q =
+ if not path Q:
+ GBerrmsg ("Improper argument to interpolatedpath.")
+ "The last argument to interpolatedpath must be a path.";
+ if pair P: onepointpath(false, P)
+ else:
+ if path P:
+ P
+ else:
+ onepointpath (false, origin)
+ fi
+ fi
+ elseif pair P:
+ interpolated_pair_path (t, cycle Q, P, Q)
+ elseif not path P:
+ GBerrmsg ("Improper argument to interpolatedpath.")
+ "The second argument to interpolatedpath must be a pair "
+ & "or a path.";
+ Q
+ else:
+ if t=0: Q
+ elseif t=1: P
+ else:
+ save P_, Q_; path P_, Q_;
+ P_ := detrivialized P;
+ Q_ := detrivialized Q;
+ if length P_ = 0:
+ interpolated_pair_path (t, cycle Q, pnt0(P_), Q)
+ elseif length Q_ = 0:
+ interpolated_pair_path (t, cycle Q, pnt0(Q_), P)
+ else:
+ save G, H, n, m, k, r;
+ path G[], H[];
+ G := H := 0;
+ n := length P_; m := length Q_;
+ k := gcd(n, m);
+ r := m/k;
+ for I=0 upto n-1:
+ for J=0 upto r-1:
+ G[incr G] := subpath (I+J/r, I+(J+1)/r) of P_;
+ endfor
+ endfor
+ r := n/k;
+ for I=0 upto m-1:
+ for J=0 upto r-1:
+ H[incr H] := subpath (I+J/r, I+(J+1)/r) of Q_;
+ endfor
+ endfor
+ for N = 1 upto G-1:
+ force_equal_ends(G[N], G[N+1]);
+ force_equal_ends(H[N], H[N+1]);
+ endfor
+ interpolated_segment (t, G1, H1)
+ for N = 2 upto G: & interpolated_segment (t, G[N], H[N])
+ endfor if (pnt0(G1)=pnt1(G[G])) and (cycle Q): & cycle fi
+ fi
+ fi
+ fi
+enddef;
+
+vardef interpolated_pair_path (expr t, cyclic, P, Q) =
+ save N; N := length Q;
+ if N=0: onepointpath (cyclic, (t)[pnt0(Q),P])
+ else:
+ (t)[pnt0(Q),P]..controls (t)[post0(Q),P] and
+ for n=1 upto N - 1:
+ (t)[pre[n](Q),P]..(t)[pnt[n](Q),P]..controls (t)[post[n](Q),P]
+ and
+ endfor
+ (t)[pre[N](Q),P].. if cyclic: cycle else: (t)[pnt[N](Q),P] fi
+ fi
+enddef;
+
+vardef interpolated_segment (expr t, S, T) =
+ (t)[ pnt0(S), pnt0(T)]..controls
+ (t)[ post0(S), post0(T)] and (t)[ pre1(S), pre1(T)]..
+ (t)[ pnt1(S), pnt1(T)]
+enddef;
+
vardef parasegment (expr d, segs, f) =
if d = 0: f
else:
@@ -3268,7 +3606,7 @@ vardef parapath (expr d) expr f =
path g[], h, p[], q[];
numeric a, s, t;
pair u, v, w, w[];
- s := emax (3, emin (segment_split, ceiling (max_points/5/length f)));
+ s := emax(3, emin(segment_split, ceiling(max_points/5/length f)));
p := 0;
for i = 1 upto length f:
h := subpath (i-1, i) of f;
@@ -3438,8 +3776,8 @@ Plus.clear := (right--(1,1)--(-1,1)--(left)--cycle) scaled .65;
Cross := ((0,0)--(dir 45)--(dir -135)--(0,0)--(dir -45)--(dir 135))
scaled .65;
-Cross.clear := ((0,0)--(dir -45)--dir(45)--(dir 135)--(dir -135)--cycle)
- scaled .65;
+Cross.clear :=
+ ((0,0)--(dir -45)--dir(45)--(dir 135)--(dir -135)--cycle) scaled .65;
Asterisk := ((0,0)--up--down--(0,0)--(dir 30)--(dir -150)
--(0,0)--(dir -30)--(dir 150)) scaled .6;
@@ -3475,7 +3813,8 @@ save _A; pair _A[];
SolidStar := mkstar (5, 2, _A) scaled .84;
Star := undo_cycle SolidStar;
Star.clear := polyline (true)
- (_A9, _A10, _A1, _A2, _A3, (xpart _A3, 1), (xpart _A9, 1)) scaled .84;
+ (_A9, _A10, _A1, _A2, _A3, (xpart _A3, 1), (xpart _A9, 1))
+ scaled .84;
SolidStar.clear := Star.clear;
forsuffixes S =
@@ -3638,7 +3977,8 @@ def barchart (expr firstbar, sep, r, vert)(text data) =
path chartbar[];
chartbar := 0; barwd := r*sep;
for _itm = data:
- barend[incr chartbar] := if pair _itm: ypart _itm else: _itm fi;
+ barend[incr chartbar]
+ := if pair _itm: ypart _itm else: _itm fi;
barbegin[chartbar] := if pair _itm: xpart _itm else: 0 fi;
endfor
barbegin := barend := barlength := barstart := chartbar;
diff --git a/Master/texmf-dist/source/generic/mfpic/grafbase.dtx b/Master/texmf-dist/source/generic/mfpic/grafbase.dtx
index a309f242f6e..8b7346720dd 100644
--- a/Master/texmf-dist/source/generic/mfpic/grafbase.dtx
+++ b/Master/texmf-dist/source/generic/mfpic/grafbase.dtx
@@ -1,17 +1,17 @@
% \iffalse
% File: grafbase.dtx
-% A part of mfpic 1.06 2011/03/08
+% A part of mfpic 1.10 2012/12/03
%
% -------------------------------------------------------------------
%
-% Copyright 2002--2011, Daniel H. Luecking
+% Copyright 2002--2012, Daniel H. Luecking
%
% Mfpic may be distributed and/or modified under the conditions of the
% LaTeX Project Public License, either version 1.3b of this license or (at
% your option) any later version. The latest version of this license is in
% <http://www.latex-project.org/lppl.txt>
-% and version 1.3b or later is part of all distributions of LaTeX version
-% 2003/12/01 or later.
+% and version 1.3c or later is part of all distributions of LaTeX version
+% 2008/12/01 or later.
%
% Mfpic has maintenance status "author-maintained". The Current Maintainer
% is Daniel H. Luecking. There are several Base Interpreters: plain TeX, LaTeX,
@@ -19,7 +19,7 @@
%
%<*driver>
\ProvidesFile{grafbase.dtx}
- [2011/03/08 v1.06. Metafont/post macros to interface with mfpic.]%
+ [2012/12/03 v1.10. Metafont/post macros to interface with mfpic.]%
\documentclass{ltxdoc}
\usepackage{docmfp}
@@ -51,6 +51,7 @@
\renewcommand\|{${}\mathrel{|}{}$}
\makeatletter
+\let\HD@SetMacroIndent\@gobble
\newcommand\bsl{{\mytt\@backslashchar}}
% Stupid lists!
\def\@listi{\leftmargin\leftmargini
@@ -113,7 +114,7 @@
%</driver>
%\fi
%
-% \CheckSum{1473}
+% \CheckSum{1631}
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -146,14 +147,17 @@
% This file documents the \grafbase{} source code. The user manual for
% \mfpic{} is distributed as \file{mfpic-doc.pdf}, produced from
% \file{mfpic-doc.tex}. An introductory guide to \mfpic{} is available
-% in \file{mfpguide.pdf}, produced from \file{mfpguide.pdf}
+% in \file{mfpguide.pdf}, produced from \file{mfpguide.tex}
% \end{abstract}
%
% \StopEventually{\PrintIndex}
% \tableofcontents
%
+%
+%
% \section{Introduction}\label{intro}
%
+%
% \subsection{Identification and checks}\label{checks}
%
% \DescribeVariable{grafbaseversion} We use \mfc{grafbaseversion} to
@@ -187,13 +191,14 @@ fi
boolean grafbase; grafbase := true;
string fileversion, filedate;
-fileversion := "1.06"; filedate := "2011/02/25";
+fileversion := "1.10"; filedate := "2012/12/03";
message " Loading grafbase macros, version " & fileversion & ", " &
filedate & ".";
message " ";
-def GBmsg expr s = message "Grafbase (" & jobname & "): " & s; enddef;
+def GBmsg expr s = message "Grafbase (" & jobname & "): " & s;
+enddef;
def GBwarn expr s = GBmsg "Warning, " & s; enddef;
def GBerrmsg (expr s) expr t = errhelp t;
errmessage "Grafbase (" & jobname & "): " & s; errhelp "";
@@ -236,7 +241,7 @@ def checkversions (expr g)=
fi
enddef;
-checkversions (106);
+checkversions (110);
% \end{macrocode}
%
@@ -298,29 +303,30 @@ enddef;
% In \MF{} `\mfc{color X}' is an identifier (presumably unknown) with the
% base name \mfc{color} and suffix \mfc{X}.
% \begin{macrocode}
-boolean METAPOST;
-METAPOST := known color Geamparalele din Babadag;
+boolean METAFONT, METAPOST;
+METAPOST := known color Carl Philipp Emanuel Bach;
+if METAPOST: METAFONT := false; else: METAFONT := true; fi
%<*MF>
if METAPOST:
GBerrmsg ("wrong compiler.")
- "This file is for Metafont. For Metapost use grafbase.mp.";
+ "This file is for Metafont. For Metapost, use grafbase.mp.";
fi
%</MF>
%<*MP>
-if not METAPOST:
+if METAFONT:
GBerrmsg ("wrong compiler.")
- "This file is for Metapost. For Metafont use grafbase.mf.";
+ "This file is for Metapost. For Metafont, use grafbase.mf.";
fi
% \end{macrocode}
%
% \MP{} now exists in a couple of slightly incompatible versions.
-% Versions 1.000 and later (beta versions 0.900 also) have native support for
-% \texttt{CMYK} colors with a \mfc{cmykcolor} data type. It also
-% supports grayscale colors (i.e., \mfc{withcolor} will accept a numeric
-% expression), and has the alias \mfc{rgbcolor} for \mfc{color}.
+% Versions 1.000 and later (beta versions 0.9xx also) have native support for
+% \texttt{CMYK} colors with a \mfc{cmykcolor} data type. They also
+% support grayscale colors (i.e., \mfc{withcolor} will accept a numeric
+% expression), and have the alias \mfc{rgbcolor} for \mfc{color}.
% It also has a means to set the name of the output file: the
% \mfc{filenametemplate} command. In versions 1.2 and later, this is
% deprecated in favor of setting the internal string variable
@@ -351,6 +357,7 @@ fi
%</MP>
% \end{macrocode}
%
+%
% \subsection{Setting up the font, \MF{} only}\label{font}
%
% Font-related housekeeping is only for \MF{}. \MF{} only produces
@@ -360,9 +367,10 @@ fi
% \DescribeVariable{GBgeneric}
% We intercept the \mfc{mode} variable before \mfc{mode_setup} can set
% \mfc{proof} mode. We used to set \mfc{mode := cx} (and later
-% \mfc{ljfour}) if it was unknown. For a while we just issued an error
-% message. In this version we define a 600dpi mode called \mfc{GBgeneric}
-% as a fallback (neither \gbc{mode} nor \gbc{localfont} known).
+% \mfc{ljfour}) if \mfc{mode} was unknown. For a while we just issued an
+% error message. In this version we define a 600dpi mode called
+% \mfc{GBgeneric} as a fallback (neither \gbc{mode} nor \gbc{localfont}
+% known).
%
% The font identifier and coding scheme are just for information and end
% up as comments in the \file{.tfm} file (in all capitals). The design
@@ -430,6 +438,7 @@ interim warningcheck := 0;
% \end{macrocode}
%
+%
% \subsection{Initializations}\label{init}
%
% \VariableIndex{unitlen}
@@ -460,15 +469,17 @@ yneg := 0; ypos := 10;
% We support both degrees and radians for angles. In \MF, one degree is
% the unit of angle.
% \DescribeVariable{radian}
-% One radian is $180/\pi$ degrees. We also define \gbc{pi} so a user can say
-% \gbc{90} or \gbc{90deg} or \gbc{pi/2*radian}
+% One radian is $180/\pi$ degrees. We also define \gbc{pi} so a user can
+% say \gbc{pi/2*radian} for almost the same effect as \gbc{90deg}.
% \DescribeVariable{pi}
-% for the same effect. Actually, not quite: because of \MF{}'s precision
-% limits, the latter is about 90.00025 degrees. \MF{}'s precision is 16
-% binary places, or slightly under 5 decimals. The accuracy of \gbc{pi}
-% and \gbc{radian} is the maximum possible. If we \emph{define}
-% \gbc{radian} to be \gbc{90/(pi/2)} or \gbc{180/pi} the value of
-% \gbc{pi/2*radian} is even less accurate.
+% But not quite: because of \MF{}'s precision limits, the former is about
+% 90.00025 degrees. \MF{}'s precision is 16 binary places, or slightly
+% under 5 decimals. The accuracy of \gbc{pi} and \gbc{radian} below is the
+% maximum possible. If we \emph{define} \gbc{radian} by its mathematical
+% definition \gbc{radian:=180/pi}, then \gbc{radian} and formulas
+% containing it are even less accurate. (Coincidentally, defining
+% \gbc{radian} as below, and then \gbc{pi := 180/radian} produces exactly
+% the same value for \gbc{pi} as below.)
% \begin{macrocode}
newinternal deg, pi, radian;
deg := 1; pi := 3.14159;
@@ -500,7 +511,7 @@ numeric degree; degree := deg;
%
% \VariableIndex{hatchwd}
% The default \gbc{hatchwd} used to be larger, but it seemed ugly to me.
-% (Backward compatibility? What's that?).
+% (Backward compatibility---what's that?).
% \begin{macrocode}
newinternal penwd; penwd := 0.5pt;
pen drawpen;
@@ -572,6 +583,7 @@ boolean showbbox; showbbox := false;
% \end{macrocode}
%
+%
% \subsubsection{Colors}\label{colors}
%
% Of course colors are only recognized by \MP. The colors \mfc{black},
@@ -595,7 +607,7 @@ let cmykcolor = numeric;
black := 0; white := 1;
def withcolor text t = enddef;
%</MF>
-%<MP>if not has_cmyk: let rgbcolor = color; let cmykcolor = color; fi
+%<MP>if not has_cmyk: let rgbcolor = color; let cmykcolor = color; fi
def _wc_ = withcolor enddef;
% \end{macrocode}
@@ -653,32 +665,61 @@ enddef;
% two. In \MF{} \gbc{white} is a numeric and \gbc{cmyk} returns a
% numeric, so these can be used with \MF{}, and both produce the same
% result.
-%
-% \DescribeRoutine{grayscalegray}
-% The grayscale version should return a numeric in recent \MP{}, so
-% it needs a different definition for early \MP{}. Thus, it occurs
-% in the conditional code. Oddly, its definition is the same for \MF{}
-% and recent \MP{}.
% \begin{macrocode}
vardef rgbgray (expr g) = (snapto g) * white enddef;
vardef cmykgray (expr g) = cmyk(0,0,0,1 - snapto g) enddef;
% \end{macrocode}
%
+%
+% \DescribeRoutine{colorchoice}
+% The \gbc{colorchoice} function (like \cs{mathchoice} in \TeX{}, after
+% which it was named) returns one of four bits of code: \gbc{D} (default)
+% if the first argument is unknown or not one of the recognized color
+% models, \gbc{N} if it is numeric, \gbc{R} if it is \mfc{rgbcolor}, and
+% \gbc{C} if it is \mfc{cmykcolor}. These arguments have to be \mfc{text}:
+% if they were `\mfc{expr}' \MP{} would try to evaluate them, with
+% possible errors since some of them apply functions that are not relevant
+% to the other types.
+%
+% Since this is mostly used to return values inside vardef's, it is
+% important this not be followed by a semicolon. If it is used in
+% another context, semicolons would normally be part of the arguments.
+% \begin{macrocode}
+%<*MP>
+def colorchoice (expr clr) (text D)(text N)(text R)(text C) =
+ if unknown clr: D
+ elseif numeric clr: N
+ elseif rgbcolor clr: R
+ elseif cmykcolor clr: C
+ else: D
+ fi
+enddef;
+
+% \end{macrocode}
% In recent \MP{}, all the color functions are essentially no-ops. In
% early \MP{}, they all return an \opt{rgb} color expression. In \MF{}
% they all return a numeric. It is easiest if we simply separate the three
-% cases and write the code for each, rather than load all the functions
-% with three-way booleans (often containing nested booleans).
+% cases (MF, old MP and recent MP) and write the code for each, rather
+% than load all the functions with three-way booleans (often containing
+% nested booleans).
%
+% \DescribeRoutine{gray}
+% \DescribeRoutine{cmyk}
% For all three engines we require a definition of the color functions
% \gbc{gray(g)}, \gbc{rgb(r,g,b)}, and \gbc{cmyk(c,m,y,k)}, as well as
-% conversion functions \gbc{makegray(x)}, \gbc{makergb(x)}, and
-% \gbc{makecmyk(x)}, and the boolean \gbc{iscolor clr}. The first three
-% have to return numerics for \MF{}, colors for early \MP{}, and the
-% associated color type for recent \MP{}.
+% conversion functions (see below), and the boolean function
+% \gbc{iscolor}. The first three have to return numerics for \MF{},
+% colors for early \MP{}, and the associated color type for recent \MP{}.
+% We delay the definition of \gbc{rgb} because it only requires
+% distinguishing \MF{} from \MP.
+%
+% \DescribeRoutine{grayscalegray}
+% The grayscale version should return a numeric in recent \MP{}, so
+% it needs a different definition for early \MP{}. Thus, it occurs
+% in the conditional code. Oddly, its definition is the same for \MF{}
+% and recent \MP{}.
% \begin{macrocode}
-%<*MP>
if has_cmyk :
vardef grayscalegray (expr g) = snapto g enddef;
vardef gray (expr g) = grayscalegray (g) enddef;
@@ -688,34 +729,13 @@ if has_cmyk :
% \end{macrocode}
%
-% \DescribeRoutine{colorchoice}
-% The \gbc{colorchoice} function (like \cs{mathchoice} in \TeX{}, after
-% which it was named) returns one of four bits of code: \gbc{D} (default)
-% if the first argument is unknown or not one of the recognized color
-% models, \gbc{N} if it is numeric, \gbc{R} if it is \mfc{rgbcolor}, and
-% \gbc{C} if it is \mfc{cmykcolor}. These arguments have to be \mfc{text}:
-% if they were `\mfc{expr}' \MP{} would try to evaluate them, with
-% possible errors since some of them apply functions that are not relevant
-% to the other types.
-% \begin{macrocode}
- def colorchoice (expr clr) (text D)(text N)(text R)(text C) =
- if unknown clr: D
- elseif numeric clr: N
- elseif rgbcolor clr: R
- elseif cmykcolor clr: C
- else: D
- fi
- enddef;
-
-% \end{macrocode}
-%
% \DescribeRoutine{makecmyk}
% \DescribeRoutine{makergb}
% \DescribeRoutine{makegray}
% In \gbc{makecmyk} and all the other `\gbc{make}' conversions, the
% default is to return black in the appropriate model, numerics produce
-% gray, and cmyk or rgb is either retained unchanged or converted to the
-% appropriate model.
+% gray in the appropriate model, and cmyk or rgb is either retained
+% unchanged or converted to the appropriate model.
%
% \DescribeRoutine{iscolor}
% A variable is taken to be a color if it can validly follow
@@ -729,14 +749,14 @@ if has_cmyk :
enddef;
vardef makergb primary clr =
colorchoice (clr)(rgbblack)(rgbgray(clr))(clr)
- (cmyktorgb(cyanpart clr, magentapart clr, yellowpart clr,
- blackpart clr))
+ (cmyktorgb(cyanpart clr, magentapart clr,
+ yellowpart clr, blackpart clr))
enddef;
vardef makegray primary clr =
colorchoice (clr)(grayscaleblack)(grayscalegray(clr))
(rgbtogray (redpart clr, greenpart clr, bluepart clr))
- (cmyktogray(cyanpart clr, magentapart clr, yellowpart clr,
- blackpart clr))
+ (cmyktogray(cyanpart clr, magentapart clr,
+ yellowpart clr, blackpart clr))
enddef;
vardef iscolor expr clr =
(rgbcolor clr) or (cmykcolor clr) or (numeric clr) or (boolean clr)
@@ -744,10 +764,13 @@ if has_cmyk :
else:
% \end{macrocode}
%
-% \DescribeRoutine{colorchoice}
-% In early \MP{} \gbc{colorchoice} is a three-way choice, since
-% \mfc{cmykcolor} is not an available data type, but numeric can still be
-% interpreted as a gray.
+% In early \MP{} \gbc{colorchoice} is only a three-way choice, since
+% \mfc{cmykcolor} is not a data type, but numeric can still be
+% interpreted as a gray. For a numeric or an actual rgbcolor, the first or
+% second branch would be taken. If \gbc{clr} is neither of those then
+% \mfc{cmykcolor}, being equal to \mfc{rgbcolor}, would also be false.
+% Therefore, in the context of early \MP{}, it is irrelevant what goes in
+% the last argument, so we leave it empty.
%
% \DescribeRoutine{makecmyk}
% \DescribeRoutine{makergb}
@@ -762,19 +785,12 @@ else:
vardef gray (expr g) = rgbgray(g) enddef;
vardef grayscalegray (expr g) = rgbgray(g) enddef;
vardef cmyk (expr c, m, y, k) = rgb (1-c-k, 1-m-k, 1-y-k) enddef;
- def colorchoice (expr clr) (text D)(text N)(text R) =
- if unknown clr: D
- elseif numeric clr: N
- elseif rgbcolor clr: R
- else: D
- fi
- enddef;
vardef makergb primary clr =
- colorchoice (clr)(rgbblack)(rgbgray(clr))(clr)
+ colorchoice (clr)(rgbblack)(rgbgray(clr))(clr)()
enddef;
vardef makegray primary clr =
colorchoice (clr)(rgbblack)(rgbgray(clr))
- (rgbtogray (redpart clr, greenpart clr, bluepart clr))
+ (rgbtogray (redpart clr, greenpart clr, bluepart clr))()
enddef;
def makecmyk = makergb enddef;
vardef iscolor expr clr = (color clr) enddef;
@@ -783,7 +799,7 @@ fi
%</MP>
% \end{macrocode}
%
-% \DescribeMacro{knowncolor}
+% \DescribeRoutine{knowncolor}
% Once we have \gbc{iscolor} all we need to do is add a test for
% \mfc{known} to get this boolean test.
% \begin{macrocode}
@@ -808,7 +824,7 @@ vardef iscolor expr clr = (color clr) enddef;
%</MF>
% \end{macrocode}
%
-% \DescribeRoutine{forcecolor}
+% \DescribeRoutine{forceclr}
% \DescribeRoutine{named}
% This is only used in the \gbc{named} function to force a color. In
% \MF{} the tests are all `\mfc{if numeric}'. In early \MP{} `\mfc{if
@@ -870,6 +886,7 @@ enddef;
% \end{macrocode}
%
+%
% \subsection{Arrays}\label{arrays}
%
% \gbc{ClipPath} is a typical example of an array. Arrays are based on the
@@ -999,6 +1016,7 @@ enddef;
% \end{macrocode}
%
+%
% \subsection{Utilities}\label{utilities}
%
% \DescribeRoutine{chpair}
@@ -1025,13 +1043,14 @@ vardef chpair (text proc) (expr p) =
(proc (xpart p), proc (ypart p))
enddef;
-vardef floorpair (expr p) = (floor (xpart p), floor (ypart p)) enddef;
-vardef ceilingpair (expr p) =
- (ceiling (xpart p), ceiling (ypart p))
+vardef floorpair (expr p) = (floor (xpart p), floor (ypart p))
+enddef;
+vardef ceilingpair (expr p) = (ceiling (xpart p), ceiling (ypart p))
enddef;
%<*MF>
-def hroundpair (expr p) = (hround (xpart p), hround (ypart p)) enddef;
+def hroundpair (expr p) = (hround (xpart p), hround (ypart p))
+enddef;
vardef goodpair (expr p) = hroundpair(p.t_) enddef;
%</MF>
@@ -1090,7 +1109,8 @@ enddef;
% things, twice the area of the triangle with two sides $z\sb1$ and
% $z\sb2$. It is used only in \gbc{mkconvex}.
% \begin{macrocode}
-primarydef Z xprod W = (xpart Z * ypart W - xpart W * ypart Z) enddef;
+primarydef Z xprod W = (xpart Z * ypart W - xpart W * ypart Z)
+enddef;
% \end{macrocode}
%
@@ -1262,7 +1282,7 @@ def endimage =
enddef;
def makeimage (suffix name) (expr refpt) =
- setpair (_image_reference_point) zconv(refpt);
+ setpair (_image_reference_point) zconv (refpt);
setpicture (name) beginimage
enddef;
def concludeimage =
@@ -1481,6 +1501,8 @@ enddef;
% \end{macrocode}
%
+%
+%
% \section{The \grafbase{} Coordinate System}\label{coordinate}
%
% We need to make a distinction between graph units, sharped units, and
@@ -1526,6 +1548,7 @@ enddef;
% want the lower left corner of the graph space to have device coordinates
% $(0,0)$.
%
+%
% \subsection{The main transforms}\label{ztr}
%
% \DescribeVariable{vtr}
@@ -1621,6 +1644,7 @@ vardef invvconv (expr v) = v transformed (inverse vtr) enddef;
% \end{macrocode}
%
+%
% \subsection{The \gbc{mfpic} environment}\label{mfpic}
%
% \DescribeRoutine{active_plane}
@@ -1643,7 +1667,7 @@ def active_plane = currentpicture enddef;
%
% If \gbc{underlaylabels} is true, we try to make them part of the
% background, adding them to the picture variable \gbc{background_labels}.
-% Just before shipout, the picture is placed on top.
+% Just before shipout, the picture is placed on top of these labels.
%
% If \gbc{overlaylabels} is \gbc{true}, we try to make labels in \MP{}
% behave the same as labels in \TeX{} (for \mfpic) by adding the labels
@@ -1695,8 +1719,8 @@ enddef;
% \mfpic.
%
% \DescribeRoutine{bounds}
-% This used to be for compatibility also, but I decided it was a
-% convenient abbreviation, so \mfpic{} uses it now.
+% This also used to be unused, for compatibility only, but I decided it was a
+% convenient abbreviation and \mfpic{} uses it again.
% \begin{macrocode}
def mfpicenv = enddef;
def endmfpicenv = enddef;
@@ -1844,6 +1868,7 @@ enddef;
% \end{macrocode}
%
%
+%
% \section{Text}\label{text}
%
% In the \MP{} version, \gbc{label_adjust}, \gbc{label_sep} and
@@ -1879,6 +1904,7 @@ label_sep := 0; labelpath_sep := 0;
% \end{macrocode}
%
+%
% \subsection{Placement of text, \MP{} only}\label{placement}
%
% \DescribeRoutine{newgblabel}
@@ -1996,6 +2022,7 @@ enddef;
% \end{macrocode}
%
+%
% \subsection{Decorating the text, \MF{} or \MP{}}\label{decorating}
%
% The three macros \gbc{textrect}, \gbc{textoval} and \gbc{textellipse}
@@ -2111,7 +2138,8 @@ vardef textrectx (expr a, b, c, rot, xy, lbl, rad, loc) =
fi
readjustdims (ll, ur) (label_sep - labelpath_sep);
- invvconv (thegblabel (ref_shift(a, b, c, ll, ur), rot, f)) shifted loc
+ invvconv (thegblabel (ref_shift(a, b, c, ll, ur), rot, f))
+ shifted loc
enddef;
% \end{macrocode}
@@ -2160,7 +2188,8 @@ vardef xellipse (expr aspect, a, b, c, r, xy, lbl, mult, loc) =
f := ellipse (cc, aa, bb, 0);
fi
readjustdims (ll, ur) (label_sep - labelpath_sep);
- invvconv (thegblabel (ref_shift(a, b, c, ll, ur), r, f)) shifted loc
+ invvconv (thegblabel (ref_shift(a, b, c, ll, ur), r, f))
+ shifted loc
fi
enddef;
@@ -2197,6 +2226,7 @@ enddef;
% \end{macrocode}
%
%
+%
% \section{Additional Functions}\label{functions}
%
% Complex variable functions are provided, which interpret a pair $(x, y)$
@@ -2214,8 +2244,12 @@ enddef;
% in \MF.)
%
% The value \gbc{eps/2 + epsilon} is the smallest value with
-% reciprocal less than \mfc{infinity}. I set \gbc{nottoosmall} a speck
-% bigger to ensure that the same is true of \gbc{2*(nottoosmall/2)}.
+% reciprocal less than \mfc{infinity}. I set \gbc{nottoosmall} to
+% \gbc{eps/2 + 2epsilon} to ensure that the same is true of
+% \gbc{2*(nottoosmall/2)}. This is probably not necessary as
+% \mfc{epsilon/2} should round up to \mfc{epsilon} and not be lost. But
+% it also ensures that \gbc{nottoosmall} equals \gbc{2*(nottoosmall/2)},
+% which could be useful.
%
% We set \gbc{secd x = 1/(cosd x)} unless \gbc{cosd x} is less than
% \gbc{reallysmall}, then we set it equal to \gbc{1/reallysmall}. We do a
@@ -2330,9 +2364,9 @@ vardef radians (expr t) = t/radian enddef;
% \RoutineIndex{invcos}\gbc{invcos} and \RoutineIndex{invtan}\gbc{invtan})
% that return angles in radians.
% \begin{macrocode}
-vardef invcos primary X = (acos X)/radian enddef;
-vardef invsin primary X = (asin X)/radian enddef;
-vardef invtan primary X = (atan X)/radian enddef;
+vardef invcos primary X = radians (acos X) enddef;
+vardef invsin primary X = radians (asin X) enddef;
+vardef invtan primary X = radians (atan X) enddef;
% \end{macrocode}
%
@@ -2346,10 +2380,10 @@ vardef invtan primary X = (atan X)/radian enddef;
% \begin{macrocode}
vardef exp primary X = mexp (256 * X) enddef;
vardef ln primary X = (mlog X) / 256 enddef;
-def log = ln enddef;
+vardef log primary X = ln (X) enddef;
vardef logbase (expr B) primary X = (mlog X)/(mlog B) enddef;
-def logtwo = logbase( 2) enddef;
-def logten = logbase(10) enddef;
+vardef logtwo primary X = logbase( 2) (X) enddef;
+vardef logten primary X = logbase(10) (X) enddef;
% \end{macrocode}
%
@@ -2437,28 +2471,53 @@ enddef;
% These give some of the more basic functions of standard complex
% analysis: \RoutineIndex{Arg}\gbc{Arg}, \RoutineIndex{Log}\gbc{Log},
% \RoutineIndex{cis}\gbc{cis}, \RoutineIndex{zexp}\gbc{zexp},
-% \RoutineIndex{sgn}\gbc{sgn}, and \RoutineIndex{conj}\gbc{conj}.
+% \RoutineIndex{sgn}\gbc{sgn}, \RoutineIndex{zsqrt}\gbc{zsqrt} and
+% \RoutineIndex{conj}\gbc{conj}.
% \begin{macrocode}
vardef Arg primary Z = (angle Z)/radian enddef;
vardef Log primary Z = (ln (abs Z), Arg Z) enddef;
vardef cis primary T = dir (T*radian) enddef;
vardef zexp primary Z = (exp (xpart Z)) * cis (ypart Z) enddef;
-vardef sgn primary Z = if not (Z = origin): unitvector fi Z enddef;
+vardef sgn primary Z = if not (Z = origin): unitvector fi Z
+enddef;
+vardef zsqrt primary Z =
+ if Z = origin: origin else: sqrt(abs(Z)) * dir ((angle Z)/2) fi
+enddef;
vardef conj primary Z = (xpart Z, -ypart Z) enddef;
% \end{macrocode}
%
+% DescribeRoutine{zmul}
+% Unfortunately, while \MF{} will happily add and subtract pairs, it
+% will not multiply or divide them without help. We provide alternatives
+% \DescribeRoutine{zdiv} here.
+% \begin{macrocode}
+primarydef Z zmul W = Z zscaled W enddef;
+primarydef Z zdiv W =
+ Z zmul ( unitvector (conj W) / (abs W) )
+enddef;
+
+% \end{macrocode}
+%
% \DescribeRoutine{Moebius}
% A less basic operation: the Moebius shift which takes the disk $|z| <
% 1$ onto itself. It is a hyperbolic geometry analog of shifting points
% in Euclidean geometry. Its mathematical definition (all variables are
% complex numbers):
% \[
-% M_a(z) = \frac{z + a}{1 - \bar az}
+% M_a(z) = \frac{z + a}{1 + \bar az}
% \]
+% Its inverse is $M_{-a}$.
+%
% \DescribeRoutine{pshdist}
% Related to \gbc{Moebius} is the pseudohyperbolic metric. The distance
-% between $z$ and $w$ in this metric is $|z-w|/|1 - \bar wz|$.
+% between $z$ and $w$ in this metric is $|z-w|/|1 - \bar wz|$. There is
+% \DescribeRoutine{pshdist_hp}
+% also a version of this for the upper half-plane: $|z-w|/|z-\bar w|$.
+%
+% Closely related to all this is Kelvin transform. In complex notation
+% it is simply $1/\bar z = z/|z|^2$. The term ``Kelvin transform'' is
+% normally only used in real variables (of any dimension greater than 1).
% \begin{macrocode}
vardef Moebius (expr A) primary Z =
save _D; pair _D;
@@ -2466,6 +2525,17 @@ vardef Moebius (expr A) primary Z =
(Z + A)/(abs _D) rotated (- angle _D)
enddef;
vardef pshdist (expr Z,W) = abs(Moebius(-W)(Z)) enddef;
+vardef pshdist_hp (expr Z,W) = abs(Z-W)/abs(Z-conj(W)) enddef;
+vardef kelvin (expr Z) =
+ save tmp_; tmp_ = abs(Z);
+ if tmp_ = 0:
+ (infinity, infinity)
+ elseif tmp_ < reallysmall:
+ infinity*unitvector Z
+ else:
+ (1/tmp_)*unitvector Z
+ fi
+enddef;
% \end{macrocode}
%
@@ -2485,6 +2555,13 @@ def id (expr x) = x enddef;
% integer (that is, satisfy \mfc{x=floor x}). Here we redefine
% \prog{plain}'s \mfc{**}, intercepting the case of a positive integer
% power of an integer.
+%
+% There are some negative powers, and some integer powers of nonintegers
+% that can also be calculated exactly within \MF{}'s limited precision,
+% but it is difficult to determine those cases programmatically. Computing
+% every integer power by repeated multiplication or division might
+% actually reduce accuracy in the nonexact cases, so we limit ourselves to
+% this one special case.
% \begin{macrocode}
primarydef x**y =
if y=2: x*x
@@ -2497,6 +2574,7 @@ let ^ = **;
% \end{macrocode}
%
+%
% \section{Coordinate Systems and Transformations}\label{systems}
%
% \DescribeVariable{T_stack}
@@ -2532,6 +2610,7 @@ def ecoords = hide ( T_pop (ztr); vtr := vectorpart ztr ) enddef;
% \end{macrocode}
%
+%
% \subsection{Coordinate changes}\label{changes}
%
% \DescribeRoutine{apply_t}
@@ -2545,7 +2624,8 @@ def ecoords = hide ( T_pop (ztr); vtr := vectorpart ztr ) enddef;
% phrase which, were it to follow a path, would produce a transformed
% path. Knuth calls such a phrase a \emph{transformer}.
% \begin{macrocode}
-vardef vectorpart primary T = T shifted -(origin transformed T) enddef;
+vardef vectorpart primary T = T shifted -(origin transformed T)
+enddef;
def apply_t (text Transformer) =
ztr := identity Transformer transformed ztr;
@@ -2589,6 +2669,7 @@ def boost primary X = zslant (cosh X, sinh X) enddef;
% \end{macrocode}
%
+%
% \subsection{Path transformation}\label{transformation}
%
% These are functions that accept and return a path in graph coordinates.
@@ -2797,8 +2878,10 @@ enddef;
% \end{macrocode}
%
%
+%
% \section{Picture-level Operations}\label{picture}
%
+%
% \subsection{Bitwise logical operations}\label{logical}
%
% None of these operations are available in \MP. Mostly these are used by
@@ -2905,6 +2988,7 @@ enddef;
%</MF>
% \end{macrocode}
%
+%
% \subsection{Producing and modifying pictures}\label{pictures}
%
% Here we define some slightly higher level commands that make use (in \MF)
@@ -2935,12 +3019,10 @@ enddef;
% \gbc{active_plane}, we have eliminated that parameter from
% \gbc{coloraddon}.
%
-% \DescribeRoutine{_orto}
-% This version of \gbc{orto} saves memory by passing \emph{both}
-% parameters by name. This also allows the application of \gbc{mono} to
-% both parameters. In addition to \gbc{coloraddon}, it is used in
-% \gbc{shade} and \gbc{tess}.
-% \DescribeRoutine{_subto}
+% The command \gbc{_orto} is like \gbc{orto}, but saves memory by passing
+% \emph{both} parameters by name. This also allows the application of
+% \gbc{mono} to both parameters. In addition to \gbc{coloraddon}, it is
+% used in \gbc{shade} and \gbc{tess}.
% We also have \gbc{_subto}, an analogous version of \gbc{subto}.
% \begin{macrocode}
def coloraddto (expr clr) (suffix u) (expr v) =
@@ -3020,6 +3102,7 @@ enddef;
% \end{macrocode}
%
+%
% \subsection{Clipping}\label{basicclipping}
%
% \DescribeRoutine{clipto}
@@ -3312,9 +3395,9 @@ enddef;
% calling routine must make sure that picture is initialized (it need
% not be \mfc{nullpicture}).
%
-% One might do this with two nested loops, but it turns out to be much
-% faster (surprisingly much!) to do two separate loops: the second one
-% stacking copies of the row built by the first loop.
+% One might do this with one loop nested in another, but it turns out to
+% be much faster (surprisingly much!) to do two separate loops: the second
+% one stacking copies of the row built by the first loop.
%
% We try to do any rounding that might have been forgotten. This code
% takes a mode's aspect ratio into account so that (most) calling routines
@@ -3351,6 +3434,7 @@ enddef;
% \end{macrocode}
%
+%
% \subsection{Hatching}\label{basichatching}
%
% \DescribeRoutine{thatchf}
@@ -3374,7 +3458,7 @@ enddef;
% gets one to \gbc{ypart b}. We make the starting value an integer
% multiple of \gbc{_sp} to make sure adjacent regions don't have jarringly
% misaligned hatch lines. (I guess that's the reason; this algorithm
-% predates me.)
+% predates my involvement with \mfpic{}.)
% \begin{macrocode}
def thatchf (suffix v) (expr CT, sp, a, b) =
begingroup
@@ -3389,6 +3473,178 @@ enddef;
% \end{macrocode}
%
+%
+% \subsection{Gradient fills}\label{basicgradient}
+%
+% \CMP{} cannot do true gradients without some external help. Level-3
+% PostScript permits it, so recent \MP{} could do it by inserting
+% appropriate PS prologues and/or \MP{} specials. Doing that runs the
+% risk of introducing code not recognized by post-processors that expect
+% only what \MP\ natively offers. Therefore, we implement gradients by
+% filling a lot of thin regions with a range of different
+% colors.
+%
+% We have to drop down to pretty low-level operations since, before now,
+% we didn't need a command that added a colored region to a named
+% picture.
+%
+% For maximum flexibility, all our gradients pass variation in colors as a
+% function \mfc{clr} which must be previously \gbc{vardef}-ed and must
+% produce a color for each parameter value between $0$ and $1$.
+%
+% \DescribeRoutine{axialgradientf}
+% A linear gradient has colored rectangular strips that vary along a
+% single axis. The function parameter of \gbc{axialgradientf} takes one
+% variable and produces the color of each strip. \gbc{v} is a known
+% picture variable to which the resulting picture will be assigned,
+% \gbc{theta} is an angle, \gbc{a} and \gbc{b} are the opposite corners of
+% a rectangle. What is returned in \gbc{v} is a rectangular picture
+% rotated by \gbc{theta}.
+%
+% Normally, this is called by the \gbc{axialgradient} command which
+% declares the picture variable \gbc{v}, passes its angle parameter
+% \gbc{theta}, and computes the bounding box of a cyclic path for \gbc{a}
+% and \gbc{b}. The calling command will clip the result to the appropriate
+% path.
+%
+% The calculations with \gbc{signof} is for the same reason as in
+% \gbc{thatchf}. The other messy calculations try to cover the rectangle
+% exactly with an integer number of strips, with the first and last having
+% exactly the colors \gbc{clr(0)} and \gbc{clr(1)}.
+%
+% If the thickness of the strip is too small, memory problems might
+% result and appearence might suffer. Nevertheless we make no attempt to
+% enforce a minimum value.
+% \begin{macrocode}
+def axialgradientf (suffix clr, v) (expr theta, sp, a, b) =
+ begingroup
+ save _hh, _sp, _nn, _y;
+ _hh := ypart b - ypart a;
+ _sp := signof (_hh) abs(sp);
+ _nn := emax (1, round (_hh/_sp));
+ _sp := _hh/_nn + signof (_hh) epsilon;
+ _nn := _nn-1;
+ setpath (_p) rect ((xpart a, 0),(xpart b, _sp));
+ _y := ypart a;
+ for _i = 0 upto _nn:
+%<*MF>
+ if (clr(_i/_nn)) < white :
+ addto v also shaded (clr(_i/_nn)) ( _p shifted (0,_y))
+ rotated theta;
+ fi
+%</MF>
+%<*MP>
+ addto v contour (_p shifted (0,_y)) rotated theta
+ withcolor clr(_i/_nn);
+%</MP>
+ _y := _y + _sp;
+ endfor
+%<MF> mono (v);
+ endgroup
+enddef;
+
+% \end{macrocode}
+%
+% \DescribeRoutine{areagradientf}
+% The command \gbc{areagradientf} fills the rectangle determined by
+% corners \gbc{a} and \gbc{b} with pixels of dimension \gbc{sp} by
+% \gbc{tp}. Each pixel is filled with the color determined by \gbc{clr}.
+% This suffix parameter must be the name of a function taking two
+% parameters.
+%
+% The resulting rectangle is built on the picture variable whose name is
+% passed as the second parameter \gbc{v}. The calling routine is
+% \gbc{areagradient}, which determine the rectangle and initializes
+% the picture variable. It passes its other parameters unchanged.
+% \begin{macrocode}
+def areagradientf (suffix clr, v) (expr sp, tp, a, b) =
+begingroup
+ save _ww, _hh, _sp, _tp, _nn, _mm, _x, _y;
+ _ww := xpart b - xpart a;
+ _hh := ypart b - ypart a;
+ _sp := signof (_ww) abs(sp);
+ _tp := signof (_hh) abs(tp);
+ _nn := emax (1, round (_ww/_sp));
+ _mm := emax (1, round (_hh/_tp));
+ _sp := _ww/_nn + signof (_ww) epsilon;
+ _tp := _hh/_mm + signof (_hh) epsilon;
+ _mm := _mm-1; _nn := _nn-1;
+ setpath (_p) rect (origin,(_sp,_tp));
+ _x := xpart a; y_a := ypart a;
+ for _i = 0 upto _nn:
+ _y := y_a;
+ for _j = 0 upto _mm:
+%<*MF>
+ if (clr(_i/_nn,_j/_mm)) < white:
+ addto v also shaded (clr(_i/_nn,_j/_mm)) (_p shifted (_x,_y));
+ fi
+%</MF>
+%<*MP>
+ addto v contour (_p shifted (_x,_y)) withcolor
+ clr(_i/_nn,_j/_mm);
+%</MP>
+ _y := _y + _tp;
+ endfor
+ _x := _x + _sp;
+ endfor
+%<MF> mono (v);
+endgroup
+enddef;
+
+% \end{macrocode}
+%
+% \DescribeRoutine{radialgradientf}
+% The command \gbc{radialgradientf} fills the a circle determined by
+% center \gbc{ctr} and radius \gbc{rad} with concentric circular strips of
+% thickness \gbc{sp}. Each strip is filled with the color determined by
+% \gbc{clr}. This suffix parameter must be the name of a function of one
+% parameter.
+%
+% This command is called by \gbc{radialgradient}, which determines the
+% radius of a circle needed to cover a region and clips the picture
+% returned in \gbc{v} to that region.
+% \begin{macrocode}
+path unitcircle;
+unitcircle := fullcircle scaled 2;
+def radialgradientf (suffix clr, v) (expr sp, ctr, rad) =
+ begingroup
+ save _sp, _r, _nn;
+ _nn := emax (1, round (rad/sp));
+ _sp := rad/_nn + epsilon;
+ _nn := _nn - 1;
+ _r := _sp;
+ % fill the small center circle first
+%<*MF>
+ if (clr(0)) < white :
+ addto v also shaded (clr(0)) (unitcircle scaled _r shifted ctr);
+ fi
+%</MF>
+%<*MP>
+ addto v contour (unitcircle scaled _r shifted ctr)
+ withcolor clr(0);
+%</MP>
+ for _i = 1 upto _nn:
+%<*MF>
+ if (clr(_i/_nn)) < white :
+ addto v also shaded (clr(_i/_nn))
+ (unitcircle scaled (_r + _sp) -- reverse unitcircle scaled _r
+ --cycle) shifted ctr;
+ fi
+%</MF>
+%<*MP>
+ addto v contour
+ (unitcircle scaled (_r + _sp) -- reverse unitcircle scaled _r
+ --cycle) shifted ctr withcolor clr(_i/_nn);
+%</MP>
+ _r := _r + _sp;
+ endfor
+%<MF> mono (v);
+ endgroup
+enddef;
+
+% \end{macrocode}
+%
+%
% \subsection{Tiles}\label{tiles}
%
% Tesselations are a type of fill in which a rectangular pattern is
@@ -3478,6 +3734,8 @@ enddef;
% \end{macrocode}
%
+%
+%
% \section{Bounding Boxes of Paths}\label{bboxes}
%
% To fill a region with other than a solid fill, we normally fill a
@@ -3522,6 +3780,9 @@ enddef;
% This description applies only to \MF, because \MP{} has built-in
% facilities for determining the bounding box.
%
+% I have changed \gbc{ctrlsbbox} to have the same syntax as \gbc{getbbox}.
+% I don't know why I defined it differently.
+%
% \RoutineIndex{pnt}
% \RoutineIndex{pre}
% \RoutineIndex{post}
@@ -3532,6 +3793,7 @@ vardef pnt@# (expr p) = point @# of p enddef;
vardef pre@# (expr p) = precontrol @# of p enddef;
vardef post@# (expr p) = postcontrol @# of p enddef;
+numeric bbox_split; bbox_split := 4;
def getbbox (suffix ll, ur) expr g =
%<MP> ll := llcorner g; ur := urcorner g;
%<*MF>
@@ -3541,15 +3803,14 @@ def getbbox (suffix ll, ur) expr g =
ll := pairmin (ll, pnt[_j] (g)); ur := pairmax (ur, pnt[_j] (g));
endfor
for _j = 1 upto _s*(length g):
- ctrlsbbox (subpath ((_j-1)/_s, _j/_s) of g) (ll, ur);
+ ctrlsbbox (ll, ur) subpath ((_j-1)/_s, _j/_s) of g;
endfor
%</MF>
if showbbox: noclip ( safedraw rect (ll, ur) ); fi
enddef;
%<*MF>
-numeric bbox_split; bbox_split := 2;
-def ctrlsbbox (expr p) (suffix ll, ur) =
+def ctrlsbbox (suffix ll, ur) expr p =
ll := pairmin ( pairmin (ll, post0 (p)), pre 1 (p) );
ur := pairmax ( pairmax (ur, post0 (p)), pre 1 (p) );
enddef;
@@ -3557,6 +3818,31 @@ enddef;
%</MF>
% \end{macrocode}
%
+% \DescribeRoutine{getradius}
+% This is very similar to \gbc{getbbox}, but gets a ``bounding circle''
+% instead of a box. It is used to get nearly the smallest circle with a
+% given center that contains a path. The path is shifted to place the
+% center at the origin and then this function is called. Similarly,
+% \DescribeRoutine{ctrlsradius}
+% \gbc{ctrlsradius} is used like \gbc{ctrlsbbox}.
+% \begin{macrocode}
+def getradius (suffix rad) expr g =
+ setsplit (_s) bbox_split;
+ rad := abs (pnt0 (g));
+ for _j = 1 upto length g:
+ rad := emax(rad, abs(pnt[_j] (g)));
+ endfor
+ for _j = 1 upto _s*(length g):
+ ctrlsradius (rad) subpath ((_j-1)/_s, _j/_s) of g;
+ endfor
+enddef;
+
+def ctrlsradius (suffix rad) expr p =
+ rad := emax( emax (rad, abs(post0 (p))), abs(pre1 (p) ))
+enddef;
+
+% \end{macrocode}
+%
% We also have \gbc{tightbbox} and \gbc{tbbox} in \MF{} but these are no
% longer used so we'll omit them from \grafbase, but keep them in the
% documentation for now.
@@ -3568,11 +3854,9 @@ enddef;
% \mfc{.5} (accurate enough, assuming pixel units). This is only called by
% \gbc{tbbox}, which is never used.
%
-% \DescribeRoutine{_xlimit}
% \gbc{xlimit(x)} returns a value of true if the path \gbc{g} doesn't
-% cross the vertical line at \gbc{x}.
-% \DescribeRoutine{_ylimit}
-% \gbc{ylimit(y)} is the same for the horizontal line at \gbc{y}.
+% cross the vertical line at \gbc{x}. \gbc{ylimit(y)} is the same for the
+% horizontal line at \gbc{y}.
% \begin{macrocode}
%<*unused>
def tightbbox (expr g) (suffix ll, ur) =
@@ -3618,6 +3902,8 @@ enddef;
%</unused>
% \end{macrocode}
%
+%
+%
% \section{Device Coordinate Rendering Commands}\label{basicrendering}
%
% We use the word `rendering' to refer to commands that accept a path
@@ -3625,6 +3911,7 @@ enddef;
% All the commands in this section expect paths, pairs and dimensions in
% device coordinates.
%
+%
% \subsection{Drawing}\label{basicdrawing}
%
% \DescribeRoutine{safedraw}
@@ -3654,6 +3941,7 @@ enddef;
% \end{macrocode}
%
+%
% \subsection{Filling}\label{basicfilling}
%
% \DescribeRoutine{NoCycle}
@@ -3712,6 +4000,7 @@ enddef;
% \end{macrocode}
%
+%
% \subsection{Clipping}\label{clipping}
%
% \DescribeRoutine{safeclip}
@@ -3727,6 +4016,8 @@ enddef;
% \end{macrocode}
%
+%
+%
% \section{Graph Coordinate Rendering}\label{rendering}
%
% \DescribeRoutine{store}
@@ -3764,6 +4055,7 @@ vardef stored (suffix fs) expr f = store (fs) f; f enddef;
% \end{macrocode}
%
+%
% \subsection{Drawing}\label{drawing}
%
% \DescribeRoutine{drawn}
@@ -3797,18 +4089,23 @@ enddef;
%
% The reason for using a loop (at the end) that draws the \gbc{sinewave}
% path in pieces, is that all the turning can quickly exceed \MF{}'s limit
-% on the autorounding stack. I'd never heard of this stack until I ran
+% on the ``rounding table size''. I'd never heard of this until I ran
% this without a loop and received the ``capacity exceeded'' message. This
% turns out to be a problem mostly when the ratio of \gbc{len} to
% \gbc{wid} is too small and the `humps' of the sine are more like
% `bulbs'. However it is always a problem with \gbc{corkscrew} (below).
+%
+% There is no need for the loop in \MP{}, nor in \MF{} if
+% \mfc{autorounding} is set to $0$, but \mfpic's curved paths definitely
+% look better with the default \mfc{autorounding=2}.
% \begin{macrocode}
def zigzag = colorzigzag (drawcolor) enddef;
def colorzigzag (expr clr) = colorwiggle (false, clr, 0) enddef;
def sinewave = colorsinewave (drawcolor) enddef;
def colorsinewave = colorwiggle (true) enddef;
-vardef colorwiggle (expr smth, clr, tens, blen, elen, len, wid) expr f =
+vardef colorwiggle (expr smth, clr, tens, blen, elen, len, wid) expr f
+=
convertpath (g) f;
setuplengtharray (cumlen, totlen, ct) g;
save B;
@@ -3919,6 +4216,7 @@ enddef;
% \end{macrocode}
%
+%
% \subsection{Filling, unfilling and clipping}\label{filling}
%
% \DescribeRoutine{filled}
@@ -3943,6 +4241,7 @@ vardef Clip expr c = safeclip zconv (c); c enddef;
% \end{macrocode}
%
+%
% \subsection{Shading}\label{shading}
%
% \DescribeRoutine{shade}
@@ -4117,6 +4416,7 @@ enddef;
% \end{macrocode}
%
+%
% \subsection{Hatching}\label{hatching}
%
% \DescribeRoutine{thatch}
@@ -4183,6 +4483,88 @@ enddef;
% \end{macrocode}
%
+%
+% \subsection{Gradients}
+%
+% \DescribeRoutine{axialgradient}
+% We pass a \mfc{vardef}-ed function that is to provide the range of
+% colors. It can output colors of different types if desired. Two
+% natural methods are: (1)~interpolate between colors of the same type:\\
+% \indent\mfc{vardef clrgrad (expr t) = (t)[red,blue] enddef}\\
+% and (2)~extract colors from a previously built array of colors:\\
+% \indent\mfc{vardef clrgrad (expr t)= A[round(t*N)]}\\
+% where, \mfc{A0}, \mfc{A1},\dots \mfc{A[N]} are colors (necessarily of
+% the same type).
+%
+% Since we simply fill strips with a single color, \gbc{sp} is the
+% thickness of the strip (in device units) and \gbc{theta} is the angle
+% by which these strips differ from being horizontal.
+% \begin{macrocode}
+vardef axialgradient (suffix clr) (expr sp, theta) expr f =
+ convertpath (g) f;
+ if not cycle g: NoCycle("axialgradient") g;
+ else:
+ newpicture (_grd);
+ setbbox (ll, ur) g rotated -theta;
+ axialgradientf (clr, _grd) (theta, sp, ll, ur);
+ DoClip (_grd); clipto (_grd) (g);
+%<MF> safeunfill g;
+ _orto (active_plane, _grd);
+ fi
+ f
+enddef;
+
+% \end{macrocode}
+%
+% \DescribeRoutine{areagradient}
+% This fills a cyclic path with colored pixels, with the color
+% determined by the \mfc{vardef}-ed function \gbc{clr} which takes two
+% parameters. The size of the pixels is given in the last two parameters
+% \gbc{sp} and \gbc{tp} which are specified in device units.
+% \begin{macrocode}
+vardef areagradient (suffix clr) (expr sp, tp) expr f =
+ convertpath (g) f;
+ if not cycle g: NoCycle("areagradient") g;
+ else:
+ newpicture (_agr);
+ setbbox (ll, ur) g;
+ areagradientf (clr, _agr) (sp, tp, ll, ur);
+ DoClip (_agr); clipto (_agr) (g);
+%<MF> safeunfill g;
+ _orto (active_plane, _agr);
+ fi
+ f
+enddef;
+
+% \end{macrocode}
+%
+% \DescribeRoutine{radialgradient}\label{getrad}
+% This fills a cyclic path with colored circular strips, with the color
+% determined by the \mfc{vardef}-ed function \gbc{clr} which takes one
+% parameters. The thickness of the strips is given in the last parameter
+% \gbc{sp} which are specified in device units. The command
+% \gbc{getradius} finds the distance from the center to the farthest point
+% of \gbc{f}. It was added (see section~\ref{bboxes}) solely for this use.
+% \begin{macrocode}
+vardef radialgradient (suffix clr) (expr sp, ctr) expr f =
+ convertpath (g) f;
+ if not cycle g: NoCycle("radialgradient") g;
+ else:
+ setpair (_ctr) zconv (ctr);
+ newpicture (_agr);
+ save _rad;
+ getradius (_rad) g shifted - _ctr;
+ radialgradientf (clr, _agr) (sp, _ctr, _rad);
+ DoClip (_agr); clipto (_agr) (g);
+%<MF> safeunfill g;
+ _orto (active_plane, _agr);
+ fi
+ f
+enddef;
+
+% \end{macrocode}
+%
+%
% \subsection{Tesselations}\label{tess}
%
% \DescribeRoutine{tess}
@@ -4215,6 +4597,7 @@ enddef;
% \end{macrocode}
%
+%
% \subsection{Dots and dashes}\label{dashes}
%
% \MP{} already has commands for drawing a dashed or dotted curve,
@@ -4470,8 +4853,8 @@ vardef makelengtharray (suffix clen) suffix p =
numeric clen[];
clen := _s * length p; clen0 := 0;
for _i = 1 upto clen:
- clen[_i] := clen[_i-1] + abs (pnt[_i/_s] (p) - pnt[(_i-1)/_s] (p)) /
- _rescale_factor;
+ clen[_i] := clen[_i-1] + abs (pnt[_i/_s] (p) - pnt[(_i-1)/_s] (p))
+ / _rescale_factor;
endfor
clen[clen]
enddef;
@@ -4725,6 +5108,7 @@ enddef;
% \end{macrocode}
%
+%
% \subsection{Double-line drawing}\label{doubleline}
%
% \DescribeRoutine{doubledraw}
@@ -4743,6 +5127,8 @@ enddef;
% \end{macrocode}
%
+%
+%
% \section{Points Symbols and Other Pictures}\label{symbols}
%
% \DescribeRoutine{centerit}
@@ -4914,6 +5300,8 @@ enddef;
% \end{macrocode}
%
+%
+%
% \section{Axes, Tic Marks, and Grids}\label{axes}
%
% \DescribeRoutine{arrowdraw}
@@ -5482,6 +5870,8 @@ enddef;
% \end{macrocode}
%
+%
+%
% \section{Path Construction}\label{pathconstruction}
%
% This section is devoted to commands that accept a list or array of
@@ -5490,6 +5880,7 @@ enddef;
% points, lines and circles associated with a triangle. No \mfpic{}
% interface is yet available for the triangle commands.
%
+%
% \subsection{Piecewise linear paths}\label{linear}
%
% \DescribeRoutine{rect}
@@ -5658,7 +6049,9 @@ enddef;
% \DescribeRoutine{mkpoly}
% This produces the path of line segments connecting \gbc{pts1},
% \gbc{pts2}, etc., closing it up if the boolean \gbc{cyclic} is true.
-% It is also used with an array of paths instead of points.
+% It can also be used with an array of paths instead of points, connecting
+% the end of each with the beginning of the next. We do this in \mfpic{}'s
+% \cs{connect} \dots\ \cs{endconnect} construct.
% \begin{macrocode}
vardef mkpoly (expr cyclic) (suffix pts) =
for _i = 1 upto pts-1: pts[_i]-- endfor
@@ -5672,8 +6065,9 @@ enddef;
% list of pair expressions, forms an array from them and calls
% \gbc{mkpoly}.
% \DescribeRoutine{NoPoints}
-% \mfc{NoPoints} prints a warning and sets the array to a single point,
-% the origin.
+% \mfc{NoPoints} is called when an array of points is defined (using
+% setpairs) that returns $0$ for the number of pairs. It prints a warning
+% and sets the array to a single point, the origin.
% \begin{macrocode}
vardef polyline (expr cyclic) (text t) =
setpairs (_pl) (t);
@@ -5718,10 +6112,32 @@ enddef;
% I needed the following to illustrate Brownian motion. It takes a given
% starting point, a given number of steps and a scaling factor. It
% generates a sequence of random points, each one being chosen randomly
-% using a Gaussian distribution centered at the previous point. Strictly
+% using a Gaussian distribution centered at the previous point. The
+% standard deviation of the random distance is the scale factor. Strictly
% speaking this is a Gaussian random walk, not Brownian motion. A true
% Brownian motion would be a limit of these, with \gbc{num} tending to
% $\infty$ and \gbc{sc} tending to 0.
+%
+% \DescribeRoutine{randomwalk}
+% This is like \gbc{brownianpath}, but the distance from one point to
+% the next is always the same, only the direction is random. It takes
+% the same arguments as \gbc{brownianpath}
+%
+% \DescribeRoutine{browniangraph}
+% This command takes a given number of steps \gbc{num} and a scaling
+% factor/step size \gbc{scst}. It generates a sequence of points, each one
+% being chosen right of the previous one by the step size \gbc{scst} and
+% randomly up or down using a Gaussian distribution centered at the
+% previous $y-value$. The Gaussian distribution has standard deviation
+% equal to \gbc{scst}. The path starts at $(0,0)$. One needs to transform
+% the path to get a different start or a scale factor different from the
+% step size.
+%
+% In \MF{} we run into capacity problems when \gbc{num} is greater than
+% 500 or so. This is the \mfc{autorounding} problem again (see the
+% discussion at \gbc{sinewave}. We can't use the same technique we used
+% there since it is the drawing that invokes \mfc{autorounding} and these
+% macros only construct paths; they don't draw them.
% \begin{macrocode}
vardef brownianpath (expr start, num, sc) =
setnumeric (_brp) 1;
@@ -5733,9 +6149,29 @@ vardef brownianpath (expr start, num, sc) =
endfor
mkpoly (false, _brp)
enddef;
+vardef randomwalk (expr start, num, dst) =
+ setnumeric (_rdw) 1;
+ setpair (_tmp) start;
+ pair _rdw[]; _rdw1 := _tmp;
+ for _idx := 1 upto num:
+ _tmp := _tmp + dst*dir(uniformdeviate(360));
+ _rdw[incr _rdw] := _tmp;
+ endfor
+ mkpoly (false, _rdw)
+enddef;
+vardef browniangraph (expr num, scst) =
+ setnumeric (_brg) 1;
+ pair _tmp, _brg[]; _tmp := _brg1 := (0,0);
+ for _idx := 1 upto num:
+ _tmp := _tmp + scst*(1,normaldeviate);
+ _brg[incr _brg] := _tmp;
+ endfor
+ mkpoly (false, _brg)
+enddef;
% \end{macrocode}
%
+%
% \subsection{Smooth paths}\label{smooth}
%
% We added an optional parameter for the tension of smooth curves to
@@ -5839,8 +6275,8 @@ vardef mkconvex (expr tens, cyclic) (suffix pts) =
_B[_j] := sqrt(abs((pts[_j]-pts[_j-1])xprod(pts[_j+1]-pts[_j])));
endfor
if cyclic:
- _B1 := sqrt(abs((pts1 - pts[pts])xprod(pts2 - pts1)));
- _B[pts] := sqrt(abs((pts[pts]-pts[pts-1])xprod(pts1 - pts[pts])));
+ _B1 := sqrt(abs((pts1 - pts[pts])xprod(pts2 - pts1)));
+ _B[pts] := sqrt(abs((pts[pts]-pts[pts-1])xprod(pts1 - pts[pts])));
else:
_B1 := _B2;
_B[pts] := _B[pts-1];
@@ -5903,12 +6339,16 @@ enddef;
numeric default_tension; default_tension := 1;
def curve = tcurve (default_tension) enddef;
vardef tcurve (expr tens, cyclic) (text t) =
- setpairs (_tc) (t); mksmooth (tens, cyclic, _tc)
+ setpairs (_tc) (t);
+ if _tc=0: NoPoints("curve", _tc); fi
+ mksmooth (tens, cyclic, _tc)
enddef;
def ccurve = tccurve (default_tension) enddef;
vardef tccurve (expr tens, cyclic) (text t) =
- setuniquepairs (_tcc) (t); mkconvex (tens, cyclic, _tcc)
+ setuniquepairs (_tcc) (t);
+ if _tcc=0: NoPoints("ccurve", _tcc); fi
+ mkconvex (tens, cyclic, _tcc)
enddef;
% \end{macrocode}
@@ -5978,8 +6418,8 @@ vardef mkqbezier (expr cyclic) (suffix pts) =
if pts=1: {0,0}
else:
for _i = 2 step 2 until pts - 1:
- ..controls 1/3[pts[_i], pts[_i-1] ] and 1/3[pts[_i], pts[_i+1] ]..
- pts[_i+1]
+ ..controls 1/3[pts[_i], pts[_i-1]]
+ and 1/3[pts[_i], pts[_i+1]].. pts[_i+1]
endfor
if cyclic:
..controls 1/3[ pts[pts], pts[pts - 1] ]
@@ -6114,12 +6554,14 @@ def tfcncurve = functioncurve enddef;
vardef functioncurve (expr ftens) (text t) =
settension (_ftens) ftens; if _ftens < 1/3: _ftens := 1/3; fi
setuniquepairs (_fc) (t);
+ if _fc=0: NoPoints ("functioncurve", _fc); fi
if _fc > 1: _fc0 := _fc1; _fc[_fc+1] := _fc[_fc]; fi
mkfcnpath (_ftens) (_fc)
enddef;
% \end{macrocode}
%
+%
% \subsection{Splines with explicit controls}\label{splines}
%
% For these quadratic B-splines, a list of pairs representing the control
@@ -6240,6 +6682,7 @@ enddef;
% \end{macrocode}
%
+%
% \subsection{Splines with computed controls}\label{computedsplines}
%
% A cubic spline through a set of points is a curve obtained by joining
@@ -6352,9 +6795,9 @@ enddef;
% than pair values. Such are often used to interpolate functions. That is,
% given pairs $(x\sb j,y\sb{j})$, and assuming they lie on the graph of
% some function (generally unknown), fill in the graph with $y = f(x)$
-% where $f$ is a cubic function of $x$ in each interval $x\sb j < x < x\sb
-% {j+1}$, making sure that the resulting graph is as smooth as possible at
-% the points $x\sb j$.
+% where $f$ is a cubic function of $x$ in each interval $x\sb j \le x
+% \le x\sb {j+1}$, making sure that the resulting graph is as smooth as
+% possible at the points $(x\sb j, y\sb j)$.
%
% The requirements on our $2$-dimensional path are the following:
% \begin{enumerate}
@@ -6481,6 +6924,7 @@ enddef;
% \end{macrocode}
%
+%
% \subsection{Arcs, circles and ellipses}\label{arcs}
%
% We have multiple commands that generate circular arcs, differing in
@@ -6502,7 +6946,9 @@ enddef;
%
% There is really no problem with \gbc{mkarc} itself: if you can express
% both \gbc{center} and \gbc{begpt} in \MF, then the other values on the
-% arc should be no problem.
+% arc should normally be no problem. (Of course, if the radius is near
+% \mfc{infinity}, there could be points on the arc with coordinates near
+% \mfc{2infinity}, causing overflow in \MF{}. One hopes this is rare.)
%
% Care has been taken that changing the sign of various parameters
% produces reasonable results. And there should be no more problem for
@@ -6527,7 +6973,7 @@ enddef;
% is mainly to ensure that the arc begins at \gbc{begpt} and ends at
% \gbc{endpt} (exactly). A \gbc{sweep} of $0$ is actually incompatible
% with any case where \gbc{begpt<>endpt} unless \gbc{center} is
-% literally at infinity, but we allow it even though I am pretty sure
+% literally at $\infty$, but we allow it even though I am pretty sure
% the other arc commands all filter out that case.
% \begin{macrocode}
vardef mkarc (expr center, begpt, endpt, sweep) =
@@ -6546,7 +6992,7 @@ enddef;
%
% \DescribeRoutine{arc}
% The most basic: center of circle, starting point of arc, and angle
-% subtended. Another name for \gbc{arc} is \gbc{arccps}, (\gbc{cps} is
+% subtended. Another name for \gbc{arc} is \gbc{arccps}, (``\gbc{cps}'' is
% for ``center, point, sweep'').
% \begin{macrocode}
vardef arc (expr center, begpt, sweep) =
@@ -6573,7 +7019,7 @@ def arccps = arc enddef;
% used them and the several cases that they had to consider are reduced
% because the \mfc{if} in this command takes care of some of them.
%
-% The code for finding \gbc{m} uses the fact that chord and the line
+% The code for finding \gbc{m} uses the fact that the chord and the line
% from one of its endpoints to the midpoint subtend a circular arc of
% \gbc{sweep/2} and so the angle between them is half that, \gbc{sweep/4}.
% The code gets the intersection between the line in that direction and
@@ -6589,7 +7035,7 @@ def arccps = arc enddef;
% circle. This gives the radius mentioned above.
% \begin{macrocode}
vardef arcpps (expr begpt, endpt, sweep) =
- if begpt = endpt: begpt--endpt
+ if (begpt = endpt) or (sweep = 0): begpt--endpt
else:
setpair (cd) unitvector (endpt-begpt);
if abs(sweep) <= 45:
@@ -6761,7 +7207,8 @@ vardef circlepps (expr one, two, sweep) =
enddef;
vardef circlepp (expr small, one, two, rad) =
- arcpp (small, one, two, rad) & arcpp (not small, two, one, rad) & cycle
+ arcpp (small, one, two, rad) & arcpp (not small, two, one, rad)
+ & cycle
enddef;
def circleppr (expr one, two, rad, small) =
@@ -6770,11 +7217,82 @@ enddef;
% \end{macrocode}
%
+% Now we implement a different way to specify an ellipse, essentially
+% specifying it by a parallelogram in which it is to be inscribed.
+%
+% \DescribeRoutine{quarterellipse}
+% If an ellipse is inscribed in a parallelogram, tangent to all four
+% sides at the midpoints, this command produces one ``corner'' of that
+% ellipse. The arguments \mfc{A} and \mfc{C} are the midpoints of two
+% adjacent sides and \mfc{B} is the corner between those two sides. This
+% quarter-ellipse starts at \mfc{A} in the direction \mfc{B-A} and ends at
+% \mfc{C} in the direction \mfc{C-B}. As a path \mfc{p} it has two segments, where
+% \mfc{point 0 of p} is \mfc{A}, \mfc{point 2 of p} is \mfc{C}, while
+% \mfc{point 1 of p} lies on the diagonal of the parallelogram through
+% \mfc{B} and has direction there the same as \mfc{C-A}.
+%
+% This was created for the purpose of rounding off corners of a polygonal
+% path.
+% \begin{macrocode}
+vardef quarterellipse(expr A,B,C) =
+ save T_;
+ transform T_;
+ (1,0) transformed T_ = A;
+ (1,1) transformed T_ = B;
+ (0,1) transformed T_ = C;
+ quartercircle scaled 2 transformed T_
+enddef;
+
+% \end{macrocode}
+%
+% \DescribeRoutine{halfellipse}
+% While \gbc{quarterellipse} is for corners, I don't have much use for
+% \gbc{halfellipse}. Nevertheless, it seems wise (and easy) to provide a
+% definition.
+%
+% The pairs \mfc{A}, \mfc{B}, and \mfc{C} are three midpoints of a
+% parallelogram with \mfc{A} and \mfc{C} on opposite sides and \mfc{B} on
+% a third side. This determines a unique parallelogram, and
+% \gbc{halfellipse} starts at \mfc{A}, passing through \mfc{B} then
+% \mfc{C}, tangent to the respective sides. It makes a point of building
+% it out of two \gbc{quarterellipse}\,s as \mfc{halfcircle} does with
+% \mfc{quartercircle} (at least in \MF{}). We just have to compute their
+% corners.
+% \begin{macrocode}
+vardef halfellipse (expr A,B,C) =
+ save P_; pair P_;
+ P_ = (C - A)/2;
+ quarterellipse (A, B - P_, B) & quarterellipse (B, B + P_, C)
+enddef;
+
+% \end{macrocode}
+%
+% \DescribeRoutine{fullellipse}
+% For \gbc{fullellipse} we specify the center \mfc{C} of the parallelogram
+% and the midpoints \mfc{A} and \mfc{B} of two adjacent sides. We compute
+% the midpoints of the other two sides and draw two \gbc{halfellipse}\,s.
+%
+% Note that the points \gbc{A} and \gbc{B} do not correspond to the
+% usual radii of an ellipse unless the corresponding parallelogram is
+% actually a rectangle (i.e., only if $\angle ACB$ is a right angle).
+% \begin{macrocode}
+vardef fullellipse (expr C, A, B) =
+ save P_; pair P_;
+ P_ := 2[A,C];
+ halfellipse (A,B,P_) & halfellipse (P_,2[B,C],A) & cycle
+enddef;
+
+% \end{macrocode}
+%
% \DescribeRoutine{pathcenter}
% This finds the center of a circle. For other paths, the point found
% may be meaningless (but it will also obtain the center of an arc or a
-% rectangle). It takes three supposedly distinct points on the path and
-% finds the intersection of the perpendicular bisectors of two chords.
+% rectangle). It takes three or four supposedly distinct points on the
+% path and finds the intersection of the perpendicular bisectors of two
+% chords.
+%
+% This code is rather non-robust if applied to an arc that has angular
+% measure very close to either 0 or 360.
% \begin{macrocode}
vardef pathcenter expr p =
save a, cntr, n; pair cntr, a[];
@@ -6782,7 +7300,7 @@ vardef pathcenter expr p =
a1 = pnt 0 (p);
a3 = pnt [n/2] (p);
if cycle p:
- a2 = pnt [n/4] (p);
+ a2 = pnt [ n/4] (p);
a4 = pnt [3n/4] (p);
else:
a2 := a3;
@@ -6804,8 +7322,8 @@ enddef;
% This is just the circle through the three corners.
%
% \DescribeRoutine{incircle}
-% The command \gbc{incircle} produces the circle inside the triangle that
-% is tangent to all three sides. It makes use of the fact that the two
+% The command \gbc{incircle} produces the circle that is tangent to all
+% three sides of the triangle. It makes use of the fact that the two
% tangent points on the sides adjacent to corner \gbc{A} (for example) are
% equidistant from \gbc{A}. The three equations then express the fact that
% the sum of the two distances from the tangent point to the corners on
@@ -6859,12 +7377,26 @@ enddef;
% \end{macrocode}
%
% \DescribeRoutine{pshcircle}
-% Here is a couple of circles maybe only I need. They are the
+% Here are a couple of circles maybe only I need. They are the
% pseudohyperbolic circles in the unit disk and upper half-plane.
% One supplies a point that must be inside the unit circle or above
% the $x$-axis, and a radius that must be less than $1$. Some degenerate
% cases will not generate an error. We code this with a boolean that
% determines whether the disk or the half-plane is to be assumed.
+%
+% If $\alpha=(a,b)$ is the hyperbolic center (the \mfc{ctr} parameter)
+% and $\rho$ is the pseudohyperbolic radius (the \mfc{rad parameter}),
+% the formula for the (Euclidean) center $C$ and radius $R$ of the circle
+% is, for the unit disk:
+% $$
+% C = \frac{ (1 - \rho^2)a }{1 - \rho^2|a|^2},\quad
+% R = \frac{\rho(1 - |a|^2)}{1 - \rho^2|a|^2}
+% $$
+% and for the half-plane:
+% $$
+% C = a + \frac{(1 + \rho^2}{1 - \rho^2}b,\quad
+% R = \frac{2\rho b}{1 - \rho^2}
+% $$
% \begin{macrocode}
vardef pshcircle (expr disk, ctr, rad) =
if disk:
@@ -6877,49 +7409,176 @@ vardef pshcircle (expr disk, ctr, rad) =
elseif abs(ctr) >= 1 :
if abs(ctr) > 1:
GBerrmsg ("Impossible center of pseudohyperbolic circle.")
- "The center of a pseudohyperbolic circle must be in "
+ "The center of this pseudohyperbolic circle must be in "
& "the unit disk.";
fi
onepointpath (true,ctr)
else:
- % compute Euclidean center and radius (and a denominator used twice
- % in calculations).
save _r, _dnm;
_r := abs(ctr);
_dnm := 1 - _r*_r*rad*rad;
- circle ( (1 - rad*rad)/_dnm*ctr, rad*(1 - _r*_r)/_dnm)
+ circle ((1 - rad*rad)/_dnm*ctr, rad*(1 - _r*_r)/_dnm)
fi
else:
if rad >= 1 :
- GBerrmsg ("Impossible pseudohyperbolic circle.")
+ GBerrmsg ("Impossible radius of pseudohyperbolic circle.")
"The radius of a pseudohyperbolic circle must be less than 1.";
onepointpath (true,ctr)
elseif ypart ctr <= 0:
if ypart ctr < 0:
- GBerrmsg ("Impossible pseudohyperbolic circle.")
- "The center of a pseudohyperbolic circle must be in "
+ GBerrmsg ("Impossible center of pseudohyperbolic circle.")
+ "The center of this pseudohyperbolic circle must be in "
& "the upper half-plane.";
fi
onepointpath (true,ctr)
else:
- % compute Euclidean center and radius (and a denominator used twice
- % in calculations).
- % Euclidean center at xpart ctr + (1 + R^2)/(1 - R^2)*ypart ctr
- % Euclidean radius 4R/(1 - R^2)*ypart ctr
save _y, _dnm;
_y := ypart ctr;
_dnm := 1 - rad*rad;
- circle ( (xpart ctr, (1 + rad*rad)/_dnm * _y), 2rad/_dnm*_y)
+ circle ((xpart ctr, (1 + rad*rad)/_dnm * _y), 2rad/_dnm*_y)
+ fi
+ fi
+enddef;
+
+% \end{macrocode}
+%
+% \DescribeRoutine{UHPgeodesic}
+% Here is another arc-producing command. What it produces is the
+% hyperbolic geodesic from one point to another in the \emph{upper
+% half-plane} (UHP). While, theoretically, the points should both be in
+% the UHP, where the hyperbolic geometry is defined, the computations make
+% sense for any pair of points. This could be useful, so I do not enforce
+% this theoretical requirement.
+%
+% Unless two points have the same xpart, there is a unique circle passing
+% through them that meets the $x$-axis at a right angle. The hyperbolic
+% geodesic is an arc of that circle. The path starts at the first listed
+% point and ends at the second. Of the two possible arcs that connect
+% these points, it is the one that doesn't cross the $x$-axis (if there
+% is one). Our computations simply determine the angle of the arc and call
+% \gbc{arcpps}.
+%
+% When the points have the same xpart, the hyperbolic geodesic is the
+% line segment connecting them. When the points have yparts with opposite
+% signs, both arcs cross the $x$-axis. Our code produces the shorter one.
+% If both are $180$ degrees, the one that lies all on the same side of the
+% vertical line through $A$ is produced ($A$ being the first argument).
+%
+% Our method is based on the fact that the reflection $C$ of $A$ (to the
+% other side of the $x$-axis) lies on the circle on which the arc lies.
+% The angle between $A$ and $B$ when viewed from this point is therefore
+% half the angle of the arc. We actually reflect the point farthest from
+% the $x$-axis, as this produces better results.
+%
+% If $A$ and $B$ are on opposite sides of the $x$-axis, then $C$ might
+% coincide with one of the points. In this case $A$ and $B$ would
+% necessarily have equal xparts, a case we will already have processed.
+%
+% If both points lie on the $x$-axis, the computations produce the
+% semicircle from the first to the second in the upper half-plane.
+% \begin{macrocode}
+vardef UHPgeodesic (expr A, B) =
+ if xpart A = xpart B:
+ A--B
+ else:
+ save ang_, C_; pair C_;
+ if abs(ypart A) < abs(ypart B):
+ C_ := conj B;
+ else:
+ C_ := conj A;
+ fi
+ if ypart C_ = 0: % both on x-axis
+ ang_ := anglefromto(up, B - A);
+ else:
+ ang_ := anglefromto(A - C_, B - C_);
fi
+ arcpps(A, B, 2ang_)
+ fi
+enddef;
+
+% \end{macrocode}
+%
+% \DescribeRoutine{UDgeodesic}
+% There is a hyperbolic geometry defined for any simply connected open
+% set. The standard examples of such are the UHP and the unit disk (UD).
+% This next macro produces the geodesic in the UD. Once again it is the
+% arc of a circle and, if the two points do not lie on the same diameter,
+% that circle is the unique one through the two points that meets the
+% boundary of $UD$ at a right angle. When the two points do lie on the
+% same then the geodesic is the straight line connecting the points.
+%
+% The method we use is also based on reflection, where the `reflection' of
+% a point $A$ is given by $C = A/|A|^2$. Computing this can cause overflow
+% if $|A|$ too near $0$. Unfortunately, overflow can also occur if either
+% point lies are outside the UD. That is because, even for modest sizes of
+% $A$ and $B$, the part of the mentioned circle that lies outside the UD
+% can approach \gbc{infinity} in size, making the arc itself impossible to
+% draw. While it is feasible to compute when this will occur, we try to
+% keep it simple by using an approach that is only guaranteed to work when
+% the points lie in the unit disk. A minor modification allows it to to
+% always work when only one of the points is outside. This is because the
+% geodesic is not unique and we can easily choose one that doesn't
+% overflow.
+%
+% We isolate several special cases: if either point is the origin or if
+% the points have the same angle, a straight line is produced. If either
+% point is on the boundary, the computation is based on the fact that the
+% arc is tangent to the direction of that point. In the remaining cases,
+% we compute two angles based on reflecting both points. In the case where
+% both points lie inside or both lie outside, these angles are
+% theoretically equal, but when one point lies inside and the other
+% outside, these angles have opposite signs and their absolute values sum
+% to 360. They correspond to going opposite ways around the circle. We
+% choose the shorter arc as being more ``geodesic-like''.
+%
+% If $C$ is the point being reflected, but it is close enough to the
+% origin to make overflow a significant problem, we rescale the triangle
+% used to find the angle: we compute the angle between $|C|A$ and $|C|B$
+% as viewed from $C/|C|$.
+% \begin{macrocode}
+vardef UDgeodesic (expr A, B) =
+ save a_, b_;
+ a_ := abs(A); b_ = abs(B);
+ if (a_ = 0) or (b_ = 0):
+ A--B
+ elseif angle A = angle B:
+ A--B
+ else: % note: A, B and B-A are all nonzero from this point
+ save ang_;
+ if a_ = 1:
+ ang_ := anglefromto (if b_>1: A else: -A fi, B-A)
+ elseif b_ = 1:
+ ang_ := anglefromto (A-B, if a_>1: B else: -B fi)
+ else:
+ save C_; pair C_;
+ % reflecting A
+ if a_ < eps:
+ C_ := unitvector A;
+ ang_1 := anglefromto(a_*A - C_, a_*B - C_);
+ else:
+ C_ := (1/a_)*unitvector A;
+ ang_1 := anglefromto(A - C_, B - C_);
+ fi
+ % reflecting B
+ if b_ < eps:
+ C_ := unitvector B;
+ ang_2 := anglefromto(b_*A - C_, b_*B - C_);
+ else:
+ C_ := (1/b_)*unitvector B;
+ ang_2 := anglefromto(A - C_, B - C_);
+ fi
+ ang_ := if abs(ang_1) < abs(ang_2): ang_1 else: ang_2 fi;
+ fi
+ arcpps(A, B, 2ang_)
fi
enddef;
% \end{macrocode}
%
% \DescribeRoutine{barycenter}
-% This is the average of the three corners of the triangle, or of any
-% path. If \gbc{t} is an open path with length $n$ and the nodes are
-% $x\sb0$ through $x\sb n$, the barycenter is
+% This is the average of the three corners of the triangle, or of all the
+% nodes of any path. If \gbc{t} is an open path with length $n$ and the
+% nodes are $x\sb0$ through $x\sb n$, the barycenter is
% $$ \frac{1}{n+1}\sum\sb{j=0}\sp{n} x\sb j. $$
% If \gbc{t} is a cycle with $x\sb n = x\sb0$, then it is
% $$ \frac{1}{n}\sum\sb{j=0}\sp{n-1} x\sb j. $$
@@ -6952,6 +7611,39 @@ enddef;
% \end{macrocode}
%
+% \DescribeRoutine{mkbrace}
+% Because it doesn't really fit anywhere else, and because it is not
+% really enough to waste a whole subsection on, we put \gbc{mkbrace} here.
+% It is a command to draw a brace (i.e., a ``$\lbrace$'' shape) with its
+% ends and its cusp at given points. The start is at \gbc{S}, the end at
+% \gbc{E} and the cusp at \gbc{C}. \gbc{C} should be close to, but not
+% on, the line from \gbc{S} to \gbc{E}. It should also not be too close to
+% \gbc{S} or \gbc{E}, as we need room to draw two quarter circles on
+% either side of \gbc{C} and one at each of \gbc{S} and \gbc{E}.
+% \begin{macrocode}
+vardef mkbrace (expr S, C, E) =
+ save R_, U_, V_, Z_;
+ pair U_, V_, Z_[];
+ U_ := unitvector (E-S);
+ V_ := U_ rotated 90;
+
+ R_ := 0.5*(C-S) dotprod V_;
+ if R_ = 0:
+ S--C
+ else:
+ if R_ < 0 : V_ := -V_; R_ := -R_; fi
+ V_ := R_*V_; U_ := R_*U_;
+ Z_1 := S + V_ + U_;
+ Z_2 := C - V_ - U_;
+ Z_3 := C - V_ + U_;
+ Z_4 := E + V_ - U_;
+ S{V_}..{U_}Z_1--Z_2{U_}..{V_}C{-V_}..{U_}Z_3--Z_4{U_}..{-V_}E
+ fi
+enddef;
+
+% \end{macrocode}
+%
+%
% \subsection{Plotting of functions}\label{functionplots}
%
% In these macros, if the boolean argument \gbc{sm} is true then the
@@ -7148,7 +7840,7 @@ tolerancefactor := .02;
vardef mklevelset (expr sm, tens, X, Y, t, a, b, c, d) =
save _inside_;
vardef _inside_ (expr U, V) =
- inside_levelset (U, V) and between (a, b) (U) and between (c, d) (V)
+ inside_levelset(U, V) and between(a, b)(U) and between(c, d)(V)
enddef;
if not _inside_ (X, Y):
GBwarn "Invalid seed point for levelset.";
@@ -7273,16 +7965,16 @@ vardef tRKIV (expr sm, tens, zstart, ds, N) (text _RHS_) =
for _idx := 2 upto _trj:
_dt := ds/emax(1,abs(_RHS_(_tt,_ztr)));
_th := _tt + .5_dt;
- _dz1 := _dt*_RHS_(_tt, _ztr); % displacement based on current point
+ _dz1 := _dt*_RHS_(_tt, _ztr); % displacement for current point
_ztmp := _ztr + .5_dz1; % 1st midpoint
% use _th instead of twice calculating (_tt + .5_dt)
- _dz2 := _dt*_RHS_(_th, _ztmp); % displacement based on 1st midpoint
+ _dz2 := _dt*_RHS_(_th, _ztmp); % displacement for 1st midpoint
_ztmp := _ztr + .5_dz2; % 2nd midpoint
- _dz3 := _dt*_RHS_(_th, _ztmp); % displacement based on 2nd midpoint
+ _dz3 := _dt*_RHS_(_th, _ztmp); % displacement for 2nd midpoint
_ztmp := _ztr + _dz3; % temporary end point
- % get time for next loop now since we need it right away in next line:
+ % get time for next loop now since we need it in the next line:
_tt := _tt + _dt;
- _dz4 := _dt*_RHS_(_tt, _ztmp); % displacement based on end point
+ _dz4 := _dt*_RHS_(_tt, _ztmp); % displacement for end point
% get next point
_ztr := _ztr + (_dz1 + 2_dz2 + 2_dz3 + _dz4)/6;
_trj[_idx] := _ztr;
@@ -7308,8 +8000,11 @@ enddef;
% \end{macrocode}
%
+%
+%
% \section{Modification of Paths}\label{modification}
%
+%
% \subsection{Closing a path}\label{closing}
%
% In \MF{} one closes a path with any legal path connection between the
@@ -7477,7 +8172,8 @@ vardef makesector expr p = (pathcenter p)--p--cycle enddef;
% The \gbc{setpairs} statement makes \gbc{pp1}, \gbc{pp2} and \gbc{pp3}
% three points on the arc \gbc{p} in order. The arc we want goes from
% \gbc{pp3} to \gbc{pp1} with angle twice that of the corner angle at
-% \gbc{pp2}.
+% \gbc{pp2}. This function can be applied to an arbitrary path, and its
+% result will be an arc, but not necessarily a meaningful one.
% \begin{macrocode}
vardef arccomplement expr p =
if cycle p: onepointpath (false, pnt0(p))
@@ -7490,6 +8186,7 @@ enddef;
% \end{macrocode}
%
+%
% \subsection{Trimming a path}\label{trimming}
%
% \DescribeRoutine{cutoffbefore}
@@ -7545,6 +8242,7 @@ enddef;
% \end{macrocode}
%
+%
% \subsection{Creating arrows}\label{arrows}
%
% First, some better \mfc{direction} commands. They makes use of the fact
@@ -7555,7 +8253,6 @@ enddef;
% has a tangent at $z\sb0$ equal to the first one of $z\sb{j} -z\sb0$
% that is nonzero.
%
-% \DescribeRoutine{__dir}
% \gbc{__dir} gets the direction at point 0 for an arbitrary path.
% \gbc{postdirection}
% \DescribeRoutine{postdirection}
@@ -7815,7 +8512,8 @@ enddef;
% centered at the center of the dot and rotated 45 degrees, will encompass
% the whole square (theoretically).
% \begin{macrocode}
-path cut_path; cut_path := (.5,0)--(.5,.71)--(-.5,.71)--(-.5,0)--cycle;
+path cut_path;
+cut_path := (.5,0)--(.5,.71)--(-.5,.71)--(-.5,0)--cycle;
% \end{macrocode}
%
@@ -7875,6 +8573,7 @@ enddef;
% \end{macrocode}
%
+%
% \subsection{Randomizing a path}
%
% In order to randomly change a path, we need to randomly change its
@@ -7964,9 +8663,8 @@ enddef;
%
% \DescribeRoutine{detrivialized}
% We start with a routine that strips out trivial segments from a path.
-% This makes some loops a lot easier. We wouldn't want to differently
-% shift the two (equal) endpoints of a trivial segment, making it
-% nontrivial.
+% This makes some loops a lot easier. It would be weird to differently
+% shift the two (equal) endpoints of a trivial segment.
% \begin{macrocode}
vardef detrivialized expr f =
save g; path p, g[]; g := 0;
@@ -8032,10 +8730,133 @@ enddef;
% \end{macrocode}
%
+%
+% \subsection{Interpolating paths}
+%
+% Given two cubic B\'eziers, it is straightforward to create a path that
+% is ``half-way between'' them: just take its control points to be
+% at the midpoint between corresponding control points of the two
+% B\'eziers. Two paths made up of an equal number of B\'ezier are also
+% easily interpolated. However, two paths with different numbers of
+% B\'ezier segments need to be subdivided until they have an equal
+% number.
+%
+% \DescribeRoutine{interpolatedpath}
+% This command accepts a number \gbc{num}, a path or pair \gbc{P} and a
+% path \gbc{Q}. It returns a path which is somewhere ``between'' \gbc{P}
+% and \gbc{Q} if the number is between $0$ and $1$. The case where \gbc{P}
+% or \gbc{Q} is trivial is passed on to another command which is
+% considerably more efficient for that case. In the more general case, the
+% paths are rewritten so that they have equal length. For example, if
+% \gbc{P} has length 2 and \gbc{Q} has length 1, then \gbc{Q} is rewritten
+% as\\
+% \indent \gbc{subpath (0,1/2) of Q \& subpath (1/2,1) of Q}\\
+% which follows the same course as \gbc{Q} but has the same number of
+% B\'ezier parts as \gbc{P}.
+%
+% The splitting of \gbc{Q} shown above can, for reasons unknown to me,
+% produce adjacent subpaths that do not always share an endpoint. One
+% would think that \gbc{subpath (s,t) of Q} and
+% \gbc{subpath (t,u) of Q} would obviously end and start, respectively,
+% at \gbc{point t of Q}. Alas, they don't always. Hence, we employ
+% \gbc{force_equal_ends} to to make them equal, shifting their endpoints a
+% microscopic amount.
+%
+% If \gbc{Q} is a cycle we want the returned path to also be a cycle
+% (but not otherwise). This is possible whenever the ends of \gbc{P} are
+% equal.
+% \begin{macrocode}
+vardef interpolatedpath (expr t, P) expr Q =
+ if not path Q:
+ GBerrmsg ("Improper argument to interpolatedpath.")
+ "The last argument to interpolatedpath must be a path.";
+ if pair P: onepointpath(false, P)
+ else:
+ if path P:
+ P
+ else:
+ onepointpath (false, origin)
+ fi
+ fi
+ elseif pair P:
+ interpolated_pair_path (t, cycle Q, P, Q)
+ elseif not path P:
+ GBerrmsg ("Improper argument to interpolatedpath.")
+ "The second argument to interpolatedpath must be a pair "
+ & "or a path.";
+ Q
+ else:
+ if t=0: Q
+ elseif t=1: P
+ else:
+ save P_, Q_; path P_, Q_;
+ P_ := detrivialized P;
+ Q_ := detrivialized Q;
+ if length P_ = 0:
+ interpolated_pair_path (t, cycle Q, pnt0(P_), Q)
+ elseif length Q_ = 0:
+ interpolated_pair_path (t, cycle Q, pnt0(Q_), P)
+ else:
+ save G, H, n, m, k, r;
+ path G[], H[];
+ G := H := 0;
+ n := length P_; m := length Q_;
+ k := gcd(n, m);
+ r := m/k;
+ for I=0 upto n-1:
+ for J=0 upto r-1:
+ G[incr G] := subpath (I+J/r, I+(J+1)/r) of P_;
+ endfor
+ endfor
+ r := n/k;
+ for I=0 upto m-1:
+ for J=0 upto r-1:
+ H[incr H] := subpath (I+J/r, I+(J+1)/r) of Q_;
+ endfor
+ endfor
+ for N = 1 upto G-1:
+ force_equal_ends(G[N], G[N+1]);
+ force_equal_ends(H[N], H[N+1]);
+ endfor
+ interpolated_segment (t, G1, H1)
+ for N = 2 upto G: & interpolated_segment (t, G[N], H[N])
+ endfor if (pnt0(G1)=pnt1(G[G])) and (cycle Q): & cycle fi
+ fi
+ fi
+ fi
+enddef;
+
+% \end{macrocode}
+% \DescribeRoutine{interpolated_pair_path}
+% Since we cannot rely on the cyclicity of \gbc{Q}, we pass a boolean
+% parameter . That is because the second argument here might actually
+% have been the first argument of \gbc{interpolatedpath}.
+% \begin{macrocode}
+vardef interpolated_pair_path (expr t, cyclic, P, Q) =
+ save N; N := length Q;
+ if N=0: onepointpath (cyclic, (t)[pnt0(Q),P])
+ else:
+ (t)[pnt0(Q),P]..controls (t)[post0(Q),P] and
+ for n=1 upto N - 1:
+ (t)[pre[n](Q),P]..(t)[pnt[n](Q),P]..controls (t)[post[n](Q),P]
+ and
+ endfor
+ (t)[pre[N](Q),P].. if cyclic: cycle else: (t)[pnt[N](Q),P] fi
+ fi
+enddef;
+
+vardef interpolated_segment (expr t, S, T) =
+ (t)[ pnt0(S), pnt0(T)]..controls
+ (t)[ post0(S), post0(T)] and (t)[ pre1(S), pre1(T)]..
+ (t)[ pnt1(S), pnt1(T)]
+enddef;
+
+% \end{macrocode}
+%
% \subsection{Parallelling a path}
%
% \DescribeRoutine{parasegment}
-% This creates a path parallel to a given cubic Bezier segment \gbc{f}.
+% This creates a path parallel to a given cubic B\'ezier segment \gbc{f}.
% It should be called by a command (such as \gbc{parapath}) that makes
% sure \gbc{f} is nontrivial (meaning the directions are non-zero). It
% splits the segment into subsegments for accuracy. Its arguments are the
@@ -8088,7 +8909,7 @@ vardef parapath (expr d) expr f =
path g[], h, p[], q[];
numeric a, s, t;
pair u, v, w, w[];
- s := emax (3, emin (segment_split, ceiling (max_points/5/length f)));
+ s := emax(3, emin(segment_split, ceiling(max_points/5/length f)));
p := 0;
for i = 1 upto length f:
h := subpath (i-1, i) of f;
@@ -8156,6 +8977,7 @@ enddef;
% \end{macrocode}
%
+%
% \section{Miscellaneous}\label{misc}
%
% \subsection{Implementation of \mfpic{}'s \cs{plotdata} command}%
@@ -8337,8 +9159,8 @@ Plus.clear := (right--(1,1)--(-1,1)--(left)--cycle) scaled .65;
Cross := ((0,0)--(dir 45)--(dir -135)--(0,0)--(dir -45)--(dir 135))
scaled .65;
-Cross.clear := ((0,0)--(dir -45)--dir(45)--(dir 135)--(dir -135)--cycle)
- scaled .65;
+Cross.clear :=
+ ((0,0)--(dir -45)--dir(45)--(dir 135)--(dir -135)--cycle) scaled .65;
Asterisk := ((0,0)--up--down--(0,0)--(dir 30)--(dir -150)
--(0,0)--(dir -30)--(dir 150)) scaled .6;
@@ -8384,7 +9206,8 @@ save _A; pair _A[];
SolidStar := mkstar (5, 2, _A) scaled .84;
Star := undo_cycle SolidStar;
Star.clear := polyline (true)
- (_A9, _A10, _A1, _A2, _A3, (xpart _A3, 1), (xpart _A9, 1)) scaled .84;
+ (_A9, _A10, _A1, _A2, _A3, (xpart _A3, 1), (xpart _A9, 1))
+ scaled .84;
SolidStar.clear := Star.clear;
forsuffixes S =
@@ -8403,7 +9226,9 @@ endfor
% have it,
% \DescribeRoutine{lcm}
% \gbc{lcm} is a snap. Since \gbc{gcd} always returns a positive result,
-% \gbc{lcm} satisfies the usual rule for signs of products.
+% \gbc{lcm} satisfies the rule for signs of products. Note that these both
+% silently accept noninteger arguments, though the results may not be very
+% meaningful.
% \begin{macrocode}
vardef gcd (expr n, m) =
save a, b, r;
@@ -8648,7 +9473,8 @@ def barchart (expr firstbar, sep, r, vert)(text data) =
path chartbar[];
chartbar := 0; barwd := r*sep;
for _itm = data:
- barend[incr chartbar] := if pair _itm: ypart _itm else: _itm fi;
+ barend[incr chartbar]
+ := if pair _itm: ypart _itm else: _itm fi;
barbegin[chartbar] := if pair _itm: xpart _itm else: 0 fi;
endfor
barbegin := barend := barlength := barstart := chartbar;
@@ -8685,8 +9511,10 @@ enddef;
% \end{macrocode}
%
+%
%^^A Overlays - taken from MFbook, p 295. (Bruce Leban)
%
+%
% \subsection{Overlays}\label{overlays}
%
% This final code predates me. When I inherited \mfpic{} it contained no
@@ -8762,6 +9590,7 @@ numeric gcode; gcode := 0;
%</MF|MP>
% \end{macrocode}
%
+%
% \subsection{Dvips names for colors}\label{dvipsnam}
%
% In order to make \file{dvipsnam.mp} useful outside grafbase, we give
diff --git a/Master/texmf-dist/source/generic/mfpic/mfpic.dtx b/Master/texmf-dist/source/generic/mfpic/mfpic.dtx
index 5da4b773a74..586d051e18e 100644
--- a/Master/texmf-dist/source/generic/mfpic/mfpic.dtx
+++ b/Master/texmf-dist/source/generic/mfpic/mfpic.dtx
@@ -1,10 +1,10 @@
% \iffalse
% File: mfpic.dtx
-% A part of mfpic 1.06 2011/03/08
+% A part of mfpic 1.10 2012/12/03
%
% -------------------------------------------------------------------
%
-% Copyright 2002--2011, Daniel H. Luecking
+% Copyright 2002--2012, Daniel H. Luecking
%
% Mfpic may be distributed and/or modified under the conditions of the
% LaTeX Project Public License, either version 1.3c of this license or (at
@@ -22,7 +22,7 @@
%</driver>
%<sty>\ProvidesPackage{mfpic}
%<*sty>
- [2011/03/08 v1.06. Macros for drawing with Metafont/MetaPost.]%
+ [2012/12/03 v1.10. Macros for drawing with Metafont/MetaPost.]%
%</sty>
%<*driver>
\documentclass{ltxdoc}
@@ -36,6 +36,7 @@
\renewcommand \arg[1]{{\mytt \##1}}
\renewcommand\#{\char`\#\relax}
\renewcommand{\meta}[1]{{$\langle$\rmfamily\itshape#1\/$\rangle$}}
+\newcommand{\mmarg}[1]{\marg{\meta{#1}}}
\DeclareRobustCommand\cs[1]{{\mytt\char`\\#1}}
\def\prog#1{{\mdseries\scshape #1}}
\def\grafbase{\prog{grafbase}}
@@ -57,6 +58,7 @@
\renewcommand\|{${}\mathrel{|}{}$}
\makeatletter
+\let\HD@SetMacroIndent\@gobble
\newcommand\bsl{{\mytt\@backslashchar}}
% Stupid lists!
\def\@listi{\leftmargin\leftmargini
@@ -106,7 +108,7 @@
\end{document}
%</driver>
%\fi
-% \CheckSum{5145}
+% \CheckSum{5188}
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -134,15 +136,17 @@
% produce the picture. The picture is then included on a second pass
% through \TeX.
%
-% This file documents the source code. See \file{mfpic-doc.pdf}/\file{tex}
-% for the user documentation, or \file{mfpguide.pdf}/\file{tex}) for an
-% introductory guide.
+% This file documents the \mfpic{} source code. The user manual for
+% \mfpic{} is distributed as \file{mfpic-doc.pdf}, produced from
+% \file{mfpic-doc.tex}. An introductory guide to \mfpic{} is available
+% in \file{mfpguide.pdf}, produced from \file{mfpguide.tex}
% \end{abstract}
%
% \StopEventually{\PrintIndex}
% \tableofcontents
%
%
+%
% \section{Introductory setup}\label{intro}
%
% \Mfpic{} is designed to work with plain \TeX, \LaTeX, \pdfTeX, and
@@ -170,9 +174,9 @@
\ifx\mfpfileversion\UndEfInEd\else\expandafter\endinput\fi%
{%
\catcode\lq\.12 \catcode\lq\/12%
- \gdef\mfpfileversion{1.06}%
- \gdef\mfpfiledate{2011/02/25}%
- \gdef\mfpicversion{106}%
+ \gdef\mfpfileversion{1.10}%
+ \gdef\mfpfiledate{2012/12/03}%
+ \gdef\mfpicversion{110}%
}%
% \end{macrocode}
%
@@ -185,8 +189,6 @@
% \end{macrocode}
%
% We now get rid of unusually catcoded punctuation, space and EOL.
-% We save all the current category codes in the macro \cs{mfp@restoreALL}
-% and restore them at the end by executing this command.
% We assume that letters, numbers, `\texttt\bsl', `\texttt\{', `\texttt\}',
% `\texttt\#' and `\texttt\%' have the usual categories. However, styles
% (e.g., \prog{french}) that make punctuation active foul up \cs{write}\,s
@@ -201,9 +203,9 @@
\catcode96=12 % 96=left quote
\catcode`\@=11
\gdef\MFPsavecodes{%
- \edef\mfp@restoreNLchar{\newlinechar\number\newlinechar\relax}%
- \edef\mfp@restoreELchar{\endlinechar\number\endlinechar\relax}%
- \edef\mfp@restoreSP{\catcode32=\number\catcode32\relax}%
+ \edef\mfp@restoreNLC{\newlinechar\number\newlinechar\relax}%
+ \edef\mfp@restoreELC{\endlinechar\number\endlinechar\relax}%
+ \edef\mfp@restoreSPA{\catcode32=\number\catcode32\relax}%
\edef\mfp@restoreEOL{\catcode13=\number\catcode13\relax}%
\edef\mfp@restoreALL{\mfp@restorecode{=}\mfp@restorecode{@}%
\mfp@restorecode{$}\mfp@restorecode{:}\mfp@restorecode{;}%
@@ -213,8 +215,8 @@
\mfp@restorecode{>}\mfp@restorecode{*}\mfp@restorecode{/}%
\mfp@restorecode{+}\mfp@restorecode{-}\mfp@restorecode{"}%
\mfp@restorecode{'}\mfp@restorecode{_}\mfp@restorecode{`}%
- \mfp@restoreEOL\mfp@restoreSP\catcode10=\number\catcode10
- \mfp@restoreNLchar\mfp@restoreELchar}}%
+ \mfp@restoreEOL\mfp@restoreSPA\catcode10=\number\catcode10
+ \mfp@restoreNLC\mfp@restoreELC}}%
\gdef\mfp@restorecode#1{\catcode`\string#1=\number\catcode`#1\relax}%
\ifx\@makeother\UndEfInEd \gdef\@makeother#1{\catcode`#1=12\relax}\fi
\gdef\MFPsanitize{\endlinechar13 \newlinechar10
@@ -232,7 +234,7 @@
% \end{macrocode}
%
% \cs{MFPsavecodes} saves a bunch of things that must have (mostly)
-% normal settings \cs{mfp@restoreALL} will be invoked at the end of the
+% normal settings. \cs{mfp@restoreALL} will be invoked at the end of the
% file to restore all the values.
%
% \cs{MFPsanitize} sets (almost) everything to normal. It can be used to
@@ -240,6 +242,7 @@
% necessary. Characters 10 and 13 are \verb|^^J| and \verb|^^M|,
% control-J and control-M.
%
+%
% \subsection{Debugging and messages}\label{debug}
%
% \DescribeMacro{\mfpicdebug}
@@ -290,6 +293,7 @@
\def\mfp@lineno{line \number\inputlineno\space in the TeX source}%
% \end{macrocode}
%
+%
% \subsection{Detecting the format}\label{format}
%
% To detect its environment, \mfpic{} needs to test whether certain
@@ -359,12 +363,21 @@
% we are not in \AmSTeX{}. We used to detect \AmSTeX{} by checking
% \cs{fmtname}. This leads to problems if some other format inputs
% \file{amstex.tex} and redefined \cs{fmtname}. Thus we will now check
-% \cs{amstexloaded@}.
+% \cs{amstexloaded@}. Unfortunately, \file{amstex.tex} sets it equal to
+% \cs{relax}, which is much too easy to be the result of some other
+% attempt to check it. Thus, we add an additional check for
+% \cs{NoBlackBoxes}.
% \begin{macrocode}
\newif\ifmfp@latex \mfp@latexfalse
\mfp@ifdefined\documentstyle
- {\ifx \amstexloaded@\relax \mfp@DBlog{AmS-TeX detected.}%
- \else \mfp@DBlog{LaTeX detected.}\mfp@latextrue
+ {\ifx \amstexloaded@\relax % amstex loaded, or a bad check for it
+ \ifx\NoBlackBoxes\UndEfInEd % amstex not loaded
+ \mfp@DBlog{LaTeX detected.}\mfp@latextrue
+ \else % most likely amstex loaded
+ \mfp@DBlog{AmS-TeX detected.}%
+ \fi
+ \else % amstex not loaded
+ \mfp@DBlog{LaTeX detected.}\mfp@latextrue
\fi}%
{\mfp@DBlog{Neither LaTeX nor AmS-TeX detected.}}%
% \end{macrocode}
@@ -391,6 +404,7 @@
{\mfp@DBlog{Not pdfTeX.}}%
% \end{macrocode}
%
+%
% \subsection{Blank line and spacing hacks}\label{spacing}
%
% In order for commands to always read their arguments correctly,
@@ -426,6 +440,7 @@
\mfp@enddef
% \end{macrocode}
%
+%
% \subsection{Warning if commands are already defined}
%
% We sometimes (either by accident or by choice) redefine things defined
@@ -454,6 +469,7 @@
\newdef\newlet#1{\mfp@testdef#1\let#1}%
% \end{macrocode}
%
+%
% \subsection{Error messages and warnings}
%
% If one tries to switch on \MP{} support after the output file has been
@@ -524,7 +540,7 @@
% \end{macrocode}
%
% This message is issued when the \cs{tlabeljustify} command (see
-% section~\ref{labelsettings}) is issued with an invalid parameter.
+% subsection~\ref{labelsettings}) is issued with an invalid parameter.
% \begin{macrocode}
\newdef\mfp@justify@error{%
\mfp@errmsg{Invalid justification parameter for text label}%
@@ -538,12 +554,14 @@
% warning, which is otherwise issued by \cs{mfpendloop}.
% \begin{macrocode}
\newdef\mfp@untilwarn{%
- \Mfpic@warn{\mfp@b mfploop without \string\mfpuntil!}}%
+ \Mfpic@warn{\mfp@b mfploop without \string\mfpuntil!\@nl}}%
% \end{macrocode}
%
%
+%
% \section{Configuring \mfpic{} behavior}\label{configuring}
%
+%
% \subsection{Options}\label{options}
%
% \DescribeMacro{\ifmfpmpost}
@@ -636,7 +654,7 @@
% \gbc{setvariable(color)}.) For simplicity, we do this with all data
% types. For example \cs{setmfvariable}\marg{numeric} writes
% `\gbc{setnumeric}'. This makes spaces significant in the first argument,
-% so we strip them off the ends with \cs{MFP@sp@def} (defined in
+% so we strip them off the ends with \cs{mfp@sp@def} (defined in
% section~\ref{optional}).
%
% We have abbreviations for the most common internal uses. For example
@@ -655,7 +673,7 @@
% spaces are significant.
% \begin{macrocode}
\newdef\setmfvariable#1{%
- \MFP@sp@def\mfp@tempa{#1}\@setmfvariable\mfp@tempa}%
+ \mfp@sp@def\mfp@tempa{#1}\@setmfvariable\mfp@tempa}%
\newdef\@setmfvariable#1#2#3{%
\mfp@ifopengraphsfile%
{\mfcmd{set#1 (#2) #3}}%
@@ -665,7 +683,7 @@
\newdef\setmfpair {\@setmfvariable{pair}}%
\newdef\setmfcolor {\@setmfvariable{color}}%
\newdef\globalsetmfvariable#1#2#3{%
- \MFP@sp@def\mfp@tempa{#1}%
+ \mfp@sp@def\mfp@tempa{#1}%
\mfp@ifopengraphsfile
{\mfcmd{\ifx\mfp@tempa\mfp@C gsetcolor \else gsetvariable (#1) \fi
(#2) #3}}%
@@ -864,9 +882,10 @@
\newlet\ifmfp@readlog\iffalse
\newdef\mfpreadlog{%
\mfp@ifopengraphsfile
- {\mfp@afteropen@error\mfpreadlog}{\global\let\ifmfp@readlog\iftrue}}%
+ {\mfp@afteropen@error\mfpreadlog}{\global\let\ifmfp@readlog\iftrue}}%
% \end{macrocode}
%
+%
% \subsection{Graphic inclusion}\label{graphic}
%
% \DescribeMacro{\mfpicllx}
@@ -918,7 +937,7 @@
\newdef\nofile@setmfpgraphic#1{%
{\edef\mfp@tempa{#1}%
\vbox to 0pt{\vss
- \rlap{\kern2pt \mfpdraftfont \mfp@sanitized\mfp@tempa}\kern 2pt}}}%
+ \rlap{\kern2pt \mfpdraftfont \mfp@sanitized\mfp@tempa}\kern 2pt}}}%
\mfp@ifdefined\strip@prefix{}{\def\strip@prefix#1>{}}%
\newdef\mfp@sanitized{\@xp\strip@prefix\meaning}%
\newlet\@setmfpicgraphic\normal@setmfpgraphic
@@ -998,6 +1017,7 @@
%</tex>
% \end{macrocode}
%
+%
% \subsection{\LaTeX{} options and \MP{} graphics inclusion}\label{latex}
%
% Code dependent on \LaTeXe. Mostly this is the option processing
@@ -1155,6 +1175,7 @@
% \end{macrocode}
%
%
+%
% \section{Optional parameter handling}\label{optional}
%
% We borrow \LaTeX's \cs{@ifnextchar}. The first argument is the token
@@ -1182,7 +1203,7 @@
\fi
\reserved@c}%
{%
- \def\:{\global\let\@sptoken= }\: % this makes \@sptoken a space token
+ \def\:{\global\let\@sptoken= }\: % makes \@sptoken a space token
\def\:{\@xifnch}\@xp\gdef\: {\futurelet\@let@token\@ifnch}%
}%
\mfp@enddef
@@ -1193,18 +1214,23 @@
% \file{keyval}, that is \cs{KV@@sp@def}; we copy it here with name
% changes. Defining \cs{mfp@tempa}, and then calling it with a space as
% argument, ensures there will be an actual space token where needed in
-% the definition of \cs{MFP@sp@def}.
+% the definition of \cs{mfp@sp@def}. The first argument is the control
+% sequence to define and the second is its definition text, with possible
+% spaces to be stripped. (I'm wondering now why I didn't just use
+% \cs{zap@space} since there shouldn't be \emph{any} significant spaces.
+% Well, at least I have the code in place for a future key-value
+% interface.)
% \begin{macrocode}
\def\mfp@tempa#1{%
- \def\MFP@sp@def##1##2{%
- \futurelet\mfp@next\MFP@sp@d##2\@nil\@nil#1\@nil\relax##1}%
- \def\MFP@sp@d{%
- \ifx\mfp@next\@sptoken \expandafter\MFP@sp@b
- \else \expandafter\MFP@sp@b\expandafter#1%
+ \def\mfp@sp@def##1##2{%
+ \futurelet\mfp@next\mfp@sp@d##2\@nil\@nil#1\@nil\relax##1}%
+ \def\mfp@sp@d{%
+ \ifx\mfp@next\@sptoken \@xp\mfp@sp@b
+ \else \@xp\mfp@sp@b\@xp#1%
\fi}%
- \def\MFP@sp@b#1##1 \@nil{\MFP@sp@c##1}}%
+ \def\mfp@sp@b#1##1 \@nil{\mfp@sp@c##1}}%
\mfp@tempa{ }%
-\def\MFP@sp@c#1\@nil#2\relax#3{\mfp@toks{#1}\edef#3{\the\mfp@toks}}%
+\def\mfp@sp@c#1\@nil#2\relax#3{\mfp@toks{#1}\edef#3{\the\mfp@toks}}%
% \end{macrocode}
%
% The following save us some typing whenever we need to check if some
@@ -1252,12 +1278,12 @@
% that seems impossible (or impossibly hard).
% \begin{macrocode}
{%
- \catcode`Q3 \catcode`\~12
- \gdef\mfp@ifempty#1{\if~#1~\@xp\@firstoftwo\else\@xp\@secondoftwo\fi}%
- \gdef\mfp@ifexist#1{\if~#1~\@xp\@gobble\else\@xp\@firstofone\fi}%
- \gdef\mfp@emptysub#1#2{\if~#1~#2\else#1\fi}%
- \long\gdef\@ifmtarg#1{\@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil}%
- \long\gdef\@xifmtarg#1#2Q#3#4#5\@nil{#4}%
+\catcode`Q3 \catcode`\~12
+\gdef\mfp@ifempty#1{\if~#1~\@xp\@firstoftwo\else\@xp\@secondoftwo\fi}%
+\gdef\mfp@ifexist#1{\if~#1~\@xp\@gobble\else\@xp\@firstofone\fi}%
+\gdef\mfp@emptysub#1#2{\if~#1~#2\else#1\fi}%
+\long\gdef\@ifmtarg#1{\@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil}%
+\long\gdef\@xifmtarg#1#2Q#3#4#5\@nil{#4}%
}%
% \end{macrocode}
%
@@ -1280,7 +1306,7 @@
% code.
% \begin{macrocode}
\newdef\mfp@defaultopt#1#2{%
- \@ifnextchar[{\mfp@ifemptyopt{#1}{#2}}{#1{#2}}}%
+ \@ifnextchar[{\mfp@ifemptyopt{#1}{#2}}{#1{#2}}}%]
\newdef\mfp@ifemptyopt#1#2[#3]{\mfp@ifempty{#3}{#1{#2}}{#1{#3}}}%
\newdef\mfp@nullopt#1{\@ifnextchar[{\mfp@getopt{#1}}{#1{}}}%
\newdef\mfp@getopt#1[#2]{#1{#2}}%
@@ -1305,8 +1331,10 @@
% to indicate the default, minimizing the extra typing.
%
%
+%
% \section{Writing to the \file{.mf} or \file{.mp} file}\label{writing}
%
+%
% \subsection{Preserving linebreaks}\label{linebreaks}
%
% Some macros (the ones we call list macros) can take quite long
@@ -1415,6 +1443,7 @@
\mfp@ifdefined\@safe@activesfalse\@safe@activesfalse{}}%
% \end{macrocode}
%
+%
% \subsection{Initializing the output file}\label{output}
%
% Category 12 characters percent, sharp and backslash signs for the
@@ -1460,8 +1489,6 @@
% can be plotted against its sequence position.
% \item \cs{mfp@toks} Temporary token register.
% \item \cs{mfp@verbtex} A temporary token list used by \cs{mfpverbtex}.
-% \item \cs{mfp@commonverbatimtex} Tokens written at the start of every
-% output file inside a \mfc{verbatimtex} group.
% \item \cs{ifmfp@switch} Not exactly a register, but a temporary
% switch for passing information from one macro to another.
% \end{itemize}
@@ -1475,15 +1502,13 @@
\newcount\mfp@sequence
\newtoks\mfp@toks
\newtoks\mfp@verbtex
-\newtoks\mfp@commonverbatimtex
\newif\ifmfp@switch
+%</tex>
% \end{macrocode}
%
% We store most of the \mfc{verbatimtex} block that \mfpic{} relies on in
-% the token register \cs{mfp@commonverbatimtex}. We do that because it
-% relies on a couple of catcode changes and we want to be in a situation
-% where we have that under control. Each line will end with an active
-% ctrl-M, which is transformed by \cs{mfsrc} into a newline.
+% the file \file{mfpicdef.tex}. This is the code that goes into that
+% file
%
% The \cs{mpxshipout} is to cover all three cases of the output of
% `\texttt{mpto -tex}'. In public versions of \MP{} prior to 0.9 there was
@@ -1494,21 +1519,42 @@
% \mfc{btex} and so will overwrite my definition. Thus all cases are
% served.
% \begin{macrocode}
-\begingroup
- \mfp@keeplines\@makeother\#%
- \@makeother\%\global\mfp@commonverbatimtex
- {\gdef\mpxshipout{\afterassignment\middlempxshipout\setbox0=\hbox}%
- \gdef\middlempxshipout{\aftergroup\finishmpxshipout}%
- \gdef\finishmpxshipout{\dimen1=\ht0 \dimen2=\dp0
- \dimen0=\dimen1 \advance\dimen0\dimen2
- \setbox0=\hbox{\hbox{\box0
- \ifnum\dimen0>0 \vrule width1sp height\dimen1 depth\dimen2
- \else \vrule width1sp height1sp depth0sp\relax
- \fi}}%
- \ht0=0pt \dp0=0pt \shipout\hbox{\box0}}%
- \def\MFPtext#1{\vbox{\def\\{\cr}\MFPcfont\everylabel
- \halign{##\hfil\cr#1\crcr}}}%
- }\endgroup%
+%<*defs>
+\gdef\mpxshipout{\afterassignment\middlempxshipout\setbox0=\hbox}%
+\gdef\middlempxshipout{\aftergroup\finishmpxshipout}%
+\gdef\finishmpxshipout{\dimen1=\ht0 \dimen2=\dp0
+ \dimen0=\dimen1 \advance\dimen0\dimen2
+ \setbox0=\hbox{\hbox{\box0
+ \ifnum\dimen0>0 \vrule width1sp height\dimen1 depth\dimen2
+ \else \vrule width1sp height1sp depth0sp\relax
+ \fi}}%
+ \ht0=0pt \dp0=0pt \shipout\hbox{\box0}}%
+\def\MFPtext#1{\vbox{\def\\{\cr}\MFPcfont\MFPeverylabel
+ \halign{##\hfil\cr#1\crcr}}}%
+% \end{macrocode}
+%
+% There are vague plans to make the output file equally usable by \MF{}
+% and \MP{}. For this to work, \file{grafbase.mf} defines
+% \mfc{verbatimtex} to gobble everything to the next colon (which we place
+% after each \mfc{etex} we write). This fails if there is a
+% \verb$\begingroup$ without matching \verb$\endgroup$ because \MF{} sees
+% this as the command \verb$\$ (meaning \mfc{relax}) followed by the \MF{}
+% primitive \mfc{begingroup}. But \MF{} doesn't allow gobbled text
+% parameters to contain unbalanced groups. Thus, we use the replacements
+% defined here, hidden from \MF{} in a \TeX{} input file.
+% \begin{macrocode}
+\let\MFPbegingroup\begingroup
+\let\MFPendgroup\endgroup
+%</defs>
+% \end{macrocode}
+%
+% Within \file{mfpic.tex} these commands can be anything unexpandable,
+% since we just want them to be written verbatim. It makes sense to give
+% them the obvious meanings.
+% \begin{macrocode}
+%<*tex>
+\let\MFPbegingroup\begingroup
+\let\MFPendgroup\endgroup
% \end{macrocode}
%
% We store the first several lines that will be written to the output
@@ -1616,8 +1662,8 @@
verbatimtex\@nl
\ifmfp@verbtex \the\mfp@verbtex\@nl \fi
\relax\@nl
- \the\mfp@commonverbatimtex
- \def\noexpand\everylabel{\the\mfp@toks}\@nl
+ \noexpand\input mfpicdef.tex\relax\@nl
+ \def\noexpand\MFPeverylabel{\the\mfp@toks}\@nl
etex;\@nl
\mfp@ifdefined\mfp@settemplate\mfp@settemplate{}%
}%
@@ -1648,7 +1694,7 @@
% braces and spaces aren't touched.
% \begin{macrocode}
\def\mfp@dospecials{\do\$\do\&\do\#\do\^\do\_\do\%\do\~}%
-%
+% \end{macrocode}
% \DescribeMacro{\opengraphsfile}
% This is the main command to set up the output file.
% The name of the output file is its only parameter, and it appends
@@ -1739,6 +1785,7 @@
\fi \global\let\mfp@filename\UndEfInEd}{}}%
% \end{macrocode}
%
+%
% \subsection{Information from \MF: reading its log file}
%
% \DescribeMacro{\assignmfvalue}\SpecialUsageIndex{\globalassignmfvalue}
@@ -1786,7 +1833,8 @@
{\mfp@msg{}\Mfpic@msg{No value for \string#2\ifin@mfpicenv\space
in mfpic figure \number\mfp@count\fi.\@nl}}%
{}%
- \mfsrc{\@ifmplabels{\@nl verbatimtex #1\def\string#2{#2} etex;\@nl}{}%
+ \mfsrc{%
+ \@ifmplabels{\@nl verbatimtex #1\def\string#2{#2} etex;\@nl}{}%
message "\string\mfpicvalue";\@nl
message "\mfp@cmdname#2";\@nl
show #3;\@nl
@@ -1831,6 +1879,7 @@
% \end{macrocode}
%
%
+%
% \section{\Mfpic{} dimensions}\label{dimensions}
%
% A number of packages, especially figure drawing packages, allocate a
@@ -2090,6 +2139,7 @@
% \end{macrocode}
%
%
+%
% \section{Helper macros}\label{helper}
%
% \DescribeMacro{\mfpicnumber}
@@ -2177,7 +2227,7 @@
\newdef\colorarray{\setmfarray{color}}%
\newdef\rgbcolorarray{\setmfarray{rgbcolor}}%
\newdef\cmykcolorarray{\setmfarray{cmykcolor}}%
-\newdef\globalsetmfarray#1#2{\mfsrc{gsetarray (#1) (#2)}\mfp@writedata}%
+\newdef\globalsetmfarray#1#2{\mfsrc{gsetarray (#1)(#2)}\mfp@writedata}%
\newlet\globalsetmparray\globalsetmfarray
% \end{macrocode}
%
@@ -2279,6 +2329,7 @@
% \end{macrocode}
%
%
+%
% \section{Macros to implement prefix commands}\label{prefix}
%
% Some \mfpic{} macros, like \cs{circle} create a path. When used without
@@ -2395,7 +2446,7 @@
% default color, but we provide a command for the user to change it.
% \begin{macrocode}
\newdef\mfp@render{\draw[]}%
-\newdef\setrender#1{\mfp@def\mfp@render{#1}}%
+\newdef\setrender{\mfp@def\mfp@render}%
% \end{macrocode}
%
% A figure macro will invoke the common first-stage code and the rendering
@@ -2455,6 +2506,7 @@
% \end{macrocode}
%
%
+%
% \section{Macros for getting data from files}\label{rwdata}
%
% The following command contains the common code to open a data file for
@@ -2588,8 +2640,9 @@
\fi}%
% \end{macrocode}
%
+% \section{Various \mfpic{} Settings.}\label{mfpsettings}
%
-% \section{Various \CMF{} Settings.}\label{MFsettings}
+% \subsection {\CMF{} settings}\label{MFsettings}
%
% \DescribeMacro{\penwd}
% Macros that write changes in default \grafbase{} variables now use the
@@ -2651,8 +2704,8 @@
\newdef\settension#1{\setmfnumeric{default_tension}{#1}}%
% \end{macrocode}
%
-%
-% \section{Settings for text label placement in figures}\label{labelsettings}
+% \subsection{Settings for text label placement in figures}
+% \label{labelsettings}
%
% \cs{tlabel}\,s are `justified' by placing a particular point of the
% text at the location specified. The \cs{tlabel} command accepts an
@@ -2781,7 +2834,7 @@
\mfp@ifmpost
{\mfp@ifopengraphsfile
{\mfcmd{verbatimtex\@nl
- \def\noexpand\everylabel{\the\mfp@toks} etex}}%
+ \def\noexpand\MFPeverylabel{\the\mfp@toks} etex}}%
{}}%
{}}%
\newdef\every@tlabel{}%
@@ -2795,8 +2848,7 @@
\newdef\pinumber{3.14159}%
% \end{macrocode}
%
-%
-% \section{Other settings}\label{othersettings}
+% \subsection{Other settings}\label{othersettings}
%
% \DescribeMacro{\headshape}
% This sets the arrowhead shape. The parameters are: the ratio of width
@@ -2867,7 +2919,8 @@
% command name has the string `\texttt{color}', but the color does not.
% \begin{macrocode}
\newdef\mfpdefinecolor#1#2#3{\setmfcolor{#1}{#2(#3)}}%
-\newdef\mfp@defclr#1#2#3{\setmfcolor{#1}{\mfp@ifempty{#2}{#3}{#2(#3)}}}%
+\newdef\mfp@defclr#1#2#3{%
+ \setmfcolor{#1}{\mfp@ifempty{#2}{#3}{#2(#3)}}}%
\newdef\mfp@newcolorcmd#1{%
\@namedef{#1\mfp@C}{\mfp@nullopt{\mfp@defclr{#1\mfp@C}}}}%
\mfp@newcolorcmd{draw}\mfp@newcolorcmd{fill}\mfp@newcolorcmd{tlabel}%
@@ -3037,7 +3090,7 @@
the following letters: x, y, l, b, r, or t. If you proceed, ^^J%
x will be assumed.}\def\mfp@axisnum{0}\def\mfp@axisletter{x}}%
{\edef\mfp@axisnum{\@nameuse{mfp@axis@#1}}\def\mfp@axisletter{#1}}%
- \edef\mfp@defheadlen{%
+ \edef\mfp@defaultheadlen{%
\the\ifnum\mfp@axisnum>1 \sideheadlen\else \axisheadlen\fi}}%
% \end{macrocode}
%
@@ -3202,6 +3255,8 @@
\newdef\mfp@additions{}%
% \end{macrocode}
%
+%
+%
% \section{The user level graphics macros}
%
% This is the start of the definition of \cs{mfp@grafmacs}. It contains
@@ -3213,10 +3268,11 @@
\newdef\mfp@grafmacs{%
% \end{macrocode}
%
+%
% \subsection{Figure macros}\label{figure}
%
% These are the figure macros. These are implemented as \MF{} paths that
-% can be variously rendered, transformed, etc., with the prefix macros of
+% can be variously rendered, transformed, etc., by the prefix macros of
% subsection~\ref{prefixcommands}.
%
% Most of the \mfpic{} graphic commands take optional arguments. Most of
@@ -3235,6 +3291,7 @@
% its syntax in use. For those that call an \cs{mfp@} version, the
% implementation is in the next section.
%
+%
% \subsubsection{Common geometric objects}\label{geometric}
%
% The first few (\cs{rect} through \cs{sector}) are closed paths and
@@ -3317,6 +3374,31 @@
\newdef\ellipse{\mfp@defaultopt\mfp@ellipse{0}}%
% \end{macrocode}
%
+% \DescribeMacro{\quarterellipse}
+% \DescribeMacro{\halfellipse}
+% \DescribeMacro{\fullellipse}
+% The next three commands simply call \grafbase{} commands of the same
+% name. They draw part or all of an ellipse inscribed in a parallelogram.
+% Each requires for its argument three points, separated by commas. For
+% \cs{quarterellipse} these points are, respectively, the midpoint of one
+% side of a parallelogram, a corner point on that side, and the midpoint
+% of the side adjacent to the first at that corner. For \cs{halfellipse}
+% they are the midpoints of three successive sides. For \cs{fullellipse}
+% they are the center and the midpoints of two adjacent sides. They are
+% all simple figmacs with no optional arguments and no star forms.
+%
+% It would be possible to give all of them the same three arguments,
+% for example those of \cs{fullellipse}, but I wanted to put the
+% endpoints of the paths into the argument list. The reason
+% \cs{quarterellipse} is passed the corner point instead of the center is
+% because of the intended use: rounding off an asymmetric corner without
+% having to compute the center of the parallelogram.
+% \begin{macrocode}
+ \newdef\quarterellipse##1{\mfp@figmac{quarterellipse (##1)}}%
+ \newdef\halfellipse##1{\mfp@figmac{halfellipse (##1)}}%
+ \newdef\fullellipse##1{\mfp@figmac{fullellipse (##1)}}%
+% \end{macrocode}
+%
% \DescribeMacro{\sector}
% This is the closed curve starting at the center of a circle, out
% along a radius to the circumference of the circle, along an arc of the
@@ -3361,7 +3443,8 @@
\newdef\arc{\mfp@iftoken*{\arccomplement\mfp@arc}{\mfp@arc}}%
% \end{macrocode}
%
-% This final circle is for we complex function theorists. It makes a
+% \DescribeMacro{\pshcircle}
+% This final circle is for us complex function theorists. It makes a
% `pseudohyperbolic circle'. This requires a point $z$ inside the circle
% with center $(0,0)$ and radius $1$, and a radius $R < 1$. It produces
% a circle with $R$ as its pseudohyperbolic radius and $z$ as its
@@ -3371,6 +3454,18 @@
\newdef\pshcircle{\mfp@ifstar\mfp@pshcircle\mfp@F\mfp@T}%
% \end{macrocode}
%
+% \DescribeMacro{\hypergeodesic}
+% And this final arc is also for we complex function theorists. It makes a
+% `hyperbolic geodesic'. This requires two points $z$ and $w$ inside the
+% circle $T$ with center $(0,0)$ and radius $1$. It produces a circular arc
+% from the first point to the second on the unique circle that passes
+% through these two points and meets $T$ at right angles. The star form
+% switches contexts to the upper half-plane.
+% \begin{macrocode}
+ \newdef\hypergeodesic{\mfp@ifstar\mfp@hypergeodesic{UHP}{UD}}%
+% \end{macrocode}
+%
+%
% \subsubsection{List macros}\label{list}
%
% The figure macros of this section are all list macros. They produce a
@@ -3514,7 +3609,7 @@
% in the list. If the optional argument is absent (or empty), the
% \grafbase{} command that is written takes only a boolean argument
% (closed or not closed) followed by the list of points. If the tension
-% argument is present, a different comamnd is written that also has a tension
+% argument is present, a different command is written that also has a tension
% argument. The command name is almost the same, but has a `\gbc{t}'
% prepended. The default tension is the \cs{grafbase}{} variable
% \gbc{default_tension}, set with \cs{settension}, initialized to 1.
@@ -3589,16 +3684,6 @@
\newdef\turtle{\mfp@listmac{turtle}}%
% \end{macrocode}
%
-% \DescribeMacro{\brownianmotion}
-% Used by me once to ilustrate Brownian motion. The argument consists of
-% a starting point, the number of steps, and a scale factor, separated
-% by commas. It draws a polyline starting with the starting point moving
-% in a random direction a random distance, then repeating that from the
-% new point, etc., for the number of steps given. The size of each step is
-% random, but the scale factor gives the average size.
-% \begin{macrocode}
- \newdef\brownianmotion##1{\mfp@figmac{brownianpath (##1)}}%
-% \end{macrocode}
%
% \subsubsection{Graphing functions}\label{functions}
%
@@ -3687,7 +3772,7 @@
% example,\\
% \indent\verb$\levelcurve[p]{(0,0),0.1}{x*x + y*y < 3}$\\
% will draw approximately the circle with radius $\sqrt3$ as a sequence of
-% line segments with length $0.1$. That will require about 108 segments.
+% line segments with length $0.1$. That will require about 109 segments.
% Its parameters are similar enough to those of \cs{function} that we
% can use the same interface.
% \begin{macrocode}
@@ -3695,19 +3780,19 @@
% \end{macrocode}
%
% We now define two macros for depicting the solution of an
-% ordinary differential equation. THe first of these, \cs{DEgraph},
-% produces the graph of solutions of equations of the form
+% ordinary differential equation. The first of these, \cs{DEgraph},
+% produces the graph of the solution for equations of the form
% $$
-% \frac{dy}{dx} = f(x,y),\quad y(x_0) = y_0.
+% \frac{dy}{dx} = f(x,y),\quad y(x\sb0) = y\sb0.
% $$
-% The data required are the \emph{initial values} (the two numbers $x_0$
-% and $y_0$), the formula $f(x,y)$ (an explicit \MF{} numerical expression
-% with literal variables \mfc{x} and \mfc{y} as the only unknowns. Since
-% the \MF{} and only handle paths connecting discrete points, also
-% required is a step size which, roughly speaking, is the distance between
-% points in graph coordinates, and the number of steps $N$ to use. The \MF{}
-% macros then calculate $N$ additional points (the first is $(x_0,y_0)$) and join
-% them together to produce the graph.
+% The data required are the \emph{initial values} (the two numbers $x\sb0$
+% and $y\sb0$), the formula $f(x,y)$ (an explicit \MF{} numerical
+% expression with literal variables \mfc{x} and \mfc{y} as the only
+% unknowns. Since \MF{} can only handle paths connecting discrete points,
+% also required is a step size which, roughly speaking, is the distance
+% between points in graph coordinates, and the number of steps $N$ to use.
+% The \MF{} macros then calculate $N$ additional points (the first is
+% $(x\sb0,y\sb0)$) and join them together to produce the graph.
%
% The second macro, \cs{DEtrajectory}, draws the trajectory of a
% two-dimentional differential equation of the form
@@ -3719,7 +3804,7 @@
% require three dimensions to indicate the relation between $x$, $y$, and
% $t$. Mathematicians call it a trajectory, and it only shows the
% two-dimensional path followed by the moving object. The required data
-% are an initial point $(x_0,y_0)$, the formula for the right-hand side
+% are an initial point $(x\sb0,y\sb0)$, the formula for the right-hand side
% (an explicit \MF{} pair-valued expression or a pair of numerical
% expressions in parentheses, with literal variables \mfc{x}, \mfc{y} and
% \mfc{t} as the only unknowns. Also required are a step size and the
@@ -3742,19 +3827,47 @@
%
% Thus our macros require the user to supply a parameter that will be
% interpreted as a distance step: if $h$ is this parameter, instead of
-% finding values of $y$ at $x_0$, $x_0+h$, $x_0+2h$, etc., it finds points
-% $(x_n,y_n)$ on the graph so that the two-dimensional distance from $(x_0,y_0)$
-% to $(x_1,y_1)$ is $h$, then the distance from $(x_1,y_1)$ to $(x_2,y_2)$
-% is also $h$, etc. The resulting graph therefore simply follow the graph
-% of $y = 1/(1-x)$ a distance roughly $Nh$ and numerical overflow is
-% impossible unless the value of $Nh$ exceeds \MF{}'s size limits.
-%
-% There is an optional smoothness parameter as in \cs{function}.
+% finding values of $y$ at $x\sb0$, $x\sb{0+h}$, $x\sb{0+2h}$, etc., it
+% finds points $(x\sb{n},y\sb{n})$ on the graph so that the
+% two-dimensional distance from $(x\sb0,y\sb0)$ to $(x\sb1,y\sb1)$ is $h$,
+% then the distance from $(x\sb1,y\sb1)$ to $(x\sb2,y\sb2)$ is also $h$,
+% etc. The resulting graph therefore simply follow the graph of $y =
+% 1/(1-x)$ a distance roughly $Nh$ and numerical overflow is impossible
+% unless the value of $Nh$ exceeds \MF{}'s size limits. There is an
+% optional smoothness parameter as in \cs{function}.
% \begin{macrocode}
\newdef\DEgraph{\mfp@fcn{odeRKIV}s}%
\newdef\DEtrajectory{\mfp@fcn{xyRKIV}s}%
% \end{macrocode}
%
+% \DescribeMacro{\brownianmotion}
+% Used by me once to ilustrate Brownian motion. The argument consists of
+% a starting point, the number of steps, and a scale factor, separated
+% by commas. It draws a polyline starting with the starting point moving
+% in a random direction a random distance, then repeating that from the
+% new point, etc., for the number of steps given. The size of each step is
+% random, but the scale factor gives the average size.
+%
+% \DescribeMacro{\browniangraph}
+% This approximates the graph of one-dimensional Brownian motion. The
+% argument consists of the number of steps and a scale factor/step size,
+% separated by commas. It draws a polyline starting at $(0,0)$, moving
+% right by the step size and up or down (randomly chosen) by a random
+% amount, then repeating that from the new point, etc., for the number of
+% steps given.
+%
+% \DescribeMacro{\randomwalk}
+% This is a two dimensional random walk. The argument consists of a
+% starting point, the number of steps, and a distance, separated by
+% commas. Like \cs{brownianmotion}, it draws a polyline starting at the
+% starting point, moving in a random direction, but for this command it
+% always moves a fixed distance.
+% \begin{macrocode}
+ \newdef\brownianmotion##1{\mfp@figmac{brownianpath (##1)}}%
+ \newdef\browniangraph##1{\mfp@figmac{browniangraph (##1)}}%
+ \newdef\randomwalk##1{\mfp@figmac{randomwalk(##1)}}%
+% \end{macrocode}
+%
%
% \subsection{Plotting data from files}\label{datafiles}
%
@@ -3775,8 +3888,10 @@
\newdef\datafile{\mfp@nullopt\mfp@datafile}%
% \end{macrocode}
%
+%
% \subsection{The prefix commands}\label{prefixcommands}
%
+%
% \subsubsection{Storing and reusing a figure}\label{storing}
%
% \DescribeMacro{\store}
@@ -3811,6 +3926,13 @@
% \cs{mfobj}\marg{\meta{name}} is a figure macro, and should act exactly
% the same as if the figure macro that had been stored in the variable
% were typed in its place. Its one argument is the variable name.
+%
+% Instead of the variable name, the argument can contain any reasonable
+% \MF{} path expression. In this context ``reasonable'' means it should
+% contain no special \TeX{} characters that might expand upon being
+% written to the output file. In particular, the backslash and `\verb$~$'
+% should especially be avoided.
+%
% \DescribeMacro{\mpobj}
% The macro \cs{mpobj} is just another name for the same command.
% \begin{macrocode}
@@ -3839,6 +3961,7 @@
\newdef\putmfpimage##1{\mfsrc{\@nl putimage (##1)}\mfp@writedata}%
% \end{macrocode}
%
+%
% \subsubsection{Subpaths}
%
% \DescribeMacro{\cutoffbefore}
@@ -3986,7 +4109,8 @@
% takes an additional argument, in this case, the first mandatory argument
% of \cs{plot}.
% \begin{macrocode}
- \newdef\plot{\mfp@optrendii{doplot}{\the\pointsize,\the\symbolspace}}%
+ \newdef\plot{%
+ \mfp@optrendii{doplot}{\the\pointsize,\the\symbolspace}}%
% \end{macrocode}
%
% \DescribeMacro{\plotnodes}
@@ -4018,6 +4142,7 @@
\newdef\showcontrols{\mfp@optrendii{showcontrols}{\the\pointsize}}%
% \end{macrocode}
%
+%
% \subsubsection{Closing a curve}\label{closing}
%
% There are several commands used to close paths (by prefixing them to
@@ -4033,6 +4158,7 @@
% \DescribeMacro{\sclosed}
% The first, \cs{sclosed}, closes smoothly in the same manner that
% \cs{curve} creates a smooth path.
+%
% \DescribeMacro{\bclosed}
% The second, \cs{bclosed}, uses an ordinary \MF{} B\'ezier. These two
% have an optional argument: the amount of tension to put in the
@@ -4046,6 +4172,7 @@
% The macro \cs{cbclosed} computes a closure by calculating cubic B-spline
% control points from the path data and then generating a connecting
% spline (see \cs{cspline}).
+%
% \DescribeMacro{\qbclosed}
% The macro \cs{qbclosed} is similar, but quadratic B-splines are used.
%
@@ -4072,6 +4199,7 @@
\newdef\makesector{\mfp@modmac{makesector}}%
% \end{macrocode}
%
+%
% \subsubsection{Filling a closed curve}\label{filling}
%
% The next few prefix macros fill the interior of the closed path that
@@ -4126,6 +4254,34 @@
\newlet\hatch\xhatch
% \end{macrocode}
%
+% \DescribeMacro{\gradient}
+% The \cs{gradient} command approximates a linear gradient fill using
+% adjacent strips of different colors. It takes one mandatory argument
+% containing three items separated by commas. The first is a
+% \mfc{vardef}-ed function that produces the colors, the second is the
+% thickness of the color strips and the third is the angle these strips
+% make with the horizontal.
+%
+% \DescribeMacro{\areagradient}
+% This allows more general shading. It produces a fill consisting of
+% differently colored ``pixels''. It also takes one mandatory argument
+% containing three items separated by commas. The first is a
+% function of two variables that produces the colors, the second is the
+% width of the pixels and the third is their height.
+%
+% \DescribeMacro{\radialgradient}
+% This allows shading in a concentric circular pattern. It produces a fill
+% consisting of differently colored circular strips. It also takes one
+% mandatory argument containing three items separated by commas. The first
+% is a function of one variable that produces the colors, the second is
+% the thickness of the circular strips, and the third is an ordered pair
+% (the center the circles).
+% \begin{macrocode}
+ \newdef\gradient{\mfp@rendi{axialgradient}}%
+ \newdef\areagradient{\mfp@rendi{areagradient}}%
+ \newdef\radialgradient{\mfp@rendi{radialgradient}}%
+% \end{macrocode}
+%
% \DescribeMacro{\gfill}
% \cs{gfill} take one optional argument, the color with which to fill.
% Under \MF{} the color must be a numeric (representing a level of gray)
@@ -4145,6 +4301,7 @@
\newdef\gclip{\mfp@rendmac{Clip}}%
% \end{macrocode}
%
+%
% \subsubsection{Modifying a curve}\label{transforming}
%
% The following are transformation prefixes. They are all (except
@@ -4160,6 +4317,7 @@
% do not compensate and users don't seem to mind.
% \begin{itemize}
% \item \cs{reverse} and \cs{xyswappath} have no argument.
+% \item \cs{reversepath} = \cs{reverse}.
% \item \cs{rotatepath} takes \marg{\meta{point},\meta{angle}}.
% \item \cs{shiftpath} takes \marg{\meta{pair}}.
% \item \cs{scalepath} takes \marg{\meta{center of scaling},\meta{factor}}.
@@ -4176,7 +4334,7 @@
%
% All of them simply write the \grafbase{} command of nearly the same
% name, with the same arguments, via
-% \cs{mfp@modi}.\SpecialUsageIndex{\reverse}
+% \cs{mfp@modi}.\SpecialUsageIndex{\reversepath}\SpecialUsageIndex{\reverse}
% \SpecialUsageIndex{\xyswappath}\SpecialUsageIndex{\rotatepath}
% \SpecialUsageIndex{\shiftpath}\SpecialUsageIndex{\scalepath}
% \SpecialUsageIndex{\xscalepath}\SpecialUsageIndex{\yscalepath}
@@ -4185,15 +4343,16 @@
% \SpecialUsageIndex{\transformpath}
%
% \begin{macrocode}
- \newdef\reverse{\mfp@addmac{reverse}}%
+ \newdef\reversepath{\mfp@addmac{reverse}}%
+ \newlet\reverse\reversepath
\newdef\xyswappath{\mfp@modmac{xyswappedpath}}%
\newdef\rotatepath{\mfp@modi{rotatedpath}}%
\newdef\shiftpath{\mfp@modi{shiftedpath}}%
\newdef\scalepath{\mfp@modi{scaledpath}}%
\newdef\xscalepath{\mfp@modi{xscaledpath}}%
\newdef\yscalepath{\mfp@modi{yscaledpath}}%
- \newdef\slantpath{\mfp@modi{xslantedpath}}%
- \newlet\xslantpath\slantpath
+ \newdef\xslantpath{\mfp@modi{xslantedpath}}%
+ \newlet\slantpath\xslantpath
\newdef\yslantpath{\mfp@modi{yslantedpath}}%
\newdef\reflectpath{\mfp@modi{reflectedpath}}%
\newdef\transformpath{\mfp@modi{transformedpath}}%
@@ -4240,6 +4399,19 @@
\newdef\randomlines{\mfp@modi{randomlines}}%
% \end{macrocode}
%
+% \DescribeMacro{\interpolatepath}
+% This prefix macro has one mandatory argument containing a number and a path,
+% separated by a comma. The number can be any \MF{} numeric expression and
+% the path can be any \MF{} path expression. The number should normally be
+% in the range $0$ to $1$ and the path normally a variable (e.g, defined using
+% \cs{store}). It returns a path which is between the one in its argument
+% and the one that follows. If the number is $0$, the following path is
+% returned unchanged, if the number is $1$ the path in the argument is
+% returned.
+% \begin{macrocode}
+ \newdef\interpolatepath{\mfp@modi{interpolatedpath}}%
+% \end{macrocode}
+%
% \DescribeMacro{\arccomplement}
% This can precede an arc and then returns its complement. It starts at
% the last point of the following arc and ends at the beginning of that
@@ -4251,6 +4423,7 @@
\newdef\arccomplement{\mfp@modmac{arccomplement}}%
% \end{macrocode}
%
+%
% \subsubsection{Adding arrowheads (and tails)}\label{arrows}
%
% Paths can now have heads and tails and something placed in the
@@ -4333,6 +4506,7 @@
%
% This ends the prefix macros.
%
+%
% \subsection{Transforming the coordinate system}\label{coordinate}
%
% \DescribeMacro{\coords}
@@ -4382,6 +4556,7 @@
\newdef\xyswap{\applyT{xyswap}}%
% \end{macrocode}
%
+%
% \subsection{Axes and grids}\label{axes}
%
% An axis would normally not be thought of as a figure macro, because one
@@ -4468,7 +4643,7 @@
% first argument (that is, the expectation that optional arguments come
% first is still satisfied). The optional argument is the length of the
% marks. The position of the marks is controlled separately by the
-% \cs{setaxismarks} command, described in section~\ref{othersettings}.
+% \cs{setaxismarks} command, described in subsection~\ref{othersettings}.
% \begin{macrocode}
\newdef\axismarks##1{\mfp@defaultopt{\mfp@marks{##1}}{\the\hashlen}}%
\newdef\xmarks{\axismarks x}%
@@ -4505,7 +4680,7 @@
% \DescribeMacro{\vgridlines}
% \cs{vgridlines} is the vertical version.
%
-% No arguments are shown because \cs{mfp@simple} or \cs{mfp@simpli} will
+% No arguments are shown because \cs{mfp@simple} or \cs{mfp@simplei} will
% read what it needs.
% \begin{macrocode}
\def\grid{\mfp@defaultopt{\mfp@simplei{vargrid}}{\the\griddotsize}}%
@@ -4570,6 +4745,7 @@
\mfp@defaultopt{\mfp@vectorfield{plr}}{\the\headlen}}%
% \end{macrocode}
%
+%
% \subsection{Visualizing points}\label{points}
%
% \DescribeMacro{\point}
@@ -4611,6 +4787,7 @@
\mfp@defaultopt\mfp@plottext{cc}}%
% \end{macrocode}
%
+%
% \subsection{Some composite objects}\label{composite}
%
% \DescribeMacro{\tile}
@@ -4676,10 +4853,10 @@
\mfp@checklatexenv{connect}{\aftergroup\@mfpstarttrue}{}}%
% \end{macrocode}
%
+%
% \subsection{Other graphical features}\label{otherfeatures}
%
-% And now for something completely different: pie charts and bar charts
-% (or bar graphs, or histograms).
+% And now for something completely different.
%
% \DescribeMacro{\piechart}
% Actually, nothing is drawn by the \cs{piechart} command; it only defines
@@ -4768,7 +4945,7 @@
% members of the just mentioned array). It is a figure macro and take the
% number of the bar as its mandatory argument. Aliases \cs{graphbar},
% \cs{histobar} and \cs{ganttbar} are provided. We avoid \cs{bar} because
-% it is already a math accent command. This ends \cs{mfp@grafmacs}.
+% it is already a math accent command.
% \begin{macrocode}
\newlet\barchart\mfpbarchart
\newlet\bargraph\barchart
@@ -4778,19 +4955,33 @@
\newlet\graphbar\chartbar
\newlet\histobar\chartbar
\newlet\ganttbar\chartbar
+% \end{macrocode}
+%
+% \DescribeMacro{\gbrace}
+% Finally, a command to create a brace shape with given ends and a given
+% location for the cusp. We name it with a `g' so as not to overwrite a
+% possible text command with a similar name. The argument is simply passed
+% to the corresponding \grafbase{} command; it consists of three points
+% separated by commas denoting, respectively, the start of the brace,
+% the cusp, and the end. Distance from cusp to line connecting start and
+% end must be less than about 3/4 the distance to either start or end.
+%
+% This ends \cs{mfp@grafmacs}.
+% \begin{macrocode}
+ \newdef\gbrace##1{\mfp@figmac{mkbrace(##1)}}%
}% end \mfp@grafmacs
% \end{macrocode}
-%\toks0={^^A What's this?
+%\toks0={^^A What's this all about?
\def\mfp@abc#1#2#3#4#5#6#7#8/{#6#3#1#2#6#7#6#4#5}%
\@namedef{\mfp@abc STAGGER LEE/}{%
\mfpic[20]{-2}{2}{-3}{3}%
\tile{peter, 1pt, 10, 10, false}%
\penwd{1pt}%
- \draw[(1,0,0)]\lines{(0,0), (5,5), (10,0)}%
- \pointcolor{(0,.8,0)}%
+ \draw[rgb(1,0,0)]\lines{(0,0), (5,5), (10,0)}%
+ \pointcolor{rgb(0,.8,0)}%
\point[3pt]{(2.5,7.5)}%
\endtile
- \draw\tess{peter}\gfill[(1,1,0)]\ellipse{(0,0),2,3}%
+ \draw\tess{peter}\gfill[rgb(1,1,0)]\ellipse{(0,0),2,3}%
\endmfpic}%
%}
%
@@ -4807,6 +4998,8 @@
\newlet\mfpgantt\mfpbarchart
% \end{macrocode}
%
+%
+%
% \section{Implementing the graphics macros}
%
% To keep \cs{mfp@grafmacs} from becoming unweildy, we define here all the
@@ -4845,8 +5038,15 @@
\newdef\mfp@pshcircle#1#2{\mfp@figmac{pshcircle (#1, #2)}}%
% \end{macrocode}
%
-% \cs{mfp@curve} is called by six graphics macros: \cs{curve},
-% \cs{ccurve}, \cs{mfbezier} and their closed variants . Its two arguments
+% The first argument of \cs{mfp@hypergeodesic} is a string that sets the
+% context: \texttt{UD} for the unit disk, \texttt{UHP} for the upper
+% half-plane. The second argument should be the two points to join.
+% \begin{macrocode}
+\newdef\mfp@hypergeodesic#1#2{\mfp@figmac{#1geodesic (#2)}}%
+% \end{macrocode}
+%
+% Six graphics macros call \cs{mfp@curve}: \cs{curve},
+% \cs{convexcurve}, \cs{mfbezier} and their closed variants . Its two arguments
% are the name of a \grafbase{} command, and \mfc{true} or \mfc{false}.
% This works for any \grafbase{} command that creates a smooth path from a
% list of points, provided the command has two versions: one that begins
@@ -5150,7 +5350,7 @@
% the first argument of \cs{mfp@axis} is empty rather than a default.
%
% We use \cs{mfp@getaxis} to check the mandatory argument and return the
-% default head length in \cs{mfp@defheadlen}. It also stores the
+% default head length in \cs{mfp@defaultheadlen}. It also stores the
% letter in \cs{mfp@axisletter}, but returns `\texttt{x}' for an invalid
% one.
%
@@ -5163,9 +5363,10 @@
% would produce. This is slightly more efficient than calling \cs{arrow}.
% \begin{macrocode}
\newdef\mfp@axis#1#2{\mfp@getaxis#2{(none)}\mfp@end\axis
- \mfp@addmac{headpath (\mfp@emptysub{#1}{\mfp@defheadlen}, 0, 0)}%
+ \mfp@addmac{headpath (\mfp@emptysub{#1}{\mfp@defaultheadlen}, 0, 0)}%
\axisline{\mfp@axisletter}}%
-\newdef\mfp@doaxes#1#2{\def\mfp@@axis##1{\mfp@axis{#1}{##1}\mfp@@doaxis}%
+\newdef\mfp@doaxes#1#2{%
+ \def\mfp@@axis##1{\mfp@axis{#1}{##1}\mfp@@doaxis}%
\mfp@@doaxis#2\mfp@end}%
\newdef\mfp@@doaxis{\mfp@ifend{}\mfp@@axis}%
% \end{macrocode}
@@ -5187,7 +5388,6 @@
\newdef\mfp@vectorfield#1#2#3#4#5{%
\mfcmd{#1vectorfield (#2, #3) (#4) (#5)}}%
% \end{macrocode}
-%
% The first argument of both these is the optional size argument of the
% calling commands (\cs{point} and \cs{plotsymbol}). For
% \cs{mfp@plotsymbol} the second argument is the symbol name.
@@ -5234,8 +5434,10 @@
% \end{macrocode}
%
%
+%
% \section{The \env{mfpic} environment}\label{mfpicenv}
%
+%
% \subsection{Initializing the environment}\label{mfpicinitializations}
%
% For mostly historical reasons, the macros that create labels are
@@ -5367,6 +5569,7 @@
\@graphbot 0pt
% \end{macrocode}
%
+%
% \subsection{Initializing the \MF{} picture}
% \label{current}
%
@@ -5377,8 +5580,7 @@
% figure as its only argument. For debugging purposes we write a \MF{}
% comment the contains the line number in the \TeX{} source file where the
% \cs{mfpic} command occurred. We also write a line of dashes
-% (\cs{mfp@d}) to make it easier to find the start of the environment. This
-% may be removed in the public release.
+% (\cs{mfp@d}) to make it easier to find the start of the environment.
%
% When \opt{mplabels} is in effect we need to set the font for the labels
% to the saved \cs{@tcurr} by writing some \mfc{verbatimtex} code. Since
@@ -5396,10 +5598,11 @@
beginmfpic(\number\mfp@count); \mfp@p\space\mfp@lineno.
\mfp@ifmpost
{\@nl verbatimtex \relax
- \bgroup\font\noexpand\MFPcfont=\fontname\@tcurr\relax
+ \MFPbegingroup\font\noexpand\MFPcfont=\fontname\@tcurr\relax
etex;}{}}%
% \end{macrocode}
%
+%
% \subsection{Placing text labels}\label{textlabels}
%
% All the rest of \cs{@mfpic} defines commands that in some way or another
@@ -5467,6 +5670,7 @@
\mfp@restoreOL}%
% \end{macrocode}
%
+%
% \subsection{Surrounding the label with a path}\label{surrounding}
%
% These next macros place labels, but also define a path surrounding the
@@ -5531,6 +5735,7 @@
\mfp@iftoken*{\tlabelellipse*[1]}{\tlabelellipse[1]}}%
% \end{macrocode}
%
+%
% \subsection{Placing multiple text labels}\label{multiple}
%
% One of the more onerous things about labels in \env{mfpic} environments
@@ -5568,6 +5773,7 @@
\newlet\axislabels\mfp@axislabels
% \end{macrocode}
%
+%
% \subsection{Captions}\label{captions}
%
% Captions are not added immediately by the \cs{tcaption} command. That
@@ -5590,6 +5796,8 @@
\every@mfpic}% End of \@mfpic
% \end{macrocode}
%
+%
+%
% \section{Implementing the label and caption macros}
%
% \cs{mfp@setconv} uses the stored arguments of the surrounding
@@ -5608,11 +5816,13 @@
% \begin{macrocode}
\newdef\mfp@setconv{%
\def\@xconv##1##2{% ##1 = coord. ##2 = dimension register or fdim
- {\mfp@scratch=##1\@mfpicunit \advance\mfp@scratch by -\xmin\@mfpicunit
+ {\mfp@scratch=##1\@mfpicunit
+ \advance\mfp@scratch by -\xmin\@mfpicunit
\mfp@scratch=\xfactor\mfp@scratch
\global ##2=\mfp@scratch}}%
\def\@yconv##1##2{% ditto
- {\mfp@scratch=##1\@mfpicunit \advance\mfp@scratch by -\ymin\@mfpicunit
+ {\mfp@scratch=##1\@mfpicunit
+ \advance\mfp@scratch by -\ymin\@mfpicunit
\mfp@scratch=\yfactor\mfp@scratch
\global ##2=\mfp@scratch}}}%
\newdef\mfp@inittlabels{%
@@ -5787,11 +5997,11 @@
% \begin{macrocode}
\@yconv{#2}\mfp@scratch
\begingroup
- \ifcase\tl@vpos \advance\mfp@scratch \tb@totalht % bottom
- \advance\mfp@scratch \tlabel@sep
- \or \advance\mfp@scratch 0.5\tb@totalht % center
- \or \advance\mfp@scratch -\tlabel@sep % top
- \else \advance\mfp@scratch \tb@ht % baseline (default)
+ \ifcase\tl@vpos \advance\mfp@scratch \tb@totalht
+ \advance\mfp@scratch \tlabel@sep % bottom
+ \or \advance\mfp@scratch 0.5\tb@totalht % center
+ \or \advance\mfp@scratch -\tlabel@sep % top
+ \else \advance\mfp@scratch \tb@ht % baseline (default)
\fi
\advance\mfp@scratch \tlabel@vadj
\ifdim \mfp@scratch>\@tlabelstop
@@ -5805,10 +6015,10 @@
% \begin{macrocode}
\begingroup
\ifcase\tl@vpos \advance\mfp@scratch \tlabel@sep % bottom
- \or \advance\mfp@scratch -0.5\tb@totalht % center
- \or \advance\mfp@scratch -\tb@totalht % top
- \advance\mfp@scratch -\tlabel@sep
- \else \advance\mfp@scratch -\tb@dp % baseline (default)
+ \or \advance\mfp@scratch -0.5\tb@totalht % center
+ \or \advance\mfp@scratch -\tb@totalht
+ \advance\mfp@scratch -\tlabel@sep % top
+ \else \advance\mfp@scratch -\tb@dp % baseline (default)
\fi
\advance\mfp@scratch \tlabel@vadj
\ifdim \mfp@scratch<\@tlabelsbot
@@ -6057,6 +6267,8 @@
#1\mfp@scratch}%
% \end{macrocode}
%
+%
+%
% \section{Placing the picture: \cs{endmfpic}}\label{endmfpic}
%
% \DescribeMacro{\endmfpic}
@@ -6072,7 +6284,7 @@
\mfp@DBlog{Definition of closure of mfpic environment.}%
\newdef\endmfpic{\every@endmfpic
\mfsrc{%
- \mfp@ifmpost{\@nl verbatimtex \relax\egroup\space etex;}{}\@nl
+ \mfp@ifmpost{\@nl verbatimtex \relax\MFPendgroup\space etex;}{}\@nl
endmfpic; \mfp@p\space(\number\mfp@count) \mfp@lineno.\@nl
\mfp@p\mfp@d\mfp@d\mfp@d\@nl}%
\ifmfpicdebug\wlog{}\wlog{Mfpic: ENTERED endmfpic.}\wlog{}\fi
@@ -6084,6 +6296,7 @@
\ifmfp@noship \else
% \end{macrocode}
%
+%
% \subsection{Loading and measuring the graphic}\label{loading}
%
% Now we load the graphic. It would be at this point that we could add a
@@ -6167,6 +6380,7 @@
\fi
% \end{macrocode}
%
+%
% \subsection{Adding labels and caption}\label{addlabel}
%
% We now add the boxes \cs{@alltlabels} and \cs{@backtext} onto the graph
@@ -6192,9 +6406,11 @@
\fi
\ifdim\@tlabelsleft < \maxdimen
\setbox\@alltlabels\vtop to 0pt{%
- \kern \mfpiclly bp \moveleft \mfpicllx bp \box\@alltlabels\vss}%
+ \kern \mfpiclly bp
+ \moveleft \mfpicllx bp \box\@alltlabels\vss}%
\setbox\@backtext \vtop to 0pt{%
- \kern \mfpiclly bp \moveleft \mfpicllx bp \box\@backtext \vss}%
+ \kern \mfpiclly bp
+ \moveleft \mfpicllx bp \box\@backtext \vss}%
% \end{macrocode}
% Then we adjust \cs{@tlabelsleft}, etc. for the boundingbox offset.
% The graph dimensions are also adjusted if the tlabel dimensions extend
@@ -6272,6 +6488,7 @@
\global\mfpicwidth\wd\@wholegraph
% \end{macrocode}
%
+%
% \subsection{Placing the graphic}\label{placing}
%
% Add a frame around the box \cs{@wholegraph} in draft mode (so its size
@@ -6337,8 +6554,10 @@
% \end{macrocode}
%
%
+%
% \section{Additional features}\label{additional}
%
+%
% \subsection{Saving a copy of the picture}\label{saving}
%
% \DescribeMacro{\newsavepic}
@@ -6385,6 +6604,7 @@
\newdef\usepic#1{\leavevmode \copy#1\relax}%
% \end{macrocode}
%
+%
% \subsection{Putting a frame around it}\label{frame}
%
% This is essentially code I wrote years ago to have a framing command
@@ -6428,6 +6648,7 @@
\mfp@ifdefined\framed{}{\let\framed\mfpframed}%
% \end{macrocode}
%
+%
% \subsection{Adding \mfc{verbatimtex} to the \file{.mp}
% file}\label{verbatimtex}
%
@@ -6480,6 +6701,7 @@
% \end{macrocode}
%
%
+%
% \section{Finale}\label{finale}
%
% Set the default starting graphic number. We used to start at 0 and
@@ -6510,3 +6732,4 @@
%
%\clearpage
%\Finale
+%\endinput
diff --git a/Master/texmf-dist/source/generic/mfpic/mfpic.ins b/Master/texmf-dist/source/generic/mfpic/mfpic.ins
index 4b04ba5007b..a66d2832236 100644
--- a/Master/texmf-dist/source/generic/mfpic/mfpic.ins
+++ b/Master/texmf-dist/source/generic/mfpic/mfpic.ins
@@ -1,5 +1,5 @@
% File: mfpic.ins
-% A part of mfpic 1.06 2011/03/08
+% A part of mfpic 1.10 2012/12/03
%
\input docstrip
\keepsilent
@@ -7,7 +7,7 @@
-------------------------------------------------------------------
-Copyright 2002--2011, Daniel H. Luecking
+Copyright 2002--2012, Daniel H. Luecking
Mfpic may be distributed and/or modified under the conditions of the
LaTeX Project Public License, either version 1.3c of this license or (at
@@ -30,6 +30,7 @@ endinput.^^J%
\generate{\file{mfpic.tex}{\from{mfpic.dtx}{tex}}
\file{mfpic.sty}{\from{mfpic.dtx}{sty}}
+ \file{mfpicdef.tex}{\from{mfpic.dtx}{defs}}
\usepostamble\zyx
\file{grafbase.mf}{\from{grafbase.dtx}{MF}}
\file{grafbase.mp}{\from{grafbase.dtx}{MP}}
@@ -41,9 +42,9 @@ endinput.^^J%
^^J
^^J To finish the installation:
^^J
-^^J -- Copy the files mfpic.tex and mfpic.sty to a location where
-\sJ TeX and LaTeX will find them. For example, in a TDS compliant
-\sJ system, the directory TEXMF/tex/generic/mfpic/ .
+^^J -- Copy the files mfpic.tex, mfpic.sty and mfppatch.tex to a
+\sJ location where TeX and LaTeX will find them. For example, in a
+\sJ TDS compliant system, the directory TEXMF/tex/generic/mfpic/ .
^^J
^^J -- Copy the file grafbase.mf to a location where Metafont
\sJ will find it, for example TEXMF/metafont/mfpic/ .
diff --git a/Master/texmf-dist/tex/generic/mfpic/mfpic.sty b/Master/texmf-dist/tex/generic/mfpic/mfpic.sty
index 622d081e0ce..bddbccf9b99 100644
--- a/Master/texmf-dist/tex/generic/mfpic/mfpic.sty
+++ b/Master/texmf-dist/tex/generic/mfpic/mfpic.sty
@@ -8,7 +8,7 @@
%%
%% -------------------------------------------------------------------
%%
-%% Copyright 2002--2011, Daniel H. Luecking
+%% Copyright 2002--2012, Daniel H. Luecking
%%
%% Mfpic may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3c of this license or (at
@@ -22,7 +22,7 @@
%% with mfpic: plain TeX, LaTeX, plain Metafont and plain MetaPost.
%%
\ProvidesPackage{mfpic}
- [2011/03/08 v1.06. Macros for drawing with Metafont/MetaPost.]%
+ [2012/12/03 v1.10. Macros for drawing with Metafont/MetaPost.]%
\DeclareOption{draft}{\mfpicdraft}%
\DeclareOption{final}{%
\mfpicfinal\PassOptionsToPackage{final}{graphics}}%
diff --git a/Master/texmf-dist/tex/generic/mfpic/mfpic.tex b/Master/texmf-dist/tex/generic/mfpic/mfpic.tex
index d2596ed2cd9..11f17953070 100644
--- a/Master/texmf-dist/tex/generic/mfpic/mfpic.tex
+++ b/Master/texmf-dist/tex/generic/mfpic/mfpic.tex
@@ -8,7 +8,7 @@
%%
%% -------------------------------------------------------------------
%%
-%% Copyright 2002--2011, Daniel H. Luecking
+%% Copyright 2002--2012, Daniel H. Luecking
%%
%% Mfpic may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3c of this license or (at
@@ -24,9 +24,9 @@
\ifx\mfpfileversion\UndEfInEd\else\expandafter\endinput\fi%
{%
\catcode\lq\.12 \catcode\lq\/12%
- \gdef\mfpfileversion{1.06}%
- \gdef\mfpfiledate{2011/02/25}%
- \gdef\mfpicversion{106}%
+ \gdef\mfpfileversion{1.10}%
+ \gdef\mfpfiledate{2012/12/03}%
+ \gdef\mfpicversion{110}%
}%
\let\mfpsaveplus\+%
\let\+\tabalign%
@@ -37,9 +37,9 @@
\catcode96=12 % 96=left quote
\catcode`\@=11
\gdef\MFPsavecodes{%
- \edef\mfp@restoreNLchar{\newlinechar\number\newlinechar\relax}%
- \edef\mfp@restoreELchar{\endlinechar\number\endlinechar\relax}%
- \edef\mfp@restoreSP{\catcode32=\number\catcode32\relax}%
+ \edef\mfp@restoreNLC{\newlinechar\number\newlinechar\relax}%
+ \edef\mfp@restoreELC{\endlinechar\number\endlinechar\relax}%
+ \edef\mfp@restoreSPA{\catcode32=\number\catcode32\relax}%
\edef\mfp@restoreEOL{\catcode13=\number\catcode13\relax}%
\edef\mfp@restoreALL{\mfp@restorecode{=}\mfp@restorecode{@}%
\mfp@restorecode{$}\mfp@restorecode{:}\mfp@restorecode{;}%
@@ -49,8 +49,8 @@
\mfp@restorecode{>}\mfp@restorecode{*}\mfp@restorecode{/}%
\mfp@restorecode{+}\mfp@restorecode{-}\mfp@restorecode{"}%
\mfp@restorecode{'}\mfp@restorecode{_}\mfp@restorecode{`}%
- \mfp@restoreEOL\mfp@restoreSP\catcode10=\number\catcode10
- \mfp@restoreNLchar\mfp@restoreELchar}}%
+ \mfp@restoreEOL\mfp@restoreSPA\catcode10=\number\catcode10
+ \mfp@restoreNLC\mfp@restoreELC}}%
\gdef\mfp@restorecode#1{\catcode`\string#1=\number\catcode`#1\relax}%
\ifx\@makeother\UndEfInEd \gdef\@makeother#1{\catcode`#1=12\relax}\fi
\gdef\MFPsanitize{\endlinechar13 \newlinechar10
@@ -122,8 +122,14 @@
\mfp@enddef
\newif\ifmfp@latex \mfp@latexfalse
\mfp@ifdefined\documentstyle
- {\ifx \amstexloaded@\relax \mfp@DBlog{AmS-TeX detected.}%
- \else \mfp@DBlog{LaTeX detected.}\mfp@latextrue
+ {\ifx \amstexloaded@\relax % amstex loaded, or a bad check for it
+ \ifx\NoBlackBoxes\UndEfInEd % amstex not loaded
+ \mfp@DBlog{LaTeX detected.}\mfp@latextrue
+ \else % most likely amstex loaded
+ \mfp@DBlog{AmS-TeX detected.}%
+ \fi
+ \else % amstex not loaded
+ \mfp@DBlog{LaTeX detected.}\mfp@latextrue
\fi}%
{\mfp@DBlog{Neither LaTeX nor AmS-TeX detected.}}%
\newif\ifmfp@latexe \mfp@latexefalse
@@ -204,7 +210,7 @@
one of B, b, c or t, followed by^^J%
one of l, r or c, optionally followed by an angle.}}%
\newdef\mfp@untilwarn{%
- \Mfpic@warn{\mfp@b mfploop without \string\mfpuntil!}}%
+ \Mfpic@warn{\mfp@b mfploop without \string\mfpuntil!\@nl}}%
\newlet\ifmfpmpost\iffalse
\newdef\mfp@mposttrue {\global\let\ifmfpmpost\iftrue}%
\newdef\mfp@mpostfalse{\global\let\ifmfpmpost\iffalse}%
@@ -225,7 +231,7 @@
{\mfp@afteropen@error\mfresolution}%
{\mfp@ifmpost{\mfp@noMF@warn\mfresolution}{}}}%
\newdef\setmfvariable#1{%
- \MFP@sp@def\mfp@tempa{#1}\@setmfvariable\mfp@tempa}%
+ \mfp@sp@def\mfp@tempa{#1}\@setmfvariable\mfp@tempa}%
\newdef\@setmfvariable#1#2#3{%
\mfp@ifopengraphsfile%
{\mfcmd{set#1 (#2) #3}}%
@@ -235,7 +241,7 @@
\newdef\setmfpair {\@setmfvariable{pair}}%
\newdef\setmfcolor {\@setmfvariable{color}}%
\newdef\globalsetmfvariable#1#2#3{%
- \MFP@sp@def\mfp@tempa{#1}%
+ \mfp@sp@def\mfp@tempa{#1}%
\mfp@ifopengraphsfile
{\mfcmd{\ifx\mfp@tempa\mfp@C gsetcolor \else gsetvariable (#1) \fi
(#2) #3}}%
@@ -299,7 +305,7 @@
\newlet\ifmfp@readlog\iffalse
\newdef\mfpreadlog{%
\mfp@ifopengraphsfile
- {\mfp@afteropen@error\mfpreadlog}{\global\let\ifmfp@readlog\iftrue}}%
+ {\mfp@afteropen@error\mfpreadlog}{\global\let\ifmfp@readlog\iftrue}}%
\newdef\mfpicllx{0}%
\newdef\mfpiclly{0}%
\newdef\normal@setmfpgraphic#1{%
@@ -307,7 +313,7 @@
\newdef\nofile@setmfpgraphic#1{%
{\edef\mfp@tempa{#1}%
\vbox to 0pt{\vss
- \rlap{\kern2pt \mfpdraftfont \mfp@sanitized\mfp@tempa}\kern 2pt}}}%
+ \rlap{\kern2pt \mfpdraftfont \mfp@sanitized\mfp@tempa}\kern 2pt}}}%
\mfp@ifdefined\strip@prefix{}{\def\strip@prefix#1>{}}%
\newdef\mfp@sanitized{\@xp\strip@prefix\meaning}%
\newlet\@setmfpicgraphic\normal@setmfpgraphic
@@ -389,20 +395,20 @@
\fi
\reserved@c}%
{%
- \def\:{\global\let\@sptoken= }\: % this makes \@sptoken a space token
+ \def\:{\global\let\@sptoken= }\: % makes \@sptoken a space token
\def\:{\@xifnch}\@xp\gdef\: {\futurelet\@let@token\@ifnch}%
}%
\mfp@enddef
\def\mfp@tempa#1{%
- \def\MFP@sp@def##1##2{%
- \futurelet\mfp@next\MFP@sp@d##2\@nil\@nil#1\@nil\relax##1}%
- \def\MFP@sp@d{%
- \ifx\mfp@next\@sptoken \expandafter\MFP@sp@b
- \else \expandafter\MFP@sp@b\expandafter#1%
+ \def\mfp@sp@def##1##2{%
+ \futurelet\mfp@next\mfp@sp@d##2\@nil\@nil#1\@nil\relax##1}%
+ \def\mfp@sp@d{%
+ \ifx\mfp@next\@sptoken \@xp\mfp@sp@b
+ \else \@xp\mfp@sp@b\@xp#1%
\fi}%
- \def\MFP@sp@b#1##1 \@nil{\MFP@sp@c##1}}%
+ \def\mfp@sp@b#1##1 \@nil{\mfp@sp@c##1}}%
\mfp@tempa{ }%
-\def\MFP@sp@c#1\@nil#2\relax#3{\mfp@toks{#1}\edef#3{\the\mfp@toks}}%
+\def\mfp@sp@c#1\@nil#2\relax#3{\mfp@toks{#1}\edef#3{\the\mfp@toks}}%
\def\mfp@iftoken#1#2{\@ifnextchar#1{\@firstoftwo{#2}}}%
\def\mfp@ifstar#1#2#3{\mfp@iftoken*{#1{#2}}{#1{#3}}}%
\def\mfp@ifend{\mfp@iftoken\mfp@end}%
@@ -411,15 +417,15 @@
\def\@ifstar#1{\@ifnextchar*{\@firstoftwo{#1}}}%
\mfp@enddef
{%
- \catcode`Q3 \catcode`\~12
- \gdef\mfp@ifempty#1{\if~#1~\@xp\@firstoftwo\else\@xp\@secondoftwo\fi}%
- \gdef\mfp@ifexist#1{\if~#1~\@xp\@gobble\else\@xp\@firstofone\fi}%
- \gdef\mfp@emptysub#1#2{\if~#1~#2\else#1\fi}%
- \long\gdef\@ifmtarg#1{\@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil}%
- \long\gdef\@xifmtarg#1#2Q#3#4#5\@nil{#4}%
+\catcode`Q3 \catcode`\~12
+\gdef\mfp@ifempty#1{\if~#1~\@xp\@firstoftwo\else\@xp\@secondoftwo\fi}%
+\gdef\mfp@ifexist#1{\if~#1~\@xp\@gobble\else\@xp\@firstofone\fi}%
+\gdef\mfp@emptysub#1#2{\if~#1~#2\else#1\fi}%
+\long\gdef\@ifmtarg#1{\@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil}%
+\long\gdef\@xifmtarg#1#2Q#3#4#5\@nil{#4}%
}%
\newdef\mfp@defaultopt#1#2{%
- \@ifnextchar[{\mfp@ifemptyopt{#1}{#2}}{#1{#2}}}%
+ \@ifnextchar[{\mfp@ifemptyopt{#1}{#2}}{#1{#2}}}%]
\newdef\mfp@ifemptyopt#1#2[#3]{\mfp@ifempty{#3}{#1{#2}}{#1{#3}}}%
\newdef\mfp@nullopt#1{\@ifnextchar[{\mfp@getopt{#1}}{#1{}}}%
\newdef\mfp@getopt#1[#2]{#1{#2}}%
@@ -468,23 +474,9 @@
\newcount\mfp@sequence
\newtoks\mfp@toks
\newtoks\mfp@verbtex
-\newtoks\mfp@commonverbatimtex
\newif\ifmfp@switch
-\begingroup
- \mfp@keeplines\@makeother\#%
- \@makeother\%\global\mfp@commonverbatimtex
- {\gdef\mpxshipout{\afterassignment\middlempxshipout\setbox0=\hbox}%
- \gdef\middlempxshipout{\aftergroup\finishmpxshipout}%
- \gdef\finishmpxshipout{\dimen1=\ht0 \dimen2=\dp0
- \dimen0=\dimen1 \advance\dimen0\dimen2
- \setbox0=\hbox{\hbox{\box0
- \ifnum\dimen0>0 \vrule width1sp height\dimen1 depth\dimen2
- \else \vrule width1sp height1sp depth0sp\relax
- \fi}}%
- \ht0=0pt \dp0=0pt \shipout\hbox{\box0}}%
- \def\MFPtext#1{\vbox{\def\\{\cr}\MFPcfont\everylabel
- \halign{##\hfil\cr#1\crcr}}}%
- }\endgroup%
+\let\MFPbegingroup\begingroup
+\let\MFPendgroup\endgroup
\newdef\mfp@versioninfo{%
\mfp@p\space\mfp@filename.m\mfp@ifmpost{p}{f}, %
generated by Mfpic, v\mfpfileversion\space\mfpfiledate,\@nl
@@ -532,8 +524,8 @@
verbatimtex\@nl
\ifmfp@verbtex \the\mfp@verbtex\@nl \fi
\relax\@nl
- \the\mfp@commonverbatimtex
- \def\noexpand\everylabel{\the\mfp@toks}\@nl
+ \noexpand\input mfpicdef.tex\relax\@nl
+ \def\noexpand\MFPeverylabel{\the\mfp@toks}\@nl
etex;\@nl
\mfp@ifdefined\mfp@settemplate\mfp@settemplate{}%
}%
@@ -597,7 +589,8 @@
{\mfp@msg{}\Mfpic@msg{No value for \string#2\ifin@mfpicenv\space
in mfpic figure \number\mfp@count\fi.\@nl}}%
{}%
- \mfsrc{\@ifmplabels{\@nl verbatimtex #1\def\string#2{#2} etex;\@nl}{}%
+ \mfsrc{%
+ \@ifmplabels{\@nl verbatimtex #1\def\string#2{#2} etex;\@nl}{}%
message "\string\mfpicvalue";\@nl
message "\mfp@cmdname#2";\@nl
show #3;\@nl
@@ -755,7 +748,7 @@
\newdef\colorarray{\setmfarray{color}}%
\newdef\rgbcolorarray{\setmfarray{rgbcolor}}%
\newdef\cmykcolorarray{\setmfarray{cmykcolor}}%
-\newdef\globalsetmfarray#1#2{\mfsrc{gsetarray (#1) (#2)}\mfp@writedata}%
+\newdef\globalsetmfarray#1#2{\mfsrc{gsetarray (#1)(#2)}\mfp@writedata}%
\newlet\globalsetmparray\globalsetmfarray
\newdef\lightershade{\shadespace1.2\shadespace}%
\newdef\darkershade{\shadespace.83333\shadespace}%
@@ -785,7 +778,7 @@
\newdef\mfp@autorend{\if@mfprend\@xp\mfp@render\fi}%
\newdef\mfp@addmac{\mfp@first \mfsrc}%
\newdef\mfp@render{\draw[]}%
-\newdef\setrender#1{\mfp@def\mfp@render{#1}}%
+\newdef\setrender{\mfp@def\mfp@render}%
\newdef\mfp@figmacbase{\mfp@first \mfp@autorend \@mfpstarttrue}%
\newdef\mfp@figmac{\mfp@figmacbase\mfcmd}%
\newdef\mfp@listmac#1{\mfp@figmacbase\mfsrc{#1}\mfp@writedata}%
@@ -904,7 +897,7 @@
\mfp@ifmpost
{\mfp@ifopengraphsfile
{\mfcmd{verbatimtex\@nl
- \def\noexpand\everylabel{\the\mfp@toks} etex}}%
+ \def\noexpand\MFPeverylabel{\the\mfp@toks} etex}}%
{}}%
{}}%
\newdef\every@tlabel{}%
@@ -925,7 +918,8 @@
\newdef\mfp@arc@r{pp (\mfp@T)}%
\newdef\mfp@arc@q{pp (\mfp@F)}%
\newdef\mfpdefinecolor#1#2#3{\setmfcolor{#1}{#2(#3)}}%
-\newdef\mfp@defclr#1#2#3{\setmfcolor{#1}{\mfp@ifempty{#2}{#3}{#2(#3)}}}%
+\newdef\mfp@defclr#1#2#3{%
+ \setmfcolor{#1}{\mfp@ifempty{#2}{#3}{#2(#3)}}}%
\newdef\mfp@newcolorcmd#1{%
\@namedef{#1\mfp@C}{\mfp@nullopt{\mfp@defclr{#1\mfp@C}}}}%
\mfp@newcolorcmd{draw}\mfp@newcolorcmd{fill}\mfp@newcolorcmd{tlabel}%
@@ -971,7 +965,7 @@
the following letters: x, y, l, b, r, or t. If you proceed, ^^J%
x will be assumed.}\def\mfp@axisnum{0}\def\mfp@axisletter{x}}%
{\edef\mfp@axisnum{\@nameuse{mfp@axis@#1}}\def\mfp@axisletter{#1}}%
- \edef\mfp@defheadlen{%
+ \edef\mfp@defaultheadlen{%
\the\ifnum\mfp@axisnum>1 \sideheadlen\else \axisheadlen\fi}}%
\newdef\setaxismarks#1#2{\setmfnumeric{#1tick}{#2}}%
\newdef\setxmarks#1{\setaxismarks x{#1}}%
@@ -1005,9 +999,13 @@
\mfp@figmac{regularpolygon (##1) (##2) (##3; ##4;)}}%
\def\circle{\mfp@switchfalse\mfp@defaultopt\mfp@arccircle{p}}%
\newdef\ellipse{\mfp@defaultopt\mfp@ellipse{0}}%
+ \newdef\quarterellipse##1{\mfp@figmac{quarterellipse (##1)}}%
+ \newdef\halfellipse##1{\mfp@figmac{halfellipse (##1)}}%
+ \newdef\fullellipse##1{\mfp@figmac{fullellipse (##1)}}%
\newdef\sector##1{\mfp@figmac{sector (##1)}}%
\newdef\arc{\mfp@iftoken*{\arccomplement\mfp@arc}{\mfp@arc}}%
\newdef\pshcircle{\mfp@ifstar\mfp@pshcircle\mfp@F\mfp@T}%
+ \newdef\hypergeodesic{\mfp@ifstar\mfp@hypergeodesic{UHP}{UD}}%
\newdef\lines{\mfp@listi{polyline}\mfp@F}%
\newdef\polygon{\mfp@listi{polyline}\mfp@T}%
\newdef\computedspline{\mfp@listi{dospline}\mfp@F}%
@@ -1034,7 +1032,6 @@
\newlet\closedconvexcurve\convexcyclic
\newdef\fcncurve{\mfp@nullopt\mfp@fcncurve}%
\newdef\turtle{\mfp@listmac{turtle}}%
- \newdef\brownianmotion##1{\mfp@figmac{brownianpath (##1)}}%
\newdef\function{\mfp@fcn{function}s}%
\newdef\parafcn{\mfp@fcn{parafcn}s}%
\newdef\plrfcn{\mfp@fcn{plrfcn}s}%
@@ -1045,6 +1042,9 @@
\def\levelcurve{\mfp@fcn{levelset}p}%
\newdef\DEgraph{\mfp@fcn{odeRKIV}s}%
\newdef\DEtrajectory{\mfp@fcn{xyRKIV}s}%
+ \newdef\brownianmotion##1{\mfp@figmac{brownianpath (##1)}}%
+ \newdef\browniangraph##1{\mfp@figmac{browniangraph (##1)}}%
+ \newdef\randomwalk##1{\mfp@figmac{randomwalk(##1)}}%
\newdef\plotdata{\mfp@nullopt\mfp@plotdata}%
\newdef\datafile{\mfp@nullopt\mfp@datafile}%
\newdef\store##1##2{\mfp@rendmac{stored (##1)}##2}%
@@ -1068,7 +1068,8 @@
\newdef\sinewave {\mfp@defaultopt{\mfp@wiggle{sinewave}}1}%
\newdef\coil{\mfp@defaultopt{\mfp@wiggle{corkscrew}}1}%
\newlet\corkscrew\coil
- \newdef\plot{\mfp@optrendii{doplot}{\the\pointsize,\the\symbolspace}}%
+ \newdef\plot{%
+ \mfp@optrendii{doplot}{\the\pointsize,\the\symbolspace}}%
\newdef\plotnodes{\mfp@optrendii{plotnodes}{\the\pointsize}}%
\newdef\showcontrols{\mfp@optrendii{showcontrols}{\the\pointsize}}%
\newdef\bclosed{\mfp@nullopt{\mfp@close b}}%
@@ -1086,24 +1087,29 @@
\newdef\rhatch{\mfp@defaultopt\mfp@rhatch{\the\hatchspace}}%
\newdef\xhatch{\mfp@defaultopt\mfp@xhatch{\the\hatchspace}}%
\newlet\hatch\xhatch
+ \newdef\gradient{\mfp@rendi{axialgradient}}%
+ \newdef\areagradient{\mfp@rendi{areagradient}}%
+ \newdef\radialgradient{\mfp@rendi{radialgradient}}%
\newdef\gfill{\mfp@nullopt{\mfp@clroptrend{filled}}}%
\newdef\gclear{\mfp@rendmac{unfilled}}%
\newdef\gclip{\mfp@rendmac{Clip}}%
- \newdef\reverse{\mfp@addmac{reverse}}%
+ \newdef\reversepath{\mfp@addmac{reverse}}%
+ \newlet\reverse\reversepath
\newdef\xyswappath{\mfp@modmac{xyswappedpath}}%
\newdef\rotatepath{\mfp@modi{rotatedpath}}%
\newdef\shiftpath{\mfp@modi{shiftedpath}}%
\newdef\scalepath{\mfp@modi{scaledpath}}%
\newdef\xscalepath{\mfp@modi{xscaledpath}}%
\newdef\yscalepath{\mfp@modi{yscaledpath}}%
- \newdef\slantpath{\mfp@modi{xslantedpath}}%
- \newlet\xslantpath\slantpath
+ \newdef\xslantpath{\mfp@modi{xslantedpath}}%
+ \newlet\slantpath\xslantpath
\newdef\yslantpath{\mfp@modi{yslantedpath}}%
\newdef\reflectpath{\mfp@modi{reflectedpath}}%
\newdef\transformpath{\mfp@modi{transformedpath}}%
\newdef\parallelpath{\mfp@modi{parapath}}%
\newdef\randomizepath{\mfp@modi{randompath}}%
\newdef\randomlines{\mfp@modi{randomlines}}%
+ \newdef\interpolatepath{\mfp@modi{interpolatedpath}}%
\newdef\arccomplement{\mfp@modmac{arccomplement}}%
\newdef\arrowhead{\mfp@ifstar\mfp@arrowhead\mfp@T\mfp@F}%
\def\arrow{\mfp@ifstar\mfp@arrow{x}{}}%
@@ -1183,17 +1189,18 @@
\newlet\graphbar\chartbar
\newlet\histobar\chartbar
\newlet\ganttbar\chartbar
+ \newdef\gbrace##1{\mfp@figmac{mkbrace(##1)}}%
}% end \mfp@grafmacs
\def\mfp@abc#1#2#3#4#5#6#7#8/{#6#3#1#2#6#7#6#4#5}%
\@namedef{\mfp@abc STAGGER LEE/}{%
\mfpic[20]{-2}{2}{-3}{3}%
\tile{peter, 1pt, 10, 10, false}%
\penwd{1pt}%
- \draw[(1,0,0)]\lines{(0,0), (5,5), (10,0)}%
- \pointcolor{(0,.8,0)}%
+ \draw[rgb(1,0,0)]\lines{(0,0), (5,5), (10,0)}%
+ \pointcolor{rgb(0,.8,0)}%
\point[3pt]{(2.5,7.5)}%
\endtile
- \draw\tess{peter}\gfill[(1,1,0)]\ellipse{(0,0),2,3}%
+ \draw\tess{peter}\gfill[rgb(1,1,0)]\ellipse{(0,0),2,3}%
\endmfpic}%
\newdef\mfppiechart{\mfp@defaultopt\mfp@piechart{c}}%
\newdef\mfpbarchart{\mfp@defaultopt\mfp@barchart{0,1,1}}%
@@ -1210,6 +1217,7 @@
{\mfp@figmac{\arc@or@circle\@nameuse{mfp@arc@#1} (#2)}}}%
\newdef\mfp@ellipse#1#2{\mfp@figmac{ellipse (#2, #1)}}%
\newdef\mfp@pshcircle#1#2{\mfp@figmac{pshcircle (#1, #2)}}%
+\newdef\mfp@hypergeodesic#1#2{\mfp@figmac{#1geodesic (#2)}}%
\newdef\mfp@curve#1#2{\mfp@nullopt{\mfp@@curve{#1}{#2}}}%
\newdef\mfp@@curve#1#2#3{%
\mfp@listmac{\mfp@ifempty{#3}{#1}{t#1 (#3)} (#2)}}%
@@ -1297,9 +1305,10 @@
\mfp@hrotate, \mfp@hlocate)}}%
\newdef\mfp@turn#1#2{\rotatearound{#1}{#2}}%
\newdef\mfp@axis#1#2{\mfp@getaxis#2{(none)}\mfp@end\axis
- \mfp@addmac{headpath (\mfp@emptysub{#1}{\mfp@defheadlen}, 0, 0)}%
+ \mfp@addmac{headpath (\mfp@emptysub{#1}{\mfp@defaultheadlen}, 0, 0)}%
\axisline{\mfp@axisletter}}%
-\newdef\mfp@doaxes#1#2{\def\mfp@@axis##1{\mfp@axis{#1}{##1}\mfp@@doaxis}%
+\newdef\mfp@doaxes#1#2{%
+ \def\mfp@@axis##1{\mfp@axis{#1}{##1}\mfp@@doaxis}%
\mfp@@doaxis#2\mfp@end}%
\newdef\mfp@@doaxis{\mfp@ifend{}\mfp@@axis}%
\newdef\mfp@marks#1#2{\mfsrc{\@nl #1marks (#2)}\mfp@writedata}%
@@ -1366,7 +1375,7 @@
beginmfpic(\number\mfp@count); \mfp@p\space\mfp@lineno.
\mfp@ifmpost
{\@nl verbatimtex \relax
- \bgroup\font\noexpand\MFPcfont=\fontname\@tcurr\relax
+ \MFPbegingroup\font\noexpand\MFPcfont=\fontname\@tcurr\relax
etex;}{}}%
\newdef\tlabel{\mfp@nullopt\mfp@label}%
\newdef\startbacktext{\let\mfp@restoreOL\@empty
@@ -1394,11 +1403,13 @@
\every@mfpic}% End of \@mfpic
\newdef\mfp@setconv{%
\def\@xconv##1##2{% ##1 = coord. ##2 = dimension register or fdim
- {\mfp@scratch=##1\@mfpicunit \advance\mfp@scratch by -\xmin\@mfpicunit
+ {\mfp@scratch=##1\@mfpicunit
+ \advance\mfp@scratch by -\xmin\@mfpicunit
\mfp@scratch=\xfactor\mfp@scratch
\global ##2=\mfp@scratch}}%
\def\@yconv##1##2{% ditto
- {\mfp@scratch=##1\@mfpicunit \advance\mfp@scratch by -\ymin\@mfpicunit
+ {\mfp@scratch=##1\@mfpicunit
+ \advance\mfp@scratch by -\ymin\@mfpicunit
\mfp@scratch=\yfactor\mfp@scratch
\global ##2=\mfp@scratch}}}%
\newdef\mfp@inittlabels{%
@@ -1449,11 +1460,11 @@
\endgroup
\@yconv{#2}\mfp@scratch
\begingroup
- \ifcase\tl@vpos \advance\mfp@scratch \tb@totalht % bottom
- \advance\mfp@scratch \tlabel@sep
- \or \advance\mfp@scratch 0.5\tb@totalht % center
- \or \advance\mfp@scratch -\tlabel@sep % top
- \else \advance\mfp@scratch \tb@ht % baseline (default)
+ \ifcase\tl@vpos \advance\mfp@scratch \tb@totalht
+ \advance\mfp@scratch \tlabel@sep % bottom
+ \or \advance\mfp@scratch 0.5\tb@totalht % center
+ \or \advance\mfp@scratch -\tlabel@sep % top
+ \else \advance\mfp@scratch \tb@ht % baseline (default)
\fi
\advance\mfp@scratch \tlabel@vadj
\ifdim \mfp@scratch>\@tlabelstop
@@ -1463,10 +1474,10 @@
\endgroup
\begingroup
\ifcase\tl@vpos \advance\mfp@scratch \tlabel@sep % bottom
- \or \advance\mfp@scratch -0.5\tb@totalht % center
- \or \advance\mfp@scratch -\tb@totalht % top
- \advance\mfp@scratch -\tlabel@sep
- \else \advance\mfp@scratch -\tb@dp % baseline (default)
+ \or \advance\mfp@scratch -0.5\tb@totalht % center
+ \or \advance\mfp@scratch -\tb@totalht
+ \advance\mfp@scratch -\tlabel@sep % top
+ \else \advance\mfp@scratch -\tb@dp % baseline (default)
\fi
\advance\mfp@scratch \tlabel@vadj
\ifdim \mfp@scratch<\@tlabelsbot
@@ -1570,7 +1581,7 @@
\mfp@DBlog{Definition of closure of mfpic environment.}%
\newdef\endmfpic{\every@endmfpic
\mfsrc{%
- \mfp@ifmpost{\@nl verbatimtex \relax\egroup\space etex;}{}\@nl
+ \mfp@ifmpost{\@nl verbatimtex \relax\MFPendgroup\space etex;}{}\@nl
endmfpic; \mfp@p\space(\number\mfp@count) \mfp@lineno.\@nl
\mfp@p\mfp@d\mfp@d\mfp@d\@nl}%
\ifmfpicdebug\wlog{}\wlog{Mfpic: ENTERED endmfpic.}\wlog{}\fi
@@ -1627,9 +1638,11 @@
\fi
\ifdim\@tlabelsleft < \maxdimen
\setbox\@alltlabels\vtop to 0pt{%
- \kern \mfpiclly bp \moveleft \mfpicllx bp \box\@alltlabels\vss}%
+ \kern \mfpiclly bp
+ \moveleft \mfpicllx bp \box\@alltlabels\vss}%
\setbox\@backtext \vtop to 0pt{%
- \kern \mfpiclly bp \moveleft \mfpicllx bp \box\@backtext \vss}%
+ \kern \mfpiclly bp
+ \moveleft \mfpicllx bp \box\@backtext \vss}%
\mfp@adjustdim\@tlabelsleft <\@graphleft \mfpicllx
\mfp@adjustdim\@tlabelstop >\@graphtop \mfpiclly
\mfp@adjustdim\@tlabelsbot <\@graphbot \mfpiclly
diff --git a/Master/texmf-dist/tex/generic/mfpic/mfpicdef.tex b/Master/texmf-dist/tex/generic/mfpic/mfpicdef.tex
new file mode 100644
index 00000000000..96d7d8d8cc5
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/mfpic/mfpicdef.tex
@@ -0,0 +1,39 @@
+%%
+%% This is file `mfpicdef.tex',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% mfpic.dtx (with options: `defs')
+%%
+%% -------------------------------------------------------------------
+%%
+%% Copyright 2002--2012, Daniel H. Luecking
+%%
+%% Mfpic may be distributed and/or modified under the conditions of the
+%% LaTeX Project Public License, either version 1.3c of this license or (at
+%% your option) any later version. The latest version of this license is in
+%% <http://www.latex-project.org/lppl.txt>
+%% and version 1.3c or later is part of all distributions of LaTeX version
+%% 2008/12/01 or later.
+%%
+%% Mfpic has maintenance status "author-maintained". The Current Maintainer
+%% is Daniel H. Luecking. There are several Base Interpreters associated
+%% with mfpic: plain TeX, LaTeX, plain Metafont and plain MetaPost.
+%%
+\gdef\mpxshipout{\afterassignment\middlempxshipout\setbox0=\hbox}%
+\gdef\middlempxshipout{\aftergroup\finishmpxshipout}%
+\gdef\finishmpxshipout{\dimen1=\ht0 \dimen2=\dp0
+ \dimen0=\dimen1 \advance\dimen0\dimen2
+ \setbox0=\hbox{\hbox{\box0
+ \ifnum\dimen0>0 \vrule width1sp height\dimen1 depth\dimen2
+ \else \vrule width1sp height1sp depth0sp\relax
+ \fi}}%
+ \ht0=0pt \dp0=0pt \shipout\hbox{\box0}}%
+\def\MFPtext#1{\vbox{\def\\{\cr}\MFPcfont\MFPeverylabel
+ \halign{##\hfil\cr#1\crcr}}}%
+\let\MFPbegingroup\begingroup
+\let\MFPendgroup\endgroup
+\endinput
+%%
+%% End of file `mfpicdef.tex'.