summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/generic/mfpic/mfpic.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/generic/mfpic/mfpic.dtx')
-rw-r--r--Master/texmf-dist/source/generic/mfpic/mfpic.dtx525
1 files changed, 374 insertions, 151 deletions
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