%%
%% This is file `mfpic.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% mfpic.dtx  (with options: `tex')
%% 
%% -------------------------------------------------------------------
%% 
%% Copyright 2002--2003, Daniel H. Luecking
%% 
%% Mfpic consists of the 3 files mfpic.dtx, grafbase.dtx and mfpic.ins
%% and the 5 files they generate: mfpic.tex, mfpic.sty, grafbase.mf,
%% grafbase.mp, and dvipsnam.mp.
%% 
%% Documentation, examples, and ancillary files are separate. See
%% readme.1st for a complete list.
%% 
%% Mfpic may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.2 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.2 or later is part of all distributions of LaTeX version
%% 1999/12/01 or later.
%% 
%% With respect to the proposed draft LPPL-1.3: mfpic has maintenance
%% status "maintained". The Current Maintainer is Daniel H. Luecking. There
%% are several Base Interpreters: TeX, LaTeX, MetaPost and Metafont.
%% 
{\catcode\lq\.12 \catcode\lq\/12%
\gdef\mfpfileversion{0.7a beta}%
\gdef\mfpfiledate{2004/04/16}%
\gdef\mfpicversion{70}}%
\ifx\MFPicpackagE\UndEfInEd\else\expandafter\endinput\fi%
\let\mfpsaveplus\+%
\let\+\tabalign%
\edef\MFPrestoreequal{\catcode61\space\the\catcode61\relax}%
\catcode61 12\relax%
\edef\MFPrestorespace{\catcode32=\the\catcode32\relax}%
\catcode32=10\relax%
\edef\MFPrestoreEOL{\catcode13=\the\catcode13\relax}%
\catcode13=5\relax
\edef\MFPrestorelq{\catcode96=\the\catcode96\relax}%
\catcode96=12
\def\MFPrestorecode#1{\catcode`\string#1=\the\catcode`#1\relax}%
\edef\MFPicpackagE{%
  \MFPrestorecode{@}\MFPrestorecode{-}%
  \MFPrestorecode{:}\MFPrestorecode{;}%
  \MFPrestorecode{.}\MFPrestorecode{,}%
  \MFPrestorecode{!}\MFPrestorecode{?}%
  \MFPrestorecode{(}\MFPrestorecode{)}%
  \MFPrestorecode{[}\MFPrestorecode{]}%
  \MFPrestorecode{'}\MFPrestorecode{/}%
  \MFPrestorecode{"}\MFPrestorecode{*}%
  \MFPrestorecode{$}\MFPrestorecode{+}%
  \MFPrestorecode{_}\MFPrestorecode{>}%
  \MFPrestorecode{<}\MFPrestorecode{~}%
  \MFPrestorelq\MFPrestoreEOL\MFPrestorespace
  \MFPrestoreequal\catcode 10=\number\catcode10}%
\catcode`\@=11
\ifx\@makeother\UndEfInEd \def\@makeother#1{\catcode`#1=12\relax}\fi
\def\mfp@sanitize{%
\catcode10=12\catcode13=5\catcode`\$=3\catcode`\ =10
\@makeother\:\@makeother\;\@makeother\.\@makeother\,%
\@makeother\!\@makeother\?\@makeother\(\@makeother\)%
\@makeother\[\@makeother\]%
\@makeother\'\@makeother\/\@makeother\"\@makeother\*%
\@makeother\_\@makeother\`\@makeother\+\@makeother\=%
\@makeother\>\@makeother\<\@makeother\~\@makeother\-}%
\mfp@sanitize
\edef\restorenewlinechar{\newlinechar=\number\newlinechar\relax}%
\chardef\mfp@ctrlJ10 \chardef\mfp@ctrlM13
\newlinechar\mfp@ctrlJ\def\@nl{^^J}%
\newif\ifmfpicdebug
\ifx\mfpicdebug\UndEfInEd \mfpicdebugfalse
\else \mfpicdebugtrue
\fi
\def\mfp@DBlog#1{%
  \ifmfpicdebug{\let\@msgbreak\mfp@errbrk\wlog{Mfpic debug: #1}}\fi}%
\def\mfp@msg#1{{\newlinechar\mfp@ctrlJ\immediate\write16{#1}}}%
\def\@msgbreak{^^J}%
\def\mfp@spaces{\space\space\space\space\space\space}%
\def\mfp@msgbrk{^^J\mfp@spaces\space}%
\def\mfp@errbrk{\mfp@msgbrk\mfp@spaces}%
\def\mfp@warnbrk{\mfp@errbrk\space\space}%
\def\Mfpic@msg#1{{\let\@msgbreak=\mfp@msgbrk
  \mfp@msg{Mfpic: #1 }}}%
\def\Mfpic@warn#1{{\let\@msgbreak=\mfp@warnbrk
  \mfp@msg{^^JMfpic warning: #1}}}%
\def\mfp@errmsg#1#2{{\newlinechar\mfp@ctrlJ
   \let\@msgbreak\mfp@errbrk
   \errhelp{#2}\errmessage{Mfpic error: #1}}}%
\def\@online{ on line \number\inputlineno}%
\def\@mfplineno{line \number\inputlineno\space in TeX source}%
\ifx\@firstoftwo\UndEfInEd \long\def\@firstoftwo#1#2{#1}\fi
\ifx\@secondoftwo\UndEfInEd \long\def\@secondoftwo#1#2{#2}\fi
\let\@xp\expandafter
\def\@XP{\@xp\@xp\@xp}%
\def\mfp@ifdefined#1{%
  \ifx#1\UndEfInEd \@xp\@secondoftwo
  \else\ifx#1\relax \@XP\@secondoftwo
  \else \@XP\@firstoftwo
  \fi\fi}%
\mfp@ifdefined\@firstofone{}{\long\def\@firstofone#1{#1}}%
\newif\if@mfp@latex \@mfp@latexfalse
\mfp@ifdefined\documentstyle
 {{\def\x{AmS-TeX}%
  \ifx \fmtname\x \mfp@DBlog{AmS-TeX detected.}%
  \else
    \global\@mfp@latextrue \mfp@DBlog{LaTeX detected.}%
  \fi}}%
 {\mfp@DBlog{Neither LaTeX2e nor LaTeX209 nor AmS-TeX.}}%
\newif\if@mfp@latexe \@mfp@latexefalse
\mfp@ifdefined\documentclass
 {\@mfp@latexetrue \mfp@DBlog{LaTeX2e detected.}}%
 {\mfp@DBlog{Not LaTeX2e.}}%
\newif\if@mfp@pdf \@mfp@pdffalse
\mfp@ifdefined\pdfoutput
 {\mfp@DBlog{PdfTeX detected...}%
  \ifcase\pdfoutput
    \mfp@DBlog{...with dvi output.}%
  \else
    \@mfp@pdftrue \mfp@DBlog{...with PDF output.}%
  \fi}%
 {\mfp@DBlog{Not pdfTeX.}}%
\if@mfp@latex \else \let\@@par\endgraf \fi
\def\mfp@restorepar{\let\par\@@par}%
\if@mfp@latex\else
  \def\@namedef#1{\@xp\def\csname #1\endcsname}%
  \def\@nameuse#1{\csname #1\endcsname}%
\fi
\mfp@ifdefined\@bsphack{}%
 {\@nameuse{newskip}\@savsk
  \@nameuse{newcount}\@savsf
  \def\@bsphack{\relax
    \ifhmode \@savsk\lastskip \@savsf\spacefactor \fi}%
  \def\@esphack{\relax
    \ifhmode \spacefactor\@savsf
    \ifdim\@savsk>\z@ \ignorespaces
    \fi\fi}}%
\mfp@DBlog{Defining test for previous definitions of macros.}%
\mfp@ifdefined\mfp@testdef
  {\Mfpic@warn{%
    Hey!  How can \string\mfp@testdef\space already be defined? %
    \@msgbreak I'll redefine it anyway!}}%
  {}%
\def\mfp@testdef#1{%
  \ifx#1\UndEfInEd
  \else\ifx#1\relax
    \Mfpic@warn{\string #1 was previouly defined to be \string\relax.}%
  \else
    \Mfpic@warn{\string #1 is already defined!}%
  \fi\fi}%
\mfp@testdef\newdef
\mfp@testdef\newlet
\def\newdef#1{\mfp@testdef#1\def#1}%
\newdef\newlet#1{\mfp@testdef#1\let#1}%
\global\let\ifmfpmpost\iffalse
\newdef\mfp@mposttrue {\global\let\ifmfpmpost\iftrue}%
\newdef\mfp@mpostfalse{\global\let\ifmfpmpost\iffalse}%
\newdef\mfp@ifmpost{%
  \ifmfpmpost\@xp\@firstoftwo\else\@xp\@secondoftwo\fi}%
\newdef\usemetafont{\mfp@mpostfalse
  \def\preparemfpicgraphic##1{}%
  \def\setmfpicgraphic##1{\@graphfont\char\mfp@count}%
  \def\getmfpicoffset##1{}}%
\newdef\MPtoolate@error{%
  \mfp@errmsg {Command \string\usemetapost\space too late.}%
   {It is too late to select the metapost option.^^J%
    It must be selected before the \opengraphsfile command.^^J%
    If you proceed, the metafont option will be assumed.}}%
\newdef\@ifmfpfileisopen{\mfp@ifdefined\mfp@filename}%
\newdef\setmfvariable#1#2#3{%
  \@ifmfpfileisopen{\mfcmd{setvariable (#1) (#2) (#3)}}{}}%
\newlet\setmpvariable\setmfvariable
\newdef\setmfboolean#1#2{\setmfvariable{boolean}{#1}{#2}}%
\newdef\setmfnumeric#1#2{\setmfvariable{numeric}{#1}{#2}}%
\newdef\setmfcolor#1#2{\setmfvariable{color}{#1}{#2}}%
\let\ifin@mfpicenv\iffalse
\newdef\mfp@local{\relax\ifin@mfpicenv\else\global\fi}%
\newdef\mf@T{true}%
\newdef\mf@F{false}%
\newdef\mfp@let{\mfp@local\let}%
\newdef\mfp@def{\mfp@local\def}%
\newdef\usecenteredcaptions{\mfp@let\if@mfp@centcapt\iftrue}%
\newdef\nocenteredcaptions {\mfp@let\if@mfp@centcapt\iffalse}%
\nocenteredcaptions
\newdef\mfp@makeoption#1#2#3#4{%
  \newdef#1{\mfp@let#3\iftrue\setmfboolean{#4}\mf@T}%
  \newdef#2{\mfp@let#3\iffalse\setmfboolean{#4}\mf@F}
  #2}%
\mfp@makeoption\clipmfpic\noclipmfpic\if@mfp@clip{clipall}%
\mfp@makeoption\usetruebbox\notruebbox\if@mfp@truebbox{truebbox}%
\newdef\noMP@error#1{%
  \mfp@errmsg {Metafont does not support #1, use MetaPost.}%
   {Metafont doesn't support #1. Perhaps you forgot to turn on^^J%
    MetaPost support by using the metapost option or issuing the^^J%
    command \usemetapost. For now, I will ignore it.}}%
\newdef\usemplabels{\mfp@let\if@mfp@mplabels\iftrue
  \@ifmfpfileisopen
   {\mfp@ifmpost{}%
     {\noMP@error{mplabels}\global\let\if@mfp@mplabels\iffalse}}{}}%
\newdef\nomplabels{\mfp@let\if@mfp@mplabels\iffalse}%
\newdef\@ifmplabels{%
  \if@mfp@mplabels\@xp\@firstoftwo\else\@xp\@secondoftwo\fi}%
\nomplabels
\mfp@makeoption%
  \overlaylabels\nooverlaylabels\if@mfp@overlabels{overlaylabels}%
\mfp@makeoption%
  \clearsymbols\noclearsymbols\if@mfp@clearsym{clearsymbols}%
\def\mfpicllx{0}%
\def\mfpiclly{0}%
\newdef\@setmfpicgraphic#1{%
  \preparemfpicgraphic{#1}\setmfpicgraphic{#1}\getmfpicoffset{#1}}%
\usemetafont
\newdef\setfilename#1#2{#1.#2}%
\newif\ifmfpicdraft
\newif\if@mfp@draft
\newif\if@mfp@final
\newif\if@mfp@nowrite
\newdef\mfpicdraft{%
  \@ifmfpfileisopen{\global\mfpicdrafttrue}%
   {\global\@mfp@drafttrue}}%
\newdef\mfpicfinal{%
  \@ifmfpfileisopen{\global\mfpicdraftfalse}%
    {\global\@mfp@finaltrue}}%
\newdef\mfpicnowrite{%
  \@ifmfpfileisopen
   {\mfp@errmsg
     {Improper use of command \string\mfpicnowrite\@online.}%
     {You must issue the command \mfpicnowrite prior to
        \opengraphsfile. It will be ignored now.}}%
   {\global\@mfp@nowritetrue}}%
\if@mfp@latexe
  \ProvidesPackage{mfpic}[2004/04/16 v0.7a beta.]%
  \DeclareOption{draft}{\mfpicdraft}%
  \DeclareOption{final}{\mfpicfinal}%
  \DeclareOption{nowrite}{\mfpicnowrite}%
  \DeclareOption{metapost}{\mfp@mposttrue}%
  \DeclareOption{metafont}{\usemetafont}%
  \DeclareOption{centeredcaptions}{\usecenteredcaptions}%
  \DeclareOption{clip}{\clipmfpic}%
  \DeclareOption{truebbox}{\usetruebbox}%
  \DeclareOption{mplabels}{\usemplabels}%
  \DeclareOption{overlaylabels}{\overlaylabels}%
  \DeclareOption{clearsymbols}{\clearsymbols}%
  \DeclareOption{debug}{\mfpicdebugtrue}%
  \DeclareOption*{%
    \@ifpackageloaded{graphics}%
     {\Mfpic@warn{Unrecognized option \CurrentOption.}}%
     {\Mfpic@msg{Passing option \CurrentOption\space to %
      graphics package.}%
      \PassOptionsToPackage{\CurrentOption}{graphics}}}%
  \InputIfFileExists{mfpic.cfg}{}{}%
  \ProcessOptions*\relax
  \def\usemetapost{%
    \@ifmfpfileisopen{\mfp@mpostfalse\MPtoolate@error}%
     {\mfp@mposttrue \RequirePackage{graphics}%
      \global\let\mfp@save@parse@bb\Gread@parse@bb
      \gdef\mfp@parse@bb##1 ##2 ##3 ##4 ##5\\{%
        \mfp@save@parse@bb##1 ##2 ##3 ##4 ##5\\%
        \xdef\mfpicllx{\Gin@llx}\xdef\mfpiclly{\Gin@lly}}%
      \if@mfp@pdf \gdef\mfp@Gtype{mps}%
      \else       \gdef\mfp@Gtype{eps}%
      \fi
      \gdef\preparemfpicgraphic##1{%
        \let\Gread@parse@bb\mfp@parse@bb}%
      \gdef\getmfpicoffset##1{}%
      \gdef\setmfpicgraphic##1{\includegraphics{##1}}}}%
  \mfp@ifmpost{\usemetapost}{}%
  \AtEndDocument{\@closegraphsfile}%
\else
  \Mfpic@msg{\mfpfiledate\space v\mfpfileversion.}%
  \if@mfp@pdf
    \def\usemetapost{%
      \@ifmfpfileisopen{\mfp@mpostfalse\MPtoolate@error}%
       {\mfp@mposttrue
        \mfp@ifdefined\convertMPtoPDF{}{\input supp-pdf\relax}%
        \gdef\setmfpicgraphic##1{\convertMPtoPDF{##1}{1}{1}}%
        \gdef\getmfpicoffset##1{%
          \xdef\mfpicllx{\MPllx}\xdef\mfpiclly{\MPlly}}}}%
  \else
    \def\usemetapost{%
      \@ifmfpfileisopen{\mfp@mpostfalse\MPtoolate@error}%
       {\mfp@mposttrue
        \mfp@ifdefined\epsfbox {}{\input epsf\relax}%
        \gdef\setmfpicgraphic##1{\epsfbox{##1}}%
        \gdef\getmfpicoffset##1{%
          \xdef\mfpicllx{\epsfllx}\xdef\mfpiclly{\epsflly}}}}%
  \fi
\fi
\mfp@DBlog{Handlers for optional parameters.}%
\long\def\mfp@ifnextchar#1#2#3{%
  \let\mfptmp@d=#1\def\mfptmp@a{#2}%
  \def\mfptmp@b{#3}\mfp@checknext}%
\def\mfp@checknext{\futurelet\@let@token\mfp@ifnch}%
\def\mfp@ifnch{%
  \ifx\@let@token\@sptoken
    \let\mfptmp@c\eatspace@checknext
  \else\ifx\@let@token\relax
    \long\def\mfptmp@c##1{\mfp@checknext}%
  \else\ifx\@let@token\mfptmp@d
    \let\mfptmp@c\mfptmp@a
  \else
    \let\mfptmp@c\mfptmp@b
  \fi\fi\fi\mfptmp@c}%
\begingroup
  \def\:{\global\let\@sptoken= }\: %
  \def\:{\eatspace@checknext}\@xp\gdef\: {\mfp@checknext}%
\endgroup
\newdef\mfp@ifempty#1{%
  \if~#1~\@xp\@firstoftwo\else\@xp\@secondoftwo\fi}%
\begingroup
\catcode`Q=3
\long\gdef\@ifmtarg#1{\@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil}%
\long\gdef\@xifmtarg#1#2Q#3#4#5\@nil{#4}%
\endgroup
\newdef\@ifmtsub#1#2{\@ifmtarg{#1}{#2}{#1}}%
\newdef\mfp@mtsub#1#2{\mfp@ifempty{#1}{#2}{#1}}%
\newdef\do@ptparam#1#2{\mfp@ifnextchar[{#1}{#1[#2]}}%
\newdef\simple@opt#1#2{%
  \mfp@ifnextchar[{\process@opt{#1}{#2}}{#1{#2}}}%
\newdef\process@opt#1#2[#3]{%
  \mfp@ifempty{#3}{#1{#2}}{#1{#3}}}%
\newdef\null@opt#1{\mfp@ifnextchar[{#1}{#1[]}}%
\newdef\do@mtparam#1#2#3{\mfp@ifempty{#1}{#3[#2]}{#3[#1]}}%
\mfp@DBlog{Direct output to Metafont/Post file.}%
\begingroup
  \catcode\mfp@ctrlM\active%
  \gdef\@activectrlM{^^M}%
  \gdef\mfpicobeylines{\catcode\mfp@ctrlM\active\let^^M\relax}%
\endgroup
\newdef\preservelines{\newlinechar\mfp@ctrlM
  \endlinechar\newlinechar \mfpicobeylines}%
\newdef\unpreservelines{\catcode\mfp@ctrlM=5 }%
\newdef\mfsrc {\@mfwrite\@mfsrc\mfsrc}%
\newdef\mfcmd {\@mfwrite\@mfcmd}%
\newdef\mflist{\@mfwrite\@mflist}%
\newdef\@mfwrite{\begingroup
  \preservelines \let\@nl\@activectrlM}%
\newdef\@mfsrc#1#2{%
  \@ifmfpfileisopen{\immediate\write\mfp@out{#2}}%
   {\nooutputfileerror{#1}}\endgroup}%
\newdef\@mfcmd#1{\@mfsrc\mfcmd{#1;}}%
\newdef\@mflist#1{\@mfsrc\mflist{(#1);}}%
\newdef\mfp@gobble#1{}%
\edef\mf@p{\@xp\mfp@gobble\string\%}%   percent (%)
\edef\mf@s{\@xp\mfp@gobble\string\#}%   sharp (#)
\edef\mf@b{\@xp\mfp@gobble\string\\}%   backslash (\)
\newdef\mf@d{--------------}%
\newdef\mfp@delim{%
  \mfp@errmsg {Misplaced \string\mfp@delim.}%
   {If you get this message but did not (mis)use the command^^J%
    \mfp@delim, please report this to the mfpic maintainer.}}%
{\mfp@ifdefined\normalmonth
    {\let\month\normalmonth\let\year\normalyear}{}%
  \xdef\mfp@today{\number\year/\ifnum\month<10 0\fi\number\month/%
    \ifnum\day<10 0\fi\number\day}%
  \count2=\time \divide\count2 by 60
  \xdef\mfp@now{\ifnum\count2<10 0\fi\number\count2:}%
  \multiply\count2 by -60 \advance\count2 \time
  \xdef\mfp@now{\mfp@now\ifnum\count2<10 0\fi\number\count2 }}%
\mfp@DBlog{Declarations used with data and graphs files.}%
\newwrite\mfp@out
\newread\mfp@graph
\newlet\mfp@data\mfp@graph
\newcount\mfp@count
\newcount\mfp@linetype
\newcount\mfp@n
\newcount\mfp@sequence
\newtoks\mfp@toks
\newtoks\every@tlabel
\newtoks\mfp@verbtex
\newtoks\mfp@commonverbatimtex
\every@tlabel{}%
\begingroup
  \let\newtoks\relax
  \@makeother\%\@makeother\#\preservelines
  \global\mfp@commonverbatimtex=
    {\def\MFPtext#1{%
       \vbox{\def\\{\cr}\MFPcfont\everylabel
       \halign{##\hfil\cr#1\crcr}}}%
    }\endgroup
\mfp@DBlog{Macros to open and close graphs files.}%
\newdef\opengraphsfile#1{\@bsphack
  \@ifmfpfileisopen%
   {\Mfpic@warn
     {An attempt has been made to open a graph file, #1,
      \@msgbreak while another, \mfp@filename, is still open.
      \@msgbreak Closing \mfp@filename.}%
    \@closegraphsfile}%
   {}%
  \xdef\mfp@filename{#1}%
  \mfp@ifmpost{%
    \openin\mfp@graph=\setfilename{\mfp@filename}{\number\mfp@count}%
    \relax
    \ifeof\mfp@graph \mfp@msg{}%
      \Mfpic@msg
        {No file \setfilename{\mfp@filename}{\number\mfp@count}.^^J}%
      \global\mfpicdrafttrue
    \else
      \global\mfpicdraftfalse
    \fi
    \if@mfp@nowrite \else
      \immediate\openout\mfp@out=\mfp@filename.mp\relax
      \Mfpic@msg{Don't forget to process \mfp@filename.mp! %
        \@msgbreak (Apply metapost to \mfp@filename.mp.)}%
    \fi
  }{% metafont
    \openin\mfp@graph=\mfp@filename.tfm\relax
    \ifeof\mfp@graph \mfp@msg{}%
      \Mfpic@msg{No file \mfp@filename.tfm .^^J}%
      \global\let\@graphfont=\mfp@dummy
      \global\mfpicdrafttrue
    \else
      \global\font\@graphfont=\mfp@filename\relax
      \global\mfpicdraftfalse
    \fi
    \if@mfp@nowrite \else
      \immediate\openout\mfp@out=\mfp@filename.mf\relax
      \Mfpic@msg{Don't forget to process \mfp@filename.mf! %
        \@msgbreak (Apply metafont to \mfp@filename.mf, %
        then gftopk to the resulting gf file.)}%
    \fi
  }%
  \closein\mfp@graph
  \if@mfp@nowrite\else
    \Mfpic@msg{Then reprocess this file (\jobname).^^J}%
  \fi
  \if@mfp@draft\global\mfpicdrafttrue\fi
  \if@mfp@final\global\mfpicdraftfalse\fi
  \if@mfp@nowrite\gdef\@mfsrc##1##2{}\fi
  \mfsrc{%
    \mf@p\space\mfp@filename.m\mfp@ifmpost{p}{f}, %
      generated by Mfpic, v\mfpfileversion\space\mfpfiledate,\@nl
    \mf@p\space from TeX source "\jobname" %
      on \mfp@today\space at \mfp@now\@nl
    numeric mfpicversion; mfpicversion:=\mfpicversion;\@nl
    if unknown mode: mode := localfont; fi\@nl
    if unknown mag: mag := \number\mag/1000; fi\@nl
    if unknown grafbase: input grafbase; fi\@nl\@nl
    if unknown grafbaseversion: grafbaseversion := 0; fi\@nl
    if grafbaseversion <> mfpicversion :\@nl
       GBmsg "Bad mfpic installation: mfpic and grafbase %
         versions do not match.";\@nl
    fi\@nl}%
  \mfp@ifmpost
   {\mfsrc{%
      if unknown Apricot: input dvipsnam.mp; fi\@nl
      verbatimtex\@nl
        \the\mfp@commonverbatimtex\@nl
        \def\noexpand\everylabel{\the\every@tlabel}\@nl
        \if@mfp@verbtex \the\mfp@verbtex\@nl \fi
      etex;\@nl}%
    \global\@mfp@verbtexfalse\mfp@verbtex{}%
    \@ifmplabels{\usemplabels}{}%
    \if@mfp@truebbox \usetruebbox \fi
    \if@mfp@overlabels \overlaylabels \fi}{}%
  \if@mfp@clip \clipmfpic \fi
  \if@mfp@clearsym \clearsymbols \fi
  \if@shipping\else\stopshipping\fi
  \@esphack}%
\newdef\closegraphsfile{%
  \@ifmfpfileisopen{}{\nooutputfileerror\closegraphsfile}%
  \@closegraphsfile \global\let\mfp@filename\UndEfInEd}%
\newdef\@closegraphsfile{%
  \@ifmfpfileisopen
   {\if@mfp@nowrite \else
      \mfsrc{\@nl end.}\immediate\closeout\mfp@out
    \fi}{}}%
\def\nooutputfileerror#1{%
  \mfp@errmsg {No output file has been opened.}%
   {You have tried to used a command, #1, that requires an output^^J%
    file to be opened with the \opengraphsfile command, which^^J%
    was either not issued or was not successful.}}%
\mfp@DBlog{Using dummy font's dimensions, to spare TeX registers.}%
\font\mfp@dummy=dummy scaled 1042
\fontdimen100\mfp@dummy=0pt
\newcount\mfp@fdc
\mfp@fdc=22
\newdef\newfdim#1{%
  \global\advance\mfp@fdc 1
  \xdef#1{\fontdimen\number\mfp@fdc\mfp@dummy}%
  \wlog{\string#1=\string\fontdimen\number\mfp@fdc\mfp@dummy}}%
\mfp@DBlog{A box register for whole labeled graph, %
    and a temporary one.}%
\newbox\@wholegraph
\newbox\@textbox
\newdef\tb@ht{\ht\@textbox}% height,
\newdef\tb@dp{\dp\@textbox}% depth and
\newdef\tb@wd{\wd\@textbox}% width of the text label.
\newbox\@alltlabels
\newfdim\@tlabelstop
\newfdim\@tlabelsbot
\newfdim\@tlabelsleft
\newfdim\@tlabelsright
\mfp@DBlog{Internal dimension parameters for graph dimensions...}%
\newfdim\@graphwd
\newfdim\@graphright
\newfdim\@graphleft
\newfdim\@graphtop
\newfdim\@graphbot
\mfp@DBlog{...and dimension parameters for tlabel positioning.}%
\newfdim\tb@raise
\newfdim\tb@moveright
\newfdim\tb@totalht
\newfdim\tlabel@hadj
\newfdim\tlabel@vadj
\newfdim\tlabel@sep
\tlabel@hadj=0pt
\tlabel@vadj=0pt
\tlabel@sep=0pt
\mfp@DBlog{User level dimension parameters, with default settings.}%
\newfdim\mfpicunit     % unit of length
\newfdim\pointsize     % diameter of circle
\newfdim\shadespace    % spacing of shade dots
\newfdim\polkadotspace % spacing of polkadots
\newfdim\hatchspace    % spacing of lines
\newfdim\headlen       % size of arrowhead (\arrow)
\newfdim\axisheadlen   % size of arrowhead (x, y axes)
\newfdim\sideheadlen   % size of arrowhead (border axes)
\newfdim\hashlen       % length of marks on axes
\newfdim\dashlen       % length of dashes (\dashed)
\newfdim\dashspace     %   space between dashes
\newfdim\dotsize       % size of dots (\dotted)
\newfdim\dotspace      %   space between dots
\newfdim\symbolspace   % space between symbols (\plot)
\mfpicunit=1pt
\pointsize=2pt
\shadespace=1pt
\polkadotspace=10pt
\hatchspace=3pt
\headlen=3pt
\axisheadlen=5pt
\sideheadlen=0pt
\hashlen=4pt
\dashlen=4pt
\dashspace=4pt
\dotsize=0.5pt
\dotspace=3pt
\symbolspace=5pt
\newdef\save@mfpicdimens{%
  \edef\restore@mfpicdimens{%
    \mfpicunit =\the\mfpicunit
    \pointsize =\the\pointsize
   \shadespace =\the\shadespace
\polkadotspace =\the\polkadotspace
   \hatchspace =\the\hatchspace
      \headlen =\the\headlen
  \axisheadlen =\the\axisheadlen
  \sideheadlen =\the\sideheadlen
      \hashlen =\the\hashlen
      \dashlen =\the\dashlen
    \dashspace =\the\dashspace
      \dotsize =\the\dotsize
     \dotspace =\the\dotspace
  \symbolspace =\the\symbolspace
  \tlabel@hadj =\the\tlabel@hadj
  \tlabel@vadj =\the\tlabel@vadj
   \tlabel@sep =\the\tlabel@sep}}%
\newdimen\mfp@scratch
\newdimen\mfp@scratchB
\newdimen\mfpframesep
\newdimen\mfpframethickness
\newdimen\mfpicheight
\newdimen\mfpicwidth
\newskip\mfpiccaptionskip
\mfpframethickness0.4pt
\mfpframesep2pt
\mfpiccaptionskip=\medskipamount
\def\mfpicnumber#1{\global\mfp@count=#1\relax}%
\newdef\mfpaddto#1#2{\mfp@scratch=#1pt\advance\mfp@scratch#2pt
  \edef#1{\mfp@strippt\mfp@scratch}}%
\newdef\mfpmultiply#1#2{\mfp@scratch=#1pt \mfp@scratch#2\mfp@scratch
  \edef#1{\mfp@strippt\mfp@scratch}}%
\begingroup
  \@makeother P\@makeother T\lowercase{\gdef\mfp@factor#1PT{#1}}%
\endgroup
\newdef\mfp@strippt{\@xp\mfp@factor\the}%
\newdef\pointdef#1(#2,#3){%
  \@namedef{#1}{(#2,#3)}\@namedef{#1x}{#2}\@namedef{#1y}{#3}}%
\newdef\pairarray#1{%
  \mfcmd{save #1}\mfsrc{textpairs (#1)}\mfp@writedata}%
\newdef\numericarray#1{\mfcmd{save #1; numeric #1; numeric #1[]}%
  \mfsrc{list (#1)}\mfp@writedata}%
\newdef\lightershade{\shadespace=1.2\shadespace}%
\newdef\darkershade{\shadespace=.833333\shadespace}%
\newdef\dashlineset{\dashlen=4pt \dashspace=4pt}%
\newdef\dotlineset{\dashlen=1pt \dashspace=2pt}%
\let\ifpointfill\iftrue
\newdef\pointfilltrue{\mfp@let\ifpointfill\iftrue}%
\newdef\pointfillfalse{\mfp@let\ifpointfill\iffalse}%
\mfp@DBlog{Tests to control multiple prefix commands.}%
\newif\if@startfig\@startfigtrue
\newif\if@imrend\@imrendtrue
\newdef\store@path{\mfsrc{\@nl store (curpath)}}%
\newdef\@firststage{\relax
  \if@startfig \store@path \@imrendtrue \@startfigfalse\fi}%
\newdef\@rendmac{\@firststage \@imrendfalse \mfsrc}%
\newdef\@modmac{\@firststage \mfsrc}%
\newdef\@closmac{\@firststage \if@imrend\@xp\@render\fi \mfsrc}%
\newdef\@render{\draw[]}%
\newdef\setrender#1{\mfp@def\@render{#1}}%
\newdef\@figmacstart{%
  \@firststage \if@imrend\@xp\@render\fi \@startfigtrue}%
\newdef\@figmac{\@figmacstart\mfcmd}%
\newdef\@listmac#1{\@figmacstart\mfsrc{#1}\mfp@writedata}%
\newdef\mfp@writedata{%
  \mfp@ifnextchar\datafile{\mfp@writefile}{\mflist}}%
\newdef\mfp@writefile\datafile#1{\@processdatafile{#1}{\mfp@rwdata}}%
\newif\if@mfpswitch
\newdef\mftitle{\@bsphack\@mfpswitchtrue\mfp@gettoks\mf@title}%
\newdef\tmtitle{\mfp@gettoks\tm@title}%
\newdef\mfp@gettoks#1{\afterassignment#1\mfp@toks=}%
\newdef\tm@title{\@mfpswitchfalse\mf@title
  \wlog{\the\mfp@toks}{\the\mfp@toks}}%
\newdef\mf@title{\mfsrc{}%
  \immediate\write\mfp@out{mftitle "\the\mfp@toks";}%
  \if@mfpswitch\@esphack\fi}%
\newdef\stopshipping{\mfp@let\if@shipping\iffalse
  \@ifmfpfileisopen{\mfcmd{save shipit;def shipit = relax enddef}}{}}%
\newdef\resumeshipping{\mfp@let\if@shipping\iftrue
  \@ifmfpfileisopen{\mfcmd{save shipit;def shipit = shipit_ enddef}}{}}%
\newlet\noship\stopshipping
\resumeshipping
\newdef\@processdatafile#1#2{%
  \openin\mfp@data=#1\relax
  \ifeof\mfp@data \nodatafileerror{#1}%
  \else
    \begingroup
      \mfp@resetwhitespace  \mfp@setcomment
      \skipBlanksandComments
      \ifeof\mfp@data \emptydatafileerror{#1}\else #2\fi
      \global\mfp@n=\mfp@linetype
    \endgroup
    \mfp@linetype=\mfp@n
  \fi
  \closein\mfp@data}%
\newdef\nodatafileerror#1{%
  \mfp@errmsg{No data file: #1 .}%
   {The data file you tried to plot can't be found.}}%
\newdef\emptydatafileerror#1{%
  \mfp@errmsg{Empty data file: #1 .}%
 {The file you tried to plot contains only empty lines and comments.}}%
\newdef\mfp@resetwhitespace{%
  \catcode`\^^M=5 \catcode`\ =10 \catcode`\^^I=10 }%
\mfp@ifdefined\@empty{}{\def\@empty{}}%
\newdef\skipcomments{\read\mfp@data to \mfp@temp
  \ifx\mfp@temp\@empty \@xp\skipcomments\fi}%
\newdef\skipBlanksandComments{\skipcomments
  \ifeof\mfp@data
  \else\ifx\mfp@temp\mfp@par \@XP\skipBlanksandComments
  \fi\fi}%
  \def\mfp@rwdata{\mfp@n=1 \mfp@sequence=1
    \def\sequence{\number\mfp@sequence}%
    \edef\mfp@temp{\mfp@temp\space}%
    \edef\mfp@buffer{(\@xp\parse@data\mfp@temp\mfp@delim}%
    \mfp@rwdataloop}%
  \def\mfp@rwdataloop{%
    \read\mfp@data to \mfp@temp
    \ifx\mfp@temp\mfp@par
      \mfcmd{\mfp@buffer)}%
    \else
      \ifx\mfp@temp\@empty % comment line, read another
      \else
        \edef\mfp@temp{\mfp@temp\space}%
        \advance\mfp@sequence1
        \edef\mfp@buffer{\mfp@buffer\mfp@join}%
        \ifnum\mfp@n<\mfpdataperline\relax
          \advance\mfp@n1
        \else
          \mfsrc{\mfp@buffer}%
          \mfp@n=1
          \def\mfp@buffer{}%
        \fi
        \edef\mfp@buffer{\mfp@buffer
          \@xp\parse@data\mfp@temp\mfp@delim}%
      \fi
      \@xp\mfp@rwdataloop
    \fi}%
\newdef\drawpen#1{\mfcmd{\@nl resizedrawpen (#1)}}%
\newlet\pen=\drawpen \newlet\penwd=\drawpen
\newdef\shadewd#1{\setmfnumeric{shadewd}{#1}}%
\newdef\polkadotwd#1{\setmfnumeric{polkadotwd}{#1}}%
\newdef\hatchwd#1{\setmfnumeric{hatchwd}{#1}%
  \setmfvariable{pen}{hatchpen}{pencircle scaled hatchwd}}%
\newdef\dashpattern#1#2{\mfcmd{save #1; dashpat (#1) (#2)}}%
\newdef\settension#1{\setmfnumeric{default_tension}{#1}}%
\newcount\tl@vpos \newcount\tl@hpos
\tl@vpos=-1 \tl@hpos=-1
\newdef\tlabel@rot{}%
\newdef\tlabeljustify#1{%
  \mfp@ifempty{#1}{}{\mfp@justify#1\mfp@delim}}%
\def\mfp@justify#1#2\mfp@delim{\mfp@local\mfp@vconv{#1}%
  \mfp@ifempty{#2}{}{\@mfp@justify#2\mfp@delim}}%
\newdef\@mfp@justify#1#2\mfp@delim{%
  \mfp@local\mfp@hconv{#1}\mfp@local\edef\tlabel@rot{#2}
  \@ifmplabels{}%
   {\mfp@ifempty{#2}{}%
     {\Mfpic@warn{Rotation of labels is not supported without the
        mplabels\@msgbreak option. Rotation may be ignored\@online .}}}}%
\newdef\mfp@vconv#1{%
  \if B#1\tl@vpos=-1 \else
  \if b#1\tl@vpos= 0 \else
  \if c#1\tl@vpos= 1 \else
  \if t#1\tl@vpos= 2 \else
         \tl@vpos=-1 \mfp@justifyerror
  \fi\fi\fi\fi}%
\newdef\mfp@hconv#1{%
  \if l#1\tl@hpos=-1 \else
  \if c#1\tl@hpos= 0 \else
  \if r#1\tl@hpos= 1 \else
         \tl@hpos=-1 \mfp@justifyerror
  \fi\fi\fi}%
\newdef\mfp@justifyerror{%
    \mfp@errmsg{Invalid justification parameter for text label.}%
     {The optional argument for a text label must be^^J%
      one of B, b, c or t^^J
      followed by l or r or c,^^J%
      followed by an angle (optionally).}}%
\newdef\tlpathjustify#1{%
  \mfp@ifempty{#1}{}{\tlp@justify#1\mfp@delim}}%
\newdef\tlp@justify#1#2\mfp@delim{\mfp@def\tlpath@v{#1}%
  \mfp@ifempty{#2}{}{\tlp@@justify#2\mfp@delim}}%
\newdef\tlp@@justify#1#2\mfp@delim{%
  \mfp@def\tlpath@h{#1}\mfp@def\tlpath@r{#2}}%
\tlpathjustify{cc}%
\newdef\tlabelsep#1{\mfp@local\tlabel@sep=#1\relax
  \setmfnumeric{label_sep}{\the\tlabel@sep}}%
\newdef\tlabeloffset#1#2{%
  \mfp@local\tlabel@hadj=#1\relax \mfp@local\tlabel@vadj=#2\relax
  \setmfvariable{pair}{label_adjust}%
    {(\the\tlabel@hadj,\the\tlabel@vadj)}}%
\newdef\everytlabel{\afterassignment\@everytlabel
    \mfp@local\every@tlabel}%
\newdef\@everytlabel{%
  \mfp@ifmpost
   {\@ifmfpfileisopen
     {\mfcmd{verbatimtex\@nl
        \def\noexpand\everylabel{\the\every@tlabel} etex}}%
     {}}%
   {}}%
\newdef\headshape#1#2#3{\mfcmd{\@nl headshape (#1, #2, #3)}}%
\newdef\mfpdefinecolor#1#2#3{\setmfcolor{#1}{#2(#3)}}%
\newdef\fillcolor{\@mfpcolor{fillcolor}}%
\newdef\drawcolor{\@mfpcolor{drawcolor}}%
\newdef\headcolor{\@mfpcolor{headcolor}}%
\newdef\hatchcolor{\@mfpcolor{hatchcolor}}%
\newdef\pointcolor{\@mfpcolor{pointcolor}}%
\newdef\tlabelcolor{\@mfpcolor{tlabelcolor}}%
\newdef\backgroundcolor{\@mfpcolor{background}}%
\newdef\@mfpcolor#1{%
  \mfp@ifnextchar[{\mfp@color{#1}}{\setmfcolor{#1}}}%
\newdef\mfp@color#1[#2]#3{\setmfcolor{#1}{#2(#3)}}%
\newdef\dashedlines{\mfp@local\mfp@linetype0
  \mfp@def\mfp@setstyle{\gendashed{getdashpat\number\mfp@linetype}}}%
\dashedlines
\newdef\coloredlines{%
  \mfp@ifmpost
   {\mfp@local\mfp@linetype0
    \mfp@def\mfp@setstyle{\draw [getcolor\number\mfp@linetype]}}%
   {\Mfpic@warn{You can't use \string\coloredlines\space in
      Metafont.\@msgbreak Using \dashedlines instead}%
    \dashedlines}}%
\newdef\pointedlines{\mfp@local\mfp@linetype0
  \mfp@def\mfp@setstyle{\plot{getsymbol\number\mfp@linetype}}}%
\newdef\datapointsonly{\mfp@local\mfp@linetype0
  \mfp@def\mfp@setstyle{\relax
    \plotnodes{getsymbol \number\mfp@linetype}}}%
\newdef\reconfigureplot#1{\mfsrc{setdata#1}\mfp@writedata}%
\newdef\defaultplot#1{\mfcmd{default#1}}%
\newdef\mfplinetype#1{\mfp@local\mfp@linetype=#1}%
\newlet\mfplinestyle\mfplinetype
\mfplinetype{0}%
\newdef\mfp@lshift{0}%
\newdef\mfp@bshift{0}%
\newdef\mfp@rshift{0}%
\newdef\mfp@tshift{0}%
\newdef\axismargin#1#2{\setmfnumeric{#1axis}{#2}%
  \mfp@local\@namedef{mfp@#1shift}{#2}}%
\newdef\setaxismargins#1#2#3#4{\axismargin l{#1}\axismargin b{#2}%
    \axismargin r{#3}\axismargin t{#4}}%
\newdef\setallaxismargins#1{\setaxismargins{#1}{#1}{#1}{#1}}%
\newcount\mfp@axisnum
\def\get@axisnum#1#2{%
  \if      x#1\relax \mfp@axisnum0
  \else\if y#1\relax \mfp@axisnum1
  \else\if l#1\relax \mfp@axisnum2
  \else\if b#1\relax \mfp@axisnum3
  \else\if r#1\relax \mfp@axisnum4
  \else\if t#1\relax \mfp@axisnum5
  \else
    \mfp@errmsg {Invalid axis letter "#1".}%
     {The command #2 requires an axis to be designated by one of^^J%
      the following letters: x, y, l, b, r, or t. If you proceed, ^^J%
      x will be assumed.}%
  \fi\fi\fi\fi\fi\fi}%
\newdef\setaxismarks#1#2{\setmfnumeric{#1tick}{#2}}%
\newdef\setxmarks#1{\setaxismarks x{#1}}%
\newdef\setymarks#1{\setaxismarks y{#1}}%
\newdef\setbordermarks#1#2#3#4{\setaxismarks l{#1}\setaxismarks b{#2}%
  \setaxismarks r{#3}\setaxismarks t{#4}}%
\newdef\setallbordermarks#1{\setbordermarks{#1}{#1}{#1}{#1}}%
\newdef\smoothdata{\null@opt\@smoothdata}%
\newdef\@smoothdata[#1]{\mfp@def\mfp@smoothness{s}%
  \mfp@def\mfp@tension{#1}}%
\newdef\unsmoothdata{\mfp@def\mfp@smoothness{p}%
  \mfp@def\mfp@tension{}}%
\unsmoothdata% default
\newdef\using#1#2{\mfp@def\parse@data#1\mfp@delim{#2}}%
\newdef\usingpairdefault{\using{##1 ##2 ##3}{(##1,##2)}}%
\newdef\usingnumericdefault{\using{##1 ##2}{##1}}%
\usingpairdefault
\newdef\mfpdataperline{5}%
\newdef\mfp@par{\par}%
\newdef\mfp@join{,}%
\newcount\@datacommentchar \@datacommentchar`\%
\newdef\makepercentother{\@makeother\%}%
\newdef\makepercentcomment{\catcode`\%=14 }%
\newdef\mfpdatacomment#1{\mfp@local\@datacommentchar`#1}%
\newdef\mfp@setcomment{\makepercentother\catcode\@datacommentchar14 }%
\newdef\fdef{\begingroup\@makeother\#\preservelines\@fdef}%
\newdef\@fdef#1#2#3{\mfcmd{\@nl save #1;\@nl
  vardef #1 (expr #2) = \@nl #3\@nl enddef}\endgroup}%
\newdef\mfp@additions{}%
\newdef\@mfpic@graf@macs{%
  \newdef\plotdata{\null@opt\@plotdata}%
  \newdef\@plotdata[##1]##2{\@processdatafile{##2}{\mfp@doplots{##1}}}%
  \def\mfp@doplots##1{\mfp@setstyle
      \advance\mfp@linetype1 \@figmacstart
      \do@datafile{##1}%
      \@if@enddata{}{\mfp@doplots{##1}}}%
  \newdef\@if@enddata{% check for another blank line
    \ifeof\mfp@data \@xp\@firstoftwo
    \else
      \skipcomments
      \ifx\mfp@temp\mfp@par \@XP\@firstoftwo
      \else \@XP\@secondoftwo
      \fi
    \fi}%
  \newdef\datafile{\null@opt\@datafile}%
  \newdef\@datafile[##1]##2{\@figmacstart
    \@processdatafile{##2}{\do@datafile{##1}}}%
  \newdef\do@datafile##1{%
    \do@mtparam{##1}{\mfp@smoothness\mfp@tension}\@do@datafile}%
  \newdef\@do@datafile[##1##2]{%
    \mfsrc{%
      \if s##1 \mfp@ifempty{##2}{curve }{tcurve (##2) }%
      \else polyline
      \fi (\mf@F)}\mfp@rwdata}%
  \newdef\store##1##2{\@rendmac{stored (##1)}##2}%
  \newlet\mfobj\@figmac
  \newlet\mpobj\@figmac
  \newdef\cutoffafter##1{\@closmac{cutoffafter (##1)}}%
  \newdef\cutoffbefore##1{\@closmac{cutoffbefore (##1)}}%
  \newdef\trimpath##1{\@getdimens##1,,\mfp@delim
    \@closmac{trimmedpath (\the\mfp@scratch, \the\mfp@scratchB)}}%
  \newdef\@getdimens##1,##2,##3\mfp@delim{%
    \mfp@scratch \@ifmtsub{##1}{\z@}\relax
    \mfp@scratchB\@ifmtsub{##2}{\mfp@scratch}\relax}%
  \newdef\partpath##1{\@closmac{partialpath (##1)}}%
  \newdef\subpath##1{\@closmac{gsubpath (##1)}}%
  \newdef\draw{\null@opt\@draw}%
  \newdef\@draw[##1]{%
    \@rendmac{\mfp@ifempty{##1}{drawn}{colordrawn (##1)}}}%
  \newdef\dashed{\simple@opt\@dashed{\the\dashlen,\the\dashspace}}%
  \newdef\@dashed##1{\@rendmac{DASHED (##1)}}%
  \newdef\dotted{\simple@opt\@dotted{\the\dotsize,\the\dotspace}}%
  \newdef\@dotted##1{\@rendmac{dotted (##1)}}%
  \newdef\gendashed##1{\@rendmac{gendashed (##1)}}%
  \newdef\plot{\simple@opt\@plot{\the\pointsize, \the\symbolspace}}%
  \newdef\@plot##1##2{\@rendmac{doplot (##2, ##1)}}%
  \newdef\plotnodes{\simple@opt\@plotnodes{\the\pointsize}}%
  \newdef\@plotnodes##1##2{\@rendmac{plotnodes (##2, ##1)}}%
  \newdef\@closed##1##2{%
    \@closmac{##1closed\mfp@ifempty{##2}{}{t (##2)}}}%
  \newdef\bclosed{\null@opt\@bclosed}%
    \newdef\@bclosed[##1]{\@closed b{##1}}%
  \newdef\sclosed{\null@opt\@sclosed}%
    \newdef\@sclosed[##1]{\@closed s{##1}}%
  \newdef\lclosed{\@closed l{}}%
  \newdef\cbclosed{\@closed{cb}{}}%
  \newdef\qbclosed{\@closed{qb}{}}%
  \newlet\uclosed\bclosed
  \newdef\tess##1{\@rendmac{tess (##1)}}%
  \newdef\shade{\simple@opt\@shade{\the\shadespace}}%
  \newdef\@shade##1{\@rendmac{shade (##1)}}%
  \newdef\polkadot{\simple@opt\@polkadot{\the\polkadotspace}}%
  \newdef\@polkadot##1{\@rendmac{polkadot (##1)}}%
  \newdef\thatch{\simple@opt\@thatch{\the\hatchspace,0}}%
  \newdef\@thatch##1{\null@opt{\@@thatch{##1}}}%
  \newdef\@@thatch##1[##2]{\@rendmac{%
    \mfp@ifempty{##2}{thatch}{colorthatch (##2)} (##1)}}%
  \newdef\lhatch{\simple@opt\@lhatch{\the\hatchspace}}%
  \newdef\@lhatch##1{\@thatch{##1,-45}}%
  \newdef\rhatch{\simple@opt\@rhatch{\the\hatchspace}}%
  \newdef\@rhatch##1{\@thatch{##1,45}}%
  \newdef\xhatch{\simple@opt\@xhatch{\the\hatchspace}}%
  \newdef\@xhatch##1{\null@opt{\@@xhatch{##1}}}%
  \newdef\@@xhatch##1[##2]{\@rendmac{%
    \mfp@ifempty{##2}{xhatch}{colorxhatch (##2)} (##1)}}%
  \newlet\hatch=\xhatch
  \newdef\gfill{\null@opt\@gfill}%
  \newdef\@gfill[##1]{%
    \@rendmac{\mfp@ifempty{##1}{filled}{colorfilled (##1)}}}%
  \newdef\gclear{\@rendmac{unfilled}}%
  \newdef\gclip{\@rendmac{Clip}}%
  \newdef\reverse{\@modmac{reverse}}%
  \newdef\xyswappath{\@closmac{xyswappedpath}}%
  \newdef\rotatepath##1{\@closmac{rotatedpath (##1)}}%
  \newdef\shiftpath##1{\@closmac{shiftedpath (##1)}}%
  \newdef\scalepath##1{\@closmac{scaledpath (##1)}}%
  \newdef\xscalepath##1{\@closmac{xscaledpath (##1)}}%
  \newdef\yscalepath##1{\@closmac{yscaledpath (##1)}}%
  \newdef\slantpath##1{\@closmac{xslantedpath (##1)}}%
  \newlet\xslantpath\slantpath
  \newdef\yslantpath##1{\@closmac{yslantedpath (##1)}}%
  \newdef\reflectpath##1{\@closmac{reflectedpath (##1)}}%
  \newdef\transformpath##1{\@closmac{transformedpath (##1)}}%
  \def\arrow{\def\@hbackset{0}\def\@hcolour{}%
    \edef\@hlength{\the\headlen}\def\@hrotate{0}%
    \@arrow}%
  \newdef\@arrow{\mfp@ifnextchar[{\@arrowoption}{\@@arrow}}%
  \newdef\@@arrow{%
    \@modmac{%
      \mfp@ifempty{\@hcolour}{headpath}{colorheadpath (\@hcolour)}%
      \space(\@hlength, \@hrotate, \@hbackset)}}%
  \newdef\@arrowoption[##1]{%
    \mfp@ifempty{##1}{}{\@@arrowoption##1\mfp@delim}\@arrow}%
  \newdef\@@arrowoption##1##2\mfp@delim{%
    \if l##1\relax      \mfp@ifempty{##2}{}{\def\@hlength{##2}}%
    \else\if r##1\relax \mfp@ifempty{##2}{}{\def\@hrotate{##2}}%
    \else\if b##1\relax \mfp@ifempty{##2}{}{\def\@hbackset{##2}}%
    \else\if c##1\relax \mfp@ifempty{##2}{}{\def\@hcolour{##2}}%
    \else
      \Mfpic@warn{Improper option to \string\arrow\@online .}%
    \fi\fi\fi\fi}%
  \newdef\coords{\mfsrc{\@nl bcoords\@nl}}%
  \newdef\endcoords{\mfsrc{\@nl ecoords\@nl}}%
  \newdef\applyT##1{\mfsrc{\@nl hide(apply_t (##1))}}%
  \def\rotate##1{\applyT{rotated ##1}}%
  \newdef\rotatearound##1##2{%
    \applyT{rotatedaround (##1, ##2)}}%
  \newdef\turn{\simple@opt\@turn{(0,0)}}%
  \newdef\@turn##1##2{\rotatearound{##1}{##2}}%
  \newdef\reflectabout##1##2{%
    \applyT{reflectedabout (##1, ##2)}}% line ##1--##2.
  \let\mirror=\reflectabout
  \newdef\shift##1{\applyT{shifted ##1}}% pair.
  \def\scale##1{\applyT{scaled ##1}}% same scaling
  \newdef\xscale##1{\applyT{xscaled ##1}}%
  \newdef\yscale##1{\applyT{yscaled ##1}}%
  \newdef\zscale##1{\applyT{zscaled ##1}}%
  \newdef\xslant##1{\applyT{xslant ##1}}%
  \newdef\yslant##1{\applyT{yslant ##1}}%
  \newdef\zslant##1{\applyT{zslant ##1}}%
  \newdef\boost##1{\applyT{boost ##1}}%
  \newdef\xyswap{\applyT{xyswap}}%
  \newdef\xaxis{\simple@opt\@xaxis{\the\axisheadlen}}%
  \newdef\yaxis{\simple@opt\@yaxis{\the\axisheadlen}}%
  \newdef\axes{\simple@opt\@axes{\the\axisheadlen}}%
  \newdef\@axes##1{\mfcmd{\@nl axes (##1)}}%
  \newdef\@xaxis##1{\mfcmd{\@nl xaxis (##1)}}%
  \newdef\@yaxis##1{\mfcmd{\@nl yaxis (##1)}}%
  \newdef\axis{\null@opt\@axis}%
  \newdef\@axis[##1]##2{\get@axisnum{##2}\axis
    \mfp@ifempty{##1}%
      {\edef\mfp@param{%
         \ifnum\mfp@axisnum<2 \the\axisheadlen
         \else \the\sideheadlen
         \fi}\@@axis{\mfp@param}}{\@@axis{##1}}{##2}}%
  \newdef\@@axis##1##2{\arrow[l##1]\@figmac{axisline.##2}}%
  \newdef\doaxes{\null@opt\@doaxes}%
  \newdef\@doaxes[##1]##2{\def\mfp@axis{\@axis[##1]}%
    \do@axis##2\mfp@delim}%
  \newdef\do@axis##1{%
    \ifx\mfp@delim##1\relax\else\mfp@axis{##1}\@xp\do@axis\fi}%
  \newdef\axismarks##1{\simple@opt{\@marks{##1}}{\the\hashlen}}%
  \newdef\@marks##1##2{\mfsrc{\@nl ##1marks (##2)}\mfp@writedata}%
  \newdef\xmarks{\axismarks x}%
  \newdef\ymarks{\axismarks y}%
  \newdef\lmarks{\axismarks l}%
  \newdef\bmarks{\axismarks b}%
  \newdef\rmarks{\axismarks r}%
  \newdef\tmarks{\axismarks t}%
  \def\grid{\null@opt\@grid}%
  \newdef\@grid[##1]##2{%
    \mfcmd{\mfp@ifempty{##1}{grid}{vgrid (##1)} (##2)}}%
  \newlet\gridpoints=\grid \newlet\lattice=\grid
  \newdef\gridlines##1{\mfcmd{\@nl gridlines (##1)}}%
  \newdef\vgridlines##1{\mfcmd{\@nl vgridlines (##1)}}%
  \newdef\hgridlines##1{\mfcmd{\@nl hgridlines (##1)}}%
  \newdef\plrgrid##1{\mfcmd{\@nl polargrid (##1)}}%
  \newdef\plrgridpoints{\simple@opt\@plrgp{\the\dotsize}}%
  \newdef\@plrgp##1##2{\mfcmd{\@nl polargridpoints (##1, ##2)}}%
  \newdef\gridarcs##1{\mfcmd{\@nl gridarcs (##1)}}%
  \newdef\gridrays##1{\mfcmd{\@nl gridrays (##1)}}%
  \newdef\plrpatch##1{\mfcmd{\@nl polarpatch (##1)}}%
  \newdef\point{\simple@opt\@point{\the\pointsize}}%
  \newdef\@point##1{%
    \mfsrc{\@nl pointd (##1, \ifpointfill\mf@T\else\mf@F\fi)}%
        \mfp@writedata}%
  \newdef\plotsymbol{\simple@opt\@plotsymbol{\the\pointsize}}%
  \newdef\@plotsymbol##1##2{%
    \mfsrc{\@nl plotsymbol (##2, ##1)}\mfp@writedata}%
  \newdef\plottext{\simple@opt\@plottext{cc}}%
  \newdef\@plottext##1{%
    \begingroup
      \mfp@resetwhitespace \tlabeljustify{##1}%
      \@ifmplabels{\@makeother\#}{}%
      \mfp@gettoks\@@plottext}%
  \newdef\@@plottext##1{%
    \@ifmplabels
     {\mfp@setMPpos \def\mfp@points{##1}\@@@tlabel}%
     {\@@@plottext##1,\mfp@delim}}%
  \newdef\@@@plottext{%
    \mfp@ifnextchar\mfp@delim{\@firstoftwo\endgroup}{\x@plottext}}%
  \newdef\x@plottext(##1,##2),{\begingroup
    \@tlabel{##1}{##2}{\the\mfp@toks}\@@@plottext}%
  \newdef\rect##1{\@figmac{rect (##1)}}%
\newdef\regpolygon##1##2##3##4{%
  \@figmac{regularpolygon(##1)(##2)(##3;##4;)}}%
  \def\circle{\null@opt\circl@}%
  \newdef\circl@[##1]##2{%
    \if      t##1\relax \@figmac{circleppp (##2)}%
    \else\if c##1\relax \@figmac{circlecp  (##2)}%
    \else\if s##1\relax \@figmac{circlepps (##2)}%
    \else               \@figmac{circle    (##2)}%
    \fi\fi\fi}%
  \newdef\ellipse{\simple@opt\@ellipse{0}}%
  \newdef\@ellipse##1##2{\@figmac{ellipse (##2, ##1)}}%
  \newdef\sector##1{\@figmac{sector (##1)}}%
  \newdef\makesector{\@closmac{makesector}}%
  \newdef\arc{\null@opt\@arc}%
  \newdef\@arc[##1]##2{%
    \if      t##1\relax \@figmac{arcppp (##2)}%
    \else\if p##1\relax \@figmac{arcplr (##2)}%
    \else\if a##1\relax \@figmac{arcalt (##2)}%
    \else\if c##1\relax \@figmac{arccps (##2)}%
    \else               \@figmac{arcpps (##2)}%
    \fi\fi\fi\fi}%
  \newdef\plr##1{map (polar) (##1)}%
  \newdef\midpoint##1{(0.5[##1])}%
  \newdef\polyline{\@polyline\mf@F}%
  \newlet\lines=\polyline
  \newdef\polygon{\@polyline\mf@T}%
  \newdef\@polyline##1{\@listmac{polyline (##1)}}%
  \newdef\curve {\null@opt{\@curve\mf@F}}%
  \newdef\cyclic{\null@opt{\@curve\mf@T}}%
  \newdef\@curve##1[##2]{%
    \@listmac{\mfp@ifempty{##2}{curve}{tcurve (##2)} (##1)}}%
  \newdef\fcncurve{\null@opt\@fcncurve}%
  \newdef\@fcncurve[##1]{%
    \@listmac{\mfp@ifempty{##1}{fcncurve}{functioncurve (##1)}}}%
  \newdef\qspline{\@listmac{openqbs}}%
  \newdef\closedqspline{\@listmac{closedqbs}}%
  \newdef\cspline{\@listmac{opencbs}}%
  \newdef\closedcspline{\@listmac{closedcbs}}%
  \newdef\mfbezier{\null@opt{\@mfbezier\mf@F}}%
  \newdef\closedmfbezier{\null@opt{\@mfbezier\mf@T}}%
  \newdef\@mfbezier##1[##2]{%
    \@listmac{\mfp@ifempty{##2}{bezier}{tbezier (##2)} (##1)}}%
  \newdef\qbeziers{\@listmac{qbezier (\mf@F)}}%
  \newdef\closedqbeziers{\@listmac{qbezier (\mf@T)}}%
  \newdef\turtle{\@listmac{turtle}}%
  \newdef\function{\def\mfp@name{function}\mfp@fcn}%
  \newdef\parafcn{\def\mfp@name{parafcn}\mfp@fcn}%
  \newdef\plrfcn{\def\mfp@name{plrfcn}\mfp@fcn}%
  \newdef\mfp@fcn{\simple@opt\@mfp@fcn{s}}%
  \newdef\@mfp@fcn##1{\@@mfp@fcn##1\mfp@delim}%
  \newdef\@@mfp@fcn##1##2\mfp@delim##3##4{%
    \@figmac{\mfp@ifempty{##2}{}{t}\mfp@name\space
      (\if p##1\mf@F\else\mf@T\fi \mfp@ifempty{##2}{}{, ##2})
      (##3) (##4)}}%
  \newdef\btwnfcn{\simple@opt\@btwnfcn{p}}%
  \newdef\@btwnfcn##1{\@@btwnfcn##1\mfp@delim}%
  \newdef\@@btwnfcn##1##2\mfp@delim##3##4##5{\btwn@params{##1}{##2}%
    \@figmac{\t@pref btwnfcn (\s@vals) (##3) (##4) (##5)}}%
  \newdef\btwn@params##1##2{%
    \edef\s@vals{\if s##1\mf@T\else\mf@F\fi}%
    \mfp@ifempty{##2}{\def\t@pref{}}%
     {\def\t@pref{t}\edef\s@vals{\s@vals, ##2}}}%
  \newdef\plrregion{\simple@opt\@plrregion{p}}%
  \newdef\@plrregion##1{\@@plrregion##1\mfp@delim}%
  \newdef\@@plrregion##1##2\mfp@delim##3##4{\btwn@params{##1}{##2}%
    \@figmac{((0,0)--(\t@pref plrfcn (\s@vals) (##3) (##4))%
       --cycle)}}%
  \newdef\tile##1{\mfcmd{\@nl tile (##1)}}%
  \newdef\endtile{\mfsrc{endtile;\@nl}}%
  \newdef\patharr##1{\begingroup
    \mfsrc{hide(numeric ##1; path ##1[]; ##1 = 0)}%
    \def\store@path{\mfsrc{\@nl store (##1[incr ##1])}}%
    \setrender{}}%
  \newdef\endpatharr{\endgroup}%
  \newdef\connect{\@figmac{begingroup; save nexus}%
    \patharr{nexus}}%
  \newdef\endconnect{\endpatharr
    \mfcmd{\@nl mkpoly (\mf@F, nexus)\@nl endgroup}%
    \if@mfp@latex \def\mfptmp@a{connect}%
      \ifx\mfptmp@a\@currenvir
        \aftergroup\@startfigtrue %\aftergroup\@imrendtrue
      \fi
    \fi}%
  \newdef\piechart{\simple@opt\@piechart{c}}%
  \newdef\@piechart##1{\@@piechart##1\mfp@delim}%
  \newdef\@@piechart##1##2\mfp@delim##3{%
    \mfsrc{\@nl piechart(\if a##1 \else-\fi1, %
        \mfp@mtsub{##2}{90}, ##3)}\mfp@writedata}%
  \newdef\piewedge{\simple@opt\@piewedge{d}}%
  \newdef\@piewedge##1{\@@piewedge##1\mfp@delim}%
  \newdef\@@piewedge##1##2\mfp@delim##3{%
    \@figmac{(piewedge[##3]%
      \if      x##1 shifted (##2*piedirection[##3])%
      \else\if s##1 shifted (##2)%
      \else\if m##1 shifted (##2 - piecenter)%
      \else
      \fi\fi\fi)}}%
  \newdef\barchart{\simple@opt\@barchart{0,1,1}}%
  \newdef\@barchart##1##2{%
    \mfsrc{\@nl barchart (##1, \if h##2\mf@F\else\mf@T\fi)}%
    \mfp@writedata}%
  \newlet\bargraph=\barchart
  \newlet\histogram=\barchart
  \newlet\gantt\barchart
  \newdef\chartbar##1{\@figmac{chartbar[##1]}}%
  \newlet\graphbar=\chartbar
  \newlet\histobar=\chartbar
  \newlet\ganttbar=\chartbar
  \newdef\pinumber{3.14159}%
  \mfp@additions
}%
\newdef\mfpic{\simple@opt\@mfpicA{1}}%
\newdef\@mfpicA#1{\simple@opt{\@mfpic{#1}}{#1}}%
\newdef\@mfpic#1#2#3#4#5#6{%
  \save@mfpicdimens
  \begingroup % ended near end of \endmfpic
  \@ifmfpfileisopen{}%
   {\if@mfp@nowrite\else \nooutputfileerror{\mfpic}%
      \def\@mfsrc##1##2{}%
    \fi}%
  \mfp@DBlog{Starting mfpic \number\mfp@count \@online.}%
  \font\@tcurr=\fontname\font\relax
  \let\ifin@mfpicenv\iftrue
  \let\par\@empty
  \nullfont
  \@mfpic@graf@macs
  \newdef\@xconv##1{%
   {\mfp@scratch = ##1\relax
    \advance\mfp@scratch by -#3\mfpicunit
    \mfp@scratch = #1\mfp@scratch
    \global ##1 = \mfp@scratch}}%
  \newdef\@yconv##1{%
   {\mfp@scratch=##1\relax
    \advance\mfp@scratch by -#5\mfpicunit
    \mfp@scratch = #2\mfp@scratch
    \global ##1 = \mfp@scratch}}%
\setbox\@alltlabels\vbox{\hbox{}}%
\@tlabelsbot   \maxdimen
\@tlabelstop  -\maxdimen
\@tlabelsleft  \maxdimen
\@tlabelsright-\maxdimen
  \@graphright=#4\mfpicunit \@xconv\@graphright
  \@graphtop=#6\mfpicunit \@yconv\@graphtop
  \@graphleft=0pt
  \@graphbot=0pt
  \@graphwd=\@graphright
  \mfsrc{\@nl \mf@p\mf@d\mf@d\mf@d\@nl
    unitlen := \the\mfpicunit\mf@s;\@nl
    xscale := #1; yscale := #2;\@nl
    bounds (#3, #4, #5, #6);\@nl
    \@nl
    beginmfpic(\number\mfp@count); \mf@p\space\@mfplineno.
    \mfp@ifmpost
     {\@nl verbatimtex \@nl
      \begingroup\space\font\noexpand\MFPcfont=\fontname\@tcurr\@nl
      etex;}{}}%
  \newdef\tlabel{%
    \begingroup    % ended in \@(@@)tlabel
      \mfp@resetwhitespace
      \@ifmplabels{}{\def\tlabel@rot{}}%
      \null@opt\@tlabel@}%
  \newdef\@tlabel@[##1]{\tlabeljustify{##1}%
    \mfp@ifnextchar({\@@tlabel@}{\@@tlabel@@}}%
  \newdef\@@tlabel@(##1,##2){%
    \@ifmplabels
    {\@@tlabel{(##1,##2)}}{\@tlabel{##1}{##2}}}%
  \newdef\@@tlabel@@##1{%
    \@ifmplabels {\@@tlabel{##1}}{\@@tlabel@##1}}%
  \newdef\mfp@btex##1{btex \noexpand\MFPtext{##1} etex}%
  \newdef\extraendtlabel{}%
  \newdef\mfp@setMPpos{%
    \edef\mfp@MPpos{%
      \ifcase\tl@hpos      .5\or 1\else 0\fi, % horizontal
      \ifcase\tl@vpos 0\or .5\or 1\else 0\fi, % vertical
      \ifnum \tl@vpos < 0 \mf@T\else\mf@F\fi, % true=Baseline
      \mfp@mtsub{\tlabel@rot}{0}}}%
  \newdef\@@tlabel##1{\def\mfp@points{##1}\mfp@restorepar
    \mfp@setMPpos \@makeother\#\mfp@gettoks\@@@tlabel}%
  \newdef\@@@tlabel{%
    \mfcmd{\@nl
      newgblabel(\mfp@MPpos)(\mfp@btex{\the\mfp@toks})(\mfp@points)}%
    \endgroup \extraendtlabel}%
  \newdef\set@textbox##1{%
    \setbox\@textbox=\vbox{\def\\{\cr}\mfp@restorepar
      \@tcurr\the\every@tlabel\halign{####\hfil\cr##1\crcr}}}%
  \newdef\@tlabel##1##2##3{%
    \set@textbox{##3}%
    \mfp@scratch\tb@ht \advance\mfp@scratch\tb@dp
    \tb@totalht\mfp@scratch
    \mfp@scratch=##1\mfpicunit
    \@xconv\mfp@scratch
    \begingroup
      \ifcase\tl@hpos \advance\mfp@scratch 0.5\tb@wd % center
      \or \advance\mfp@scratch -\tlabel@sep          % right
      \else \advance\mfp@scratch \tb@wd              % left
            \advance\mfp@scratch \tlabel@sep
      \fi
      \advance\mfp@scratch \tlabel@hadj
      \ifdim \mfp@scratch>\@tlabelsright
        \@tlabelsright=\mfp@scratch
      \fi
    \endgroup
    \begingroup
      \ifcase\tl@hpos \advance\mfp@scratch -0.5\tb@wd % center
      \or \advance\mfp@scratch -\tb@wd                % right
          \advance\mfp@scratch -\tlabel@sep
      \else \advance\mfp@scratch \tlabel@sep          % left
      \fi
      \advance\mfp@scratch \tlabel@hadj
      \tb@moveright=\mfp@scratch
      \ifdim \mfp@scratch<\@tlabelsleft
        \@tlabelsleft=\mfp@scratch
      \fi
    \endgroup
    \mfp@scratch=##2\mfpicunit
    \@yconv\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
      \fi
      \advance\mfp@scratch \tlabel@vadj
      \tb@raise=\mfp@scratch
      \ifdim \mfp@scratch>\@tlabelstop
        \@tlabelstop=\mfp@scratch
      \fi
    \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
      \fi
      \advance\mfp@scratch \tlabel@vadj
      \ifdim \mfp@scratch<\@tlabelsbot
        \@tlabelsbot=\mfp@scratch
      \fi
    \endgroup
    \global \setbox\@alltlabels=%
      \vtop{\unvbox\@alltlabels
        \vbox to 0pt{\kern-\tb@raise
          \hbox{\kern\tb@moveright\box\@textbox}\vss}}%
    \endgroup       % group begun in \tlabel
    \extraendtlabel}% End \@tlabel
  \newdef\tlabelrect{\tlpath{rect}{0}}%
  \newdef\tlabeloval{\tlpath{oval}{1}}%
  \newdef\tlabelellipse{\tlpath{ellipse}{1}}%
  \newdef\tlabelcircle{%
    \mfp@ifnextchar*{\@firstoftwo{\tlabelellipse*[1]}}%
     {\tlabelellipse[1]}}%
  \newdef\tlpath##1##2{\@figmacstart
    \begingroup % ended in \tlabelpath@
    \def\mfp@name{##1}\def\mfp@param{##2}%
    \mfp@ifnextchar*%
      {\@mfpswitchtrue\@firstoftwo{\@tlpath}}% gobbles the star
      {\@mfpswitchfalse\@tlpath}}%
  \newdef\@tlpath{\null@opt\@@tlpath}%
  \newdef\@@tlpath[##1]{%
    \edef\mfp@param{\mfp@mtsub{##1}{\mfp@param}}%
    \mfp@resetwhitespace
    \simple@opt\@@@tlpath{\tlpath@v\tlpath@h\tlpath@r}}%
  \newdef\@@@tlpath##1{\tlabeljustify{##1}%
    \mfp@setMPpos \mfp@ifnextchar({\@tlabelpath}{\@@tlabelpath}}%
  \newdef\@tlabelpath (##1,##2){%
    \def\mfp@points{(\@firstofone{##1},\@firstofone{##2})}%
    \@@@tlabelpath}%
  \newdef\@@tlabelpath##1{\def\mfp@points{##1}\@@@tlabelpath}%
  \newdef\@@@tlabelpath{\mfp@restorepar
    \@ifmplabels{\@makeother\#}{}\mfp@gettoks\tlabelpath@}%
  \newdef\tlabelpath@{%
    \@ifmplabels
     {\mfcmd{text\mfp@name x (\mfp@MPpos)\@nl(origin, % dummy parameter
        \mfp@btex{\the\mfp@toks}, \mfp@param, \mfp@points)}}%
     {\measure@textbox{\the\mfp@toks}%
      \mfcmd{text\mfp@name x (\mfp@MPpos)\@nl(\tb@ll, \tb@ur, % text bbox
        \mfp@param, \mfp@points)}}%
    \if@mfpswitch \endgroup  % *-form, no label placed
    \else    % tlabel commands contain \endgroup
      \@ifmplabels{\@@@tlabel}%
       {\@xp\@@tlabel@\mfp@points{\the\mfp@toks}}%
    \fi}%
  \newdef\measure@textbox##1{%
    \set@textbox{##1}%
    \edef\tb@ll{(0, -(\the\tb@dp))}%
    \edef\tb@ur{(\the\tb@wd, \the\tb@ht)}}%
  \newdef\tlabels{%
    \begingroup % ended in \do@tlabels
      \mfp@resetwhitespace \@tlabels}%
  \newdef\@tlabels##1{\def\extraendtlabel{\do@tlabels}%
    \do@tlabels##1\mfp@delim}%
  \newdef\do@tlabels{%
    \mfp@ifnextchar\mfp@delim{\@firstoftwo\endgroup}{\tlabel}}%
  \newdef\axislabels##1{%
    \begingroup % ended in \do@axislabel
      \mfp@resetwhitespace \tlabeljustify{cc}%
      \let\mfp@xcoord=\@firstofone \let\mfp@ycoord=\@firstofone
      \get@axisnum{##1}\axislabels
      \ifcase\mfp@axisnum \tl@vpos=2 % x-axis -->[tc]
        \def\mfp@ycoord{0}%
      \or \tl@hpos=1  % y-axis-->[cr]
        \def\mfp@xcoord{0}
      \or \tl@hpos=1  % left  -->[cr]
        \edef\mfp@xcoord{\mfp@lshift}\mfpaddto\mfp@xcoord{#3}%
      \or \tl@vpos=2  % bottom-->[tc]
        \edef\mfp@ycoord{\mfp@bshift}\mfpaddto\mfp@ycoord{#5}%
      \or \tl@hpos=-1 % right -->[cl]
        \edef\mfp@xcoord{-\mfp@rshift}\mfpaddto\mfp@xcoord{#4}%
      \or \tl@vpos=0  % top   -->[bc]
        \edef\mfp@ycoord{-\mfp@tshift}\mfpaddto\mfp@ycoord{#6}%
      \fi
      \ifx\@firstofone\mfp@xcoord
        \edef\mfp@ycoord####1{\mfp@ycoord}%
      \else
        \edef\mfp@xcoord####1{\mfp@xcoord}%
      \fi \null@opt\@axislabels}%
  \newdef\@axislabels[##1]##2{%
    \tlabeljustify{##1}%
    \do@axislabel~ ##2,\mfp@delim}%
  \newdef\do@axislabel~##1,{%
    \@ifmtarg{##1}{\x@axislabel}{\do@@axislabel##1\@nil}}%
  \newdef\do@@axislabel##1##2\@nil{%
    \@ifmtarg{##2}%
     {\Mfpic@warn{Possible extra comma, missing coordinate, or
        missing\@msgbreak braces in \string\axislabels\@online.
        Skipping this label.}}%
     {\tlabel(\mfp@xcoord{##2},\mfp@ycoord{##2}){##1}}%
    \x@axislabel}%
  \newdef\x@axislabel{% check for end of list
    \mfp@ifnextchar\mfp@delim{\@firstoftwo\endgroup}{\do@axislabel~ }}%
  \newdef\@docaption{}%
  \newdef\tcaption{\simple@opt\tcaption@{1.2, 1.0}}%
  \newdef\tcaption@##1{\@tcaption##1\mfp@delim}%
  \long\def\@tcaption##1,##2\mfp@delim##3{%
    \def\@docaption{%
      \setbox\@textbox=%
        \hbox{\def\\{\hskip\@M\p@}\mfp@restorepar
         \@tcurr##3}%
      \@graphwd=\wd\@wholegraph
      \ifdim\tb@wd>##1\@graphwd
        \setbox\@textbox=%
        \hbox{%
          \vbox{%
            \if@mfp@latex % keep LaTeX's `\\'
            \else
              \def\\{\unskip\hbox{}\hfil\penalty-\@M\ignorespaces}%
            \fi
            \if@mfp@centcapt
              \leftskip=0pt plus 0.5fil
              \rightskip=0pt plus -0.5fil
              \parfillskip=0pt plus 1fil
            \else
              \leftskip=0pt
              \rightskip=0pt
            \fi
            \hsize=##2\@graphwd \mfp@restorepar
            \noindent\@tcurr ##3%
          }% End vbox.
        }% End hbox.
      \fi
      \mfp@scratch=\wd\@wholegraph
      \ifdim \mfp@scratch<\tb@wd \mfp@scratch=\tb@wd \fi
      \global\setbox\@wholegraph=%
      \vbox{\hbox to \mfp@scratch{\hss\box\@wholegraph\hss}%
        \nointerlineskip \vskip\mfpiccaptionskip
        \hbox to \mfp@scratch{\hss\box\@textbox\hss}}% End vbox.
    }% End \@docaption.
  }% End \@tcaption.
}% End of \@mfpic
\mfp@DBlog{Definition of closure of mfpic environment.}%
\newdef\endmfpic{%
  \mfsrc{\mfp@ifmpost{\@nl verbatimtex \endgroup\space etex;}{}\@nl
    endmfpic;\mf@p (\number\mfp@count) \space\@mfplineno.\@nl
    \mf@p\mf@d\mf@d\mf@d\@nl}%
  \ifmfpicdebug\wlog{}\wlog{Mfpic: ENTERED endmfpic.}\wlog{}\fi
  \if@shipping %
    \global\setbox\@wholegraph=%
    \vbox{%
      \ifmfpicdraft
        \vbox to \@graphtop{\vss
          \hbox to \@graphwd{\kern2pt\tt\#\number\mfp@count\hss}%
            \kern2pt}%
      \else
      \mfp@ifmpost{\vbox}{\vbox to \@graphtop}%
       {\vss
        \edef\@graphfilename{\setfilename{\mfp@filename}%
          {\number\mfp@count}}%
        \mfp@ifmpost
         {\openin\mfp@graph=\@graphfilename\relax
          \ifeof\mfp@graph
            \Mfpic@msg{No graph file: \@graphfilename\space.}%
            \def\@setmfpicgraphic##1{\raise2pt\hbox{\kern2pt\tt ##1}}%
            \closein\mfp@graph
          \else\if@mfp@latexe
            \@namedef{Gin@rule@.\number\mfp@count}##1{%
              {\mfp@Gtype}{.\number\mfp@count}{##1}}%
          \fi\fi}{}%
        \mfp@ifmpost{\hbox}{\hbox to \@graphwd}%
          {\@xp\@setmfpicgraphic\@xp{\@graphfilename}\hss}% End hbox.
        \kern0pt
        }% End vbox
      \fi
    }%% End vbox (\setbox\@wholegraph)
    \mfp@ifmpost
     {\@graphright=\wd\@wholegraph
      \@graphtop=\ht\@wholegraph
      \@graphwd=\@graphright}{}%
    \ifmfpicdebug
      \wlog{Mfpic: graphleft  = \the\@graphleft}%
      \wlog{Mfpic: graphright = \the\@graphright}%
      \wlog{Mfpic: graphtop   = \the\@graphtop}%
      \wlog{Mfpic: graphbot   = \the\@graphbot}%
      \wlog{Mfpic: graphwd    = \the\wd\@wholegraph}%
      \wlog{Mfpic: graphht    = \the\ht\@wholegraph}%
      \wlog{Mfpic: graphdp    = \the\dp\@wholegraph}%
      \wlog{}%
    \fi
    \ifmfpicdebug
      \wlog{Mfpic: tlabelsleft  = \the\@tlabelsleft}%
      \wlog{Mfpic: tlabelsright = \the\@tlabelsright}%
      \wlog{Mfpic: tlabelstop   = \the\@tlabelstop}%
      \wlog{Mfpic: tlabelsbot   = \the\@tlabelsbot}%
      \wlog{}%
    \fi
    \ifdim\@tlabelsleft < \maxdimen
      \setbox\@alltlabels\vtop to 0pt{%
        \kern \mfpiclly bp
        \moveleft \mfpicllx bp \box\@alltlabels
        \vss}%
      \mfp@scratch\@tlabelsleft
      \advance\mfp@scratch-\mfpicllx bp
      \ifdim\mfp@scratch<\@graphleft
        \@graphleft\mfp@scratch
      \fi
      \mfp@scratch\@tlabelsright
      \advance\mfp@scratch-\mfpicllx bp
      \ifdim\mfp@scratch>\@graphright
        \@graphright\mfp@scratch
      \fi
      \mfp@scratch\@tlabelstop
      \advance\mfp@scratch-\mfpiclly bp
      \ifdim\mfp@scratch>\@graphtop
        \@graphtop\mfp@scratch
      \fi
      \mfp@scratch\@tlabelsbot
      \advance\mfp@scratch-\mfpiclly bp
      \ifdim\mfp@scratch<\@graphbot
        \@graphbot\mfp@scratch
      \fi
      \setbox\@wholegraph=\vtop{%
        \unvbox\@wholegraph\box\@alltlabels}%
    \fi
    \ifmfpicdebug
      \wlog{Mfpic: tlabelsleft  = \the\@tlabelsleft}%
      \wlog{Mfpic: tlabelsright = \the\@tlabelsright}%
      \wlog{Mfpic: tlabelstop   = \the\@tlabelstop}%
      \wlog{Mfpic: tlabelsbot   = \the\@tlabelsbot}%
      \wlog{}%
    \fi
    \mfp@scratch=\@graphtop
    \advance\mfp@scratch by -\@graphbot
    \global \setbox\@wholegraph=%
    \vbox to \mfp@scratch{\vss
      \hbox{\kern-\@graphleft\box\@wholegraph}%
      \kern-\@graphbot}% End vbox.
    \ifmfpicdebug
      \wlog{Mfpic: graphleft  = \the\@graphleft}%
      \wlog{Mfpic: graphright = \the\@graphright}%
      \wlog{Mfpic: graphtop   = \the\@graphtop}%
      \wlog{Mfpic: graphbot   = \the\@graphbot}%
      \wlog{Mfpic: graphwd    = \the\wd\@wholegraph}%
      \wlog{Mfpic: graphht    = \the\ht\@wholegraph}%
      \wlog{Mfpic: graphdp    = \the\dp\@wholegraph}%
      \wlog{}%
    \fi
    \@docaption
    \global\mfpicheight\ht\@wholegraph
    \global\mfpicwidth\wd\@wholegraph
    \ifmfpicdebug
      \wlog{Mfpic: graphleft  = \the\@graphleft}%
      \wlog{Mfpic: graphright = \the\@graphright}%
      \wlog{Mfpic: graphtop   = \the\@graphtop}%
      \wlog{Mfpic: graphbot   = \the\@graphbot}%
      \wlog{Mfpic: graphwd    = \the\wd\@wholegraph}%
      \wlog{Mfpic: graphht    = \the\ht\@wholegraph}%
      \wlog{Mfpic: graphdp    = \the\dp\@wholegraph}%
      \wlog{}%
    \fi
    \ifmfpicdraft
      \setbox\@wholegraph=%
        \hbox{\@mfpframed{-\mfpframethickness}{\box\@wholegraph}}%
    \fi
    \mfp@ifdefined\s@vemfpic
      {\global\setbox\s@vemfpic=\box\@wholegraph}%
      {\leavevmode\box\@wholegraph}%
    \global\let\s@vemfpic\UndEfInEd
    \global \advance\mfp@count1
  \fi % end of \if@shipping
  \endgroup % Begun near start of \@mfpic
  \restore@mfpicdimens
  \if@mfp@latex
    \def\mfptmp@a{mfpic}%
    \ifx\mfptmp@a\@currenvir
      \@ignoretrue% so \endmfpic and \end{mfpic} have the same effect.
    \fi
  \fi
  \ignorespaces
}%
\newdef\newsavepic#1{%
  \if@mfp@latex \newsavebox{#1}%
  \else
    \mfp@ifdefined{#1}%
     {\mfp@errmsg
       {Command \string #1 already defined.}%
       {You have used \newsavepic with an already defined or an^^J%
        improper control sequence. Replace #1 with another name.^^J%
        If you proceed, \newsavepic will be ignored.}}%
     {\csname newbox\endcsname#1}%
  \fi}%
\newlet\newpic=\newsavepic % compatibility
\newdef\savepic#1{\relax
   \mfp@ifdefined{#1}{\gdef\s@vemfpic{#1}}%
   {\mfp@errmsg{Box \string#1 undefined.}%
    {You tried to save a picture in a box which had not been^^J%
     previously allocated. Use \newsavepic to allocate a box.}}}%
\newdef\usepic#1{\leavevmode \copy#1\relax}%
\newdef\mfpframed{\simple@opt\@mfpframed\mfpframesep}%
\newdef\mfpframe{\simple@opt\@mfpframe\mfpframesep}%
\newdef\@mfpframed#1#2{\@mfpframe{#1}#2\endmfpframe}%
\newdef\@mfpframe#1{%
  \leavevmode\hbox\bgroup
    \mfpframesep#1\relax
    \vrule width\mfpframethickness
    \vtop\bgroup
      \vbox\bgroup
        \hrule height\mfpframethickness
        \kern\mfpframesep
        \hbox\bgroup \kern\mfpframesep \ignorespaces}%
\newdef\endmfpframe{\unskip
          \kern\mfpframesep
        \egroup % end hbox
      \egroup % end vbox
      \kern\mfpframesep
      \hrule height\mfpframethickness
    \egroup % end vtop
    \vrule width\mfpframethickness
  \egroup}% end hbox
\mfp@ifdefined\framed{}{\newlet\framed=\mfpframed}%
\newif\if@mfp@verbtex
\def\mfpverbtex{%
  \begingroup \preservelines \@makeother\#%
    \afterassignment\mfp@writetex\global\mfp@verbtex=}%
\def\mfp@writetex{%
  \endgroup
  \@ifmfpfileisopen
   {\mfp@ifmpost
      {\mfsrc{verbatimtex}\mfsrc{\the\mfp@verbtex}\mfcmd{etex}}%
      {\noMP@error{verbatimtex}}%
    \global\@mfp@verbtexfalse\mfp@verbtex{}}%
   {\global\@mfp@verbtextrue}}%
\global\mfp@count=1 % 1 because we now advance it in \endmfpic.
\newdef\MFPICinput#1{%
  \immediate\openin\mfp@graph=#1
  \ifeof\mfp@graph
    \immediate\closein\mfp@graph
  \else
    \immediate\closein\mfp@graph
    \input #1
  \fi}%
\MFPICinput{mfppatch.tex}%
\mfp@DBlog{Punctuation, etc., will revert to old catcodes now.}%
\let\+\mfpsaveplus
\restorenewlinechar
\MFPicpackagE%
\MFPICinput{mfpic.usr}%
\endinput
%%
%% End of file `mfpic.tex'.
