diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/mfpic')
-rw-r--r-- | Master/texmf-dist/tex/generic/mfpic/mfpic.sty | 65 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/mfpic/mfpic.tex | 2548 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/mfpic/mfppatch.tex | 14 |
3 files changed, 1373 insertions, 1254 deletions
diff --git a/Master/texmf-dist/tex/generic/mfpic/mfpic.sty b/Master/texmf-dist/tex/generic/mfpic/mfpic.sty index cdd50eb92f8..80121080c80 100644 --- a/Master/texmf-dist/tex/generic/mfpic/mfpic.sty +++ b/Master/texmf-dist/tex/generic/mfpic/mfpic.sty @@ -8,28 +8,59 @@ %% %% ------------------------------------------------------------------- %% -%% 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. +%% Copyright 2002--2006, Daniel H. Luecking %% %% 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 +%% LaTeX Project Public License, either version 1.3b of this license or (at %% your option) any later version. The latest version of this license is in +%% <http://www.latex-project.org/lppl.txt> +%% and version 1.3b or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. %% -%% 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. +%% Mfpic has maintenance status "author-maintained". The Current Maintainer +%% is Daniel H. Luecking. There are several Base Interpreters associated +%% with mfpic: plain TeX, LaTeX, plain Metafont and plain MetaPost. %% +\ProvidesPackage{mfpic} + [2006/05/26 v0.9. Macros for drawing with Metafont/MetaPost.]% +\DeclareOption{draft}{\mfpicdraft}% +\DeclareOption{final}{% + \mfpicfinal\PassOptionsToPackage{final}{graphics}}% +\DeclareOption{nowrite}{\mfpicnowrite}% +\DeclareOption{metapost}{\mfp@mposttrue}% +\DeclareOption{metafont}{\usemetafont}% +\DeclareOption{centeredcaptions}{\usecenteredcaptions}% +\DeclareOption{justifiedcaptions}{\noraggedcaptions}% +\DeclareOption{raggedcaptions}{\useraggedcaptions}% +\DeclareOption{clip}{\clipmfpic}% +\DeclareOption{truebbox}{\usetruebbox}% +\DeclareOption{mplabels}{\usemplabels}% +\DeclareOption{overlaylabels}{\overlaylabels}% +\DeclareOption{clearsymbols}{\clearsymbols}% +\DeclareOption{debug}{\mfpicdebugtrue}% +\DeclareOption{mfpreadlog}{\mfp@readlogtrue}% +\DeclareOption*{% + \@ifpackageloaded{graphics}% + {\Mfpic@warn{Unrecognized option \CurrentOption.}}% + {\Mfpic@msg{Passing option \CurrentOption\space to % + graphics package.}% + \PassOptionsToPackage{\CurrentOption}{graphics}}}% +\newcommand*\mfpdraftfont{\normalfont\ttfamily}% +\def\@usemetapost{% + \mfp@ifdefined\includegraphics{}{\RequirePackage{graphics}}% + \let\mfp@save@parse@bb\Gread@parse@bb + \newdef\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}}% + \ifmfp@pdf \gdef\mfp@Gtype{mps}% + \else \gdef\mfp@Gtype{eps}% + \fi + \gdef\preparemfpicgraphic##1{% + \@namedef{Gin@rule@.\number\mfp@count}####1{{\mfp@Gtype}% + {.\number\mfp@count}{####1}}% + \let\Gread@parse@bb\mfp@parse@bb}% + \global\let\setmfpicgraphic\includegraphics + \gdef\getmfpicoffset##1{}}% \input mfpic.tex\relax \endinput %% diff --git a/Master/texmf-dist/tex/generic/mfpic/mfpic.tex b/Master/texmf-dist/tex/generic/mfpic/mfpic.tex index df2b23850b0..5e8b1d89110 100644 --- a/Master/texmf-dist/tex/generic/mfpic/mfpic.tex +++ b/Master/texmf-dist/tex/generic/mfpic/mfpic.tex @@ -8,497 +8,579 @@ %% %% ------------------------------------------------------------------- %% -%% 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. +%% Copyright 2002--2006, Daniel H. Luecking %% %% 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 +%% LaTeX Project Public License, either version 1.3b of this license or (at %% your option) any later version. The latest version of this license is in +%% <http://www.latex-project.org/lppl.txt> +%% and version 1.3b or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. %% -%% 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. +%% Mfpic has maintenance status "author-maintained". The Current Maintainer +%% is Daniel H. Luecking. There are several Base Interpreters associated +%% with mfpic: plain TeX, LaTeX, plain Metafont and plain MetaPost. %% -%% 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% +\ifx\mfpfileversion\UndEfInEd\else\expandafter\endinput\fi% +{% + \catcode\lq\.12 \catcode\lq\/12% + \gdef\mfpfileversion{0.9}% + \gdef\mfpfiledate{2006/05/26}% + \gdef\mfpicversion{90}% +}% \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}% +{% + \catcode61\space12\relax% 61=equal sign + \catcode32=10\relax% 32=space + \catcode13=5 % 13=EOL + \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@restoreEOL{\catcode13=\number\catcode13\relax}% + \edef\mfp@restoreALL{\mfp@restorecode{=}\mfp@restorecode{@}% + \mfp@restorecode{$}\mfp@restorecode{:}\mfp@restorecode{;}% + \mfp@restorecode{.}\mfp@restorecode{,}\mfp@restorecode{!}% + \mfp@restorecode{?}\mfp@restorecode{(}\mfp@restorecode{)}% + \mfp@restorecode{[}\mfp@restorecode{]}\mfp@restorecode{<}% + \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}}% + \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 + \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\@}% +}% +\MFPsavecodes\MFPsanitize +\catcode`@11 +\chardef\mfp@ctrlJ 10 \chardef\mfp@ctrlM 13 \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@msg#1{% + {\newlinechar\mfp@ctrlJ\def\@nl{^^J}\immediate\write16{#1}}}% \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 +\def\Mfpic@msg#1{{\let\@msgbreak\mfp@msgbrk\mfp@msg{Mfpic: #1}}}% +\def\Mfpic@warn#1{% + {\let\@msgbreak\mfp@warnbrk\mfp@msg{\@nl Mfpic 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 +\def\mfp@lineno{line \number\inputlineno\space in the TeX source}% \let\@xp\expandafter \def\@XP{\@xp\@xp\@xp}% +\long\def\@firstoftwo#1#2{#1}% +\long\def\@secondoftwo#1#2{#2}% \def\mfp@ifdefined#1{% \ifx#1\UndEfInEd \@xp\@secondoftwo \else\ifx#1\relax \@XP\@secondoftwo \else \@XP\@firstoftwo \fi\fi}% +\mfp@ifdefined\@empty{}{\def\@empty{}}% +\mfp@ifdefined\@gobble{}{\def\@gobble#1{}}% \mfp@ifdefined\@firstofone{}{\long\def\@firstofone#1{#1}}% -\newif\if@mfp@latex \@mfp@latexfalse +\mfp@ifdefined\on@line{}% + {\def\on@line{ on input line \number\inputlineno}}% +\let\mfp@enddef\@empty +\long\def\mfp@gobbledef#1\mfp@enddef{}% +\def\mfp@ifundefined#1{\mfp@ifdefined#1\mfp@gobbledef\@empty}% +\mfp@ifundefined\@ifundefined + \def\@ifundefined#1{% + \@xp\ifx\csname #1\endcsname\relax \@xp\@firstoftwo + \else \@xp\@secondoftwo + \fi}% +\mfp@enddef +\mfp@ifdefined\g@addto@macro{}{% + \long\def\g@addto@macro#1#2{% + \begingroup + \toks@\@xp{#1#2}% + \xdef#1{\the\toks@}% + \endgroup}}% +\mfp@ifdefined\g@prependto@macro{}{% + \long\def\g@prependto@macro#1#2{% + \begingroup + \toks@{#2}\toks2\@xp{#1}% + \xdef#1{\the\toks@\the\toks2}% + \endgroup}}% +\newif\ifmfp@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 + {\def\mfp@tempa{AmS-TeX}% + \ifx \fmtname\mfp@tempa \mfp@DBlog{AmS-TeX detected.}% + \else \mfp@DBlog{LaTeX detected.}\mfp@latextrue + \fi}% + {\mfp@DBlog{Neither LaTeX nor AmS-TeX detected.}}% +\newif\ifmfp@latexe \mfp@latexefalse \mfp@ifdefined\documentclass - {\@mfp@latexetrue \mfp@DBlog{LaTeX2e detected.}}% - {\mfp@DBlog{Not LaTeX2e.}}% -\newif\if@mfp@pdf \@mfp@pdffalse + {\mfp@latexetrue \mfp@DBlog{LaTeX2e detected.}}% + {\mfp@DBlog{Not LaTeX2e.}}% +\newif\ifmfp@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.}% + \ifnum\pdfoutput<1 \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 +\ifmfp@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 +\mfp@ifdefined\@namedef{}% + {\def\@namedef#1{\@xp\def\csname #1\endcsname}}% +\mfp@ifdefined\@namelet{}% + {\def\@namelet#1{\@xp\let\csname #1\endcsname}}% +\mfp@ifdefined\@nameuse{}% + {\def\@nameuse#1{\csname #1\endcsname}}% +\mfp@ifundefined\@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}}% + \fi\fi}% +\mfp@enddef \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.}% + \Mfpic@warn{\string#1 was previouly defined to be \string\relax.}% \else - \Mfpic@warn{\string #1 is already defined!}% + \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@useMP@error{% + \mfp@errmsg {Command \mfp@b usemetapost 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.}}% +\def\mfp@nooutput@error#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.}}% +\newdef\mfp@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.}}% +\def\mfp@afteropen@error#1{% + \mfp@errmsg{Improper use of command \string#1\on@line}% + {You must issue the command #1 prior to \opengraphsfile. + It will be ignored now.}}% +\newdef\mfp@end{% + \mfp@errmsg {Unexpected token \string\mfp@end}% + {If you get this message but did not misuse the command^^J% + \mfp@end, it could mean you have unbalanced braces.}}% +\newdef\mfp@nofile@error#1{% + \mfp@errmsg{No data file: #1}% + {The data file you tried to plot was not found.}}% +\newdef\mfp@nodata@error#1{% + \mfp@errmsg{Empty data file: #1}% + {The data file contained only empty lines and comments.}}% +\newdef\mfp@justify@error{% + \mfp@errmsg{Invalid justification parameter for text label}% + {The optional argument for an mfpic text label must be^^J% + one of B, b, c or t, followed by^^J + one of l, r or c, optionally followed by an angle.}}% +\newdef\mfp@untilwarn{% + \Mfpic@warn{\mfp@b mfploop without \string\mfpuntil!}}% +\newlet\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 + \nomplabels \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}% + \def\setmfpicgraphic##1{\mfp@graphfont\char\mfp@count}% + \def\getmfpicoffset##1{\gdef\mfpicllx{0}\gdef\mfpiclly{0}}}% +\newdef\mfp@ifopengraphsfile{\mfp@ifdefined\mfp@filename}% \newdef\setmfvariable#1#2#3{% - \@ifmfpfileisopen{\mfcmd{setvariable (#1) (#2) (#3)}}{}}% + \mfp@ifopengraphsfile{\mfcmd{setvariable (#1) (#2) #3}}% + {\mfp@nooutput@error\setmfvariable}}% \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\setmfboolean {\setmfvariable{boolean}}% +\newdef\setmfnumeric {\setmfvariable{numeric}}% +\newdef\setmfpair {\setmfvariable{pair}}% +\newdef\setmfcolor {\setmfvariable{color}}% +\newdef\globalsetmfvariable#1#2#3{% + \mfp@ifopengraphsfile{\mfcmd{gsetvariable (#1) (#2) #3}}% + {\mfp@nooutput@error\globalsetmfvariable}}% +\newlet\globalsetvariable\globalsetmfvariable +\newlet\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}% +\newdef\mfp@T{true}% +\newdef\mfp@F{false}% +\newdef\mfp@C{color}% +\newdef\usecenteredcaptions{\mfp@let\ifmfp@centcapt\iftrue}% +\newdef\nocenteredcaptions {\mfp@let\ifmfp@centcapt\iffalse}% \nocenteredcaptions +\newdef\useraggedcaptions{\mfp@let\mfp@capsettings\mfp@raggedcap}% +\newdef\noraggedcaptions{\mfp@let\mfp@capsettings\mfp@justifiedcap}% +\newdef\mfp@raggedcap{% + \ifmfp@latex + \ifmfp@centcapt \centering \else \raggedright \fi + \else + \rightskip 0pt plus 1fil + \ifmfp@centcapt + \leftskip 0pt plus 1fil + \parfillskip 0pt plus 1fil\relax + \fi + \def\\{\unskip\hbox{}\penalty-\@M\ignorespaces}% + \fi}% +\def\mfp@justifiedcap{% + \ifmfp@centcapt + \leftskip 0pt plus 0.5fil + \rightskip 0pt plus -0.5fil + \parfillskip 0pt plus 1fil\relax + \fi + \def\\{\unskip\hbox{}\hfil\penalty-\@M\ignorespaces}}% +\noraggedcaptions \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} + \newdef#1{\mfp@let#4\iftrue + \mfp@ifopengraphsfile{\setmfboolean{#3}\mfp@T}{}}% + \newdef#2{\mfp@let#4\iffalse + \mfp@ifopengraphsfile{\setmfboolean{#3}\mfp@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}% +\mfp@makeoption\clipmfpic\noclipmfpic{clipall}\ifmfp@clip +\mfp@makeoption\usetruebbox\notruebbox{truebbox}\ifmfp@truebbox +\newdef\usemplabels{\mfp@let\ifmfp@mplabels\iftrue + \mfp@ifopengraphsfile + {\mfp@ifmpost{}% + {\mfp@noMP@error{mplabels}\global\let\ifmfp@mplabels\iffalse}}{}}% +\newdef\nomplabels{\mfp@let\ifmfp@mplabels\iffalse}% \newdef\@ifmplabels{% - \if@mfp@mplabels\@xp\@firstoftwo\else\@xp\@secondoftwo\fi}% + \ifmfp@mplabels\@xp\@firstoftwo\else\@xp\@secondoftwo\fi}% \nomplabels +\newdef\mp@mksharpother{\@ifmplabels{\@makeother\#}{}}% \mfp@makeoption% - \overlaylabels\nooverlaylabels\if@mfp@overlabels{overlaylabels}% + \overlaylabels\nooverlaylabels{overlaylabels}\ifmfp@overlabels \mfp@makeoption% - \clearsymbols\noclearsymbols\if@mfp@clearsym{clearsymbols}% -\def\mfpicllx{0}% -\def\mfpiclly{0}% -\newdef\@setmfpicgraphic#1{% + \clearsymbols\noclearsymbols{clearsymbols}\ifmfp@clearsym +\mfp@makeoption\stopshipping\resumeshipping{noship}\ifmfp@noship +\newlet\noship\stopshipping +\newlet\ifmfp@readlog\iffalse +\newdef\mfpreadlog{% + \mfp@ifopengraphsfile + {\mfp@afteropen@error\mfpreadlog}{\global\let\ifmfp@readlog\iftrue}}% +\newdef\mfpicllx{0}% +\newdef\mfpiclly{0}% +\newdef\normal@setmfpgraphic#1{% \preparemfpicgraphic{#1}\setmfpicgraphic{#1}\getmfpicoffset{#1}}% +\newdef\nofile@setmfpgraphic#1{% + {\edef\mfp@tempa{#1}% + \vbox to 0pt{\vss + \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 \usemetafont \newdef\setfilename#1#2{#1.#2}% \newif\ifmfpicdraft -\newif\if@mfp@draft -\newif\if@mfp@final -\newif\if@mfp@nowrite +\newlet\ifmfp@draft\iffalse +\newlet\ifmfp@final\iffalse +\newlet\ifmfp@nowrite\iffalse \newdef\mfpicdraft{% - \@ifmfpfileisopen{\global\mfpicdrafttrue}% - {\global\@mfp@drafttrue}}% + \mfp@ifopengraphsfile{\global\mfpicdrafttrue}% + {\global\let\ifmfp@draft\iftrue}}% \newdef\mfpicfinal{% - \@ifmfpfileisopen{\global\mfpicdraftfalse}% - {\global\@mfp@finaltrue}}% + \mfp@ifopengraphsfile{\global\mfpicdraftfalse}% + {\global\let\ifmfp@final\iftrue}}% \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}}}% + \mfp@ifopengraphsfile{\mfp@afteropen@error\mfpicnowrite}% + {\global\let\ifmfp@nowrite\iftrue}}% +\newdef\usemetapost{% + \mfp@ifopengraphsfile{\mfp@mpostfalse\mfp@useMP@error}% + {\mfp@mposttrue \@usemetapost}}% +\ifmfp@latexe \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}% + \AtEndDocument{\mfp@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}}}}% + \mfp@msg{}\Mfpic@msg{\mfpfiledate\space v\mfpfileversion.\@nl}% + \newdef\mfp@useMP#1#2#3#4{% + \mfp@ifdefined#1{}{\input #2\relax}% + \global\let\setmfpicgraphic\mfp@includeMPS + \gdef\getmfpicoffset##1{\xdef\mfpicllx{#3}\xdef\mfpiclly{#4}}}% + \ifmfp@pdf + \newdef\mfp@includeMPS#1{\convertMPtoPDF{#1}{1}{1}}% + \newdef\@usemetapost{% + \mfp@useMP\convertMPtoPDF{supp-pdf}\MPllx\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}}}}% + \newdef\mfp@includeMPS#1{\epsfbox{#1}}% + \newdef\@usemetapost{\mfp@useMP\epsfbox{epsf}\epsfllx\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@ifundefined\@ifnextchar + \long\def\@ifnextchar#1#2#3{% + \let\reserved@d#1% + \def\reserved@a{#2}% + \def\reserved@b{#3}% + \futurelet\@let@token\@ifnch}% + \def\@ifnch{% + \ifx\@let@token\@sptoken + \let\reserved@c\@xifnch + \else + \ifx\@let@token\reserved@d + \let\reserved@c\reserved@a + \else + \let\reserved@c\reserved@b + \fi + \fi + \reserved@c}% + {% + \def\:{\global\let\@sptoken= }\: % this makes \@sptoken a space token + \def\:{\@xifnch}\@xp\gdef\: {\futurelet\@let@token\@ifnch}% + }% +\mfp@enddef +\def\mfp@iftoken#1#2{\@ifnextchar#1{\@firstoftwo{#2}}}% +\def\mfp@ifstar#1#2#3{\mfp@iftoken*{#1{#2}}{#1{#3}}}% +\def\mfp@ifend{\mfp@iftoken\mfp@end}% +\def\mfp@ifendorcomma#1#2#3{\mfp@ifend{#1}{\mfp@iftoken,{#2}{#3}}}% +{% + \catcode`Q3 \catcode`\~12 + \gdef\mfp@ifempty#1{\if~#1~\@xp\@firstoftwo\else\@xp\@secondoftwo\fi}% + \gdef\mfp@ifexist#1{\if~#1~\@xp\@gobble\else\@xp\@firstofone\fi}% + \gdef\mfp@emptysub#1#2{\if~#1~#2\else#1\fi}% + \long\gdef\@ifmtarg#1{\@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil}% + \long\gdef\@xifmtarg#1#2Q#3#4#5\@nil{#4}% +}% +\newdef\mfp@defaultopt#1#2{% + \@ifnextchar[{\mfp@ifemptyopt{#1}{#2}}{#1{#2}}}% +\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}}% \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 }}% + \gdef\mfp@obeylines{\catcode\mfp@ctrlM\active\let^^M\relax}% +}% +\newdef\mfp@keeplines{\newlinechar\mfp@ctrlM + \endlinechar\newlinechar \mfp@obeylines}% +\newdef\mfsrc {\mfp@write\mfp@src\mfsrc}% +\newdef\mfcmd {\mfp@write\mfp@cmd}% +\newdef\mflist{\mfp@write\mfp@wlist}% +\newdef\mfp@write{\begingroup\mfp@keeplines \let\@nl\@activectrlM}% +\newdef\mfp@src#1#2{% + \mfp@ifopengraphsfile{\immediate\write\mfp@out{#2}}% + {\mfp@nooutput@error{#1}}\endgroup}% +\newdef\mfp@cmd#1{\mfp@src\mfcmd{#1;}}% +\newdef\mfp@wlist#1{\mfp@src\mflist{(#1);}}% +\edef\mfp@p{\@xp\@gobble\string\%}% percent (%) +\edef\mfp@s{\@xp\@gobble\string\#}% sharp (#) +\edef\mfp@b{\@xp\@gobble\string\\}% backslash (\) +\newdef\mfp@d{--------------}% +\mfp@ifdefined\two@digits{}% + {\def\two@digits#1{\ifnum#1<10 0\fi\number#1}}% +{% + \mfp@ifdefined\normalmonth + {\let\month\normalmonth\let\year\normalyear}{}% + \count@\time \divide\count@ by 60 + \xdef\mfp@now{\number\year/\two@digits\month/\two@digits\day + \space at \two@digits\count@:}% + \multiply\count@ by -60 \advance\count@\time + \xdef\mfp@now{\mfp@now\two@digits\count@}% +}% \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{}% +\newif\ifmfp@switch \begingroup - \let\newtoks\relax - \@makeother\%\@makeother\#\preservelines - \global\mfp@commonverbatimtex= - {\def\MFPtext#1{% - \vbox{\def\\{\cr}\MFPcfont\everylabel - \halign{##\hfil\cr#1\crcr}}}% + \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 +\newdef\mfp@versioninfo{% + \mfp@p\space\mfp@filename.m\mfp@ifmpost{p}{f}, + generated by Mfpic, v\mfpfileversion\space\mfpfiledate,\@nl + \mfp@p\space from TeX source "\jobname" on \mfp@now\@nl + numeric mfpicversion; mfpicversion:=\mfpicversion;\@nl}% +\newdef\mfp@init@outfile{% + if unknown mode: mode = localfont; fi\@nl + if unknown mag: mag = \number\mag/1000; fi\@nl + if unknown grafbase: input grafbase; fi\@nl\@nl}% +\newdef\mfp@versioncheck{% + 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}% +\newdef\mfp@openfile{% + \ifmfp@nowrite \else \mfp@msg{}% + \Mfpic@msg{Initializing \mfp@filename\mfp@ext.}% + \immediate\openout\mfp@out=\mfp@filename\mfp@ext\relax + \Mfpic@msg{Don't forget to process \mfp@filename\mfp@ext!}% + \Mfpic@msg{Apply \mfp@progname\space to \mfp@filename\mfp@ext% + \mfp@ifmpost{}{, then gftopk to the resulting gf file}.}% + \Mfpic@msg{Then reprocess this file "\jobname".\@nl}% + \fi}% +\mfp@ifundefined\IfFileExists + \def\IfFileExists#1{\openin\mfp@graph=#1\relax + \ifeof\mfp@graph \@xp\@secondoftwo + \else \immediate\closein\mfp@graph \@xp\@firstoftwo + \fi}% + \def\InputIfFileExists#1#2{\IfFileExists{#1}{#2\input #1\relax}}% +\mfp@enddef +\newdef\mfp@checkoutput#1#2#3{% + \IfFileExists{\setfilename\mfp@filename{#1}}% + {\global\mfpicdraftfalse #2}% + {\global\mfpicdrafttrue #3\mfp@msg{}% + \Mfpic@msg{No file \setfilename\mfp@filename{#1}.}% + }}% +\newdef\mfp@checkMPoutput{\mfp@checkoutput{\number\mfp@count}{}{}}% +\newdef\mfp@checkMFoutput{\mfp@checkoutput{tfm}% + {\global\font\mfp@graphfont\mfp@filename\relax}% + {\global\let\mfp@graphfont\mfp@dummy}}% +\newdef\mfp@MPextras{\mfp@toks\@xp{\every@tlabel}% + \mfsrc{% + if unknown Apricot: input dvipsnam.mp; fi\@nl + verbatimtex\@nl + \ifmfp@verbtex \the\mfp@verbtex\@nl \fi + \the\mfp@commonverbatimtex\@nl + \def\noexpand\everylabel{\the\mfp@toks}\@nl + etex;\@nl}% + \global\mfp@verbtexfalse \global\mfp@verbtex{}% + \@ifmplabels\usemplabels{}% + \ifmfp@truebbox \usetruebbox \fi + \ifmfp@overlabels \overlaylabels \fi}% \mfp@DBlog{Macros to open and close graphs files.}% \newdef\opengraphsfile#1{\@bsphack - \@ifmfpfileisopen% + \def\mfp@tempa{#1}% + \mfp@ifopengraphsfile% {\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}% + {\@nl An attempt has been made to open a graph file, + \mfp@sanitized\mfp@tempa\@msgbreak + while another, \mfp@filename, is still open. \@msgbreak + Closing \mfp@filename.}\mfp@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 + \xdef\mfp@filename{\mfp@sanitized\mfp@tempa} + \xdef\mfp@progname{meta\mfp@ifmpost{pos}{fon}t}% + \xdef\mfp@ext{.m\mfp@ifmpost{p}{f}}% + \mfp@ifmpost\mfp@checkMPoutput\mfp@checkMFoutput + \mfp@openfile + \ifmfp@draft \global\mfpicdrafttrue \fi + \ifmfp@final \global\mfpicdraftfalse \fi + \ifmfp@nowrite \gdef\mfp@src##1##2{\endgroup}\fi + \mfsrc{\mfp@versioninfo\mfp@init@outfile\mfp@versioncheck}% + \mfp@ifmpost\mfp@MPextras{}% + \ifmfp@clip \clipmfpic \fi + \ifmfp@clearsym \clearsymbols \fi + \ifmfp@noship \stopshipping \fi + \ifmfp@readlog \mfp@readlogfile \fi \@esphack}% \newdef\closegraphsfile{% - \@ifmfpfileisopen{}{\nooutputfileerror\closegraphsfile}% - \@closegraphsfile \global\let\mfp@filename\UndEfInEd}% -\newdef\@closegraphsfile{% - \@ifmfpfileisopen - {\if@mfp@nowrite \else + \mfp@ifopengraphsfile{}{\mfp@nooutput@error\closegraphsfile}% + \mfp@closegraphsfile}% +\newdef\mfp@closegraphsfile{% + \mfp@ifopengraphsfile + {\ifmfp@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.}}% + \fi \global\let\mfp@filename\UndEfInEd}{}}% +\edef\mfpicvalue{\string\mfpicvalue}% +\newdef\mfp@cmdname{% + mfpic-\ifin@mfpicenv\number\mfp@count\fi-\@xp\@gobble\string}% +\newdef\assignmfvalue{\mfp@assign\@empty}% +\newdef\globalassignmfvalue{\mfp@assign\global}% +\newdef\mfp@assign#1#2#3{% + #1\edef#2{% + \@ifundefined{\mfp@cmdname#2}{???}{\@nameuse{\mfp@cmdname#2}}}% + \@ifundefined{\mfp@cmdname#2}% + {\mfp@msg{}\Mfpic@msg{No value for \string#2 in mfpic figure + \number\mfp@count.\@nl}}% + {}% + \mfsrc{\@ifmplabels{\@nl verbatimtex #1\def\string#2{#2} etex;\@nl}{}% + message "\string\mfpicvalue";\@nl + message "\mfp@cmdname#2";\@nl + show #3;\@nl + message "";}}% +\newlet\assignmpvalue\assignmfvalue +\newlet\globalassignmpvalue\globalassignmfvalue +\newdef\strip@gtgt>> #1\mfp@end{#1}% +\newdef\mfp@readlogfile{% + \openin\mfp@data=\mfp@filename.log\relax + \ifeof\mfp@data \Mfpic@msg{No file \mfp@filename.log.}% + \else + {% + \mfp@resetwhitespace \endlinechar -1 + \catcode`\>12 + \def\@mfpicvalue{\mfpicvalue}% + \message{< Mfpic: Reading \mfp@filename.log}% + \mfp@readloglines + \message{>}% + }% + \fi \closein\mfp@data}% +\newdef\mfp@readloglines{% + \read\mfp@data to \mfp@tempa + \ifeof\mfp@data + \else + \ifx\mfp@tempa\@mfpicvalue + \read\mfp@data to \mfp@tempa + \read\mfp@data to \mfp@tempb + \@XP\xdef\@nameuse\mfp@tempa{\@xp\strip@gtgt\mfp@tempb\mfp@end}% + \fi + \@xp\mfp@readloglines + \fi}% \mfp@DBlog{Using dummy font's dimensions, to spare TeX registers.}% \font\mfp@dummy=dummy scaled 1042 -\fontdimen100\mfp@dummy=0pt +\fontdimen100\mfp@dummy0pt \newcount\mfp@fdc -\mfp@fdc=22 +\mfp@fdc22 \newdef\newfdim#1{% - \global\advance\mfp@fdc 1 + \global\advance\mfp@fdc1 \xdef#1{\fontdimen\number\mfp@fdc\mfp@dummy}% - \wlog{\string#1=\string\fontdimen\number\mfp@fdc\mfp@dummy}}% + \wlog{\string#1=\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. +\newdef\tb@ht{\ht\@textbox}% +\newdef\tb@dp{\dp\@textbox}% +\newdef\tb@wd{\wd\@textbox}% \newbox\@alltlabels +\newbox\@backtext \newfdim\@tlabelstop \newfdim\@tlabelsbot \newfdim\@tlabelsleft -\newfdim\@tlabelsright \mfp@DBlog{Internal dimension parameters for graph dimensions...}% -\newfdim\@graphwd \newfdim\@graphright \newfdim\@graphleft \newfdim\@graphtop @@ -510,59 +592,65 @@ \newfdim\tlabel@hadj \newfdim\tlabel@vadj \newfdim\tlabel@sep -\tlabel@hadj=0pt -\tlabel@vadj=0pt -\tlabel@sep=0pt +\newfdim\tlpath@sep +\tlabel@hadj0pt +\tlabel@vadj0pt +\tlabel@sep0pt +\tlpath@sep0pt \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 +\newfdim\mfpicunit +\newfdim\@mfpicunit % internal version +\newfdim\pointsize +\newfdim\shadespace +\newfdim\polkadotspace +\newfdim\hatchspace +\newfdim\headlen +\newfdim\axisheadlen +\newfdim\sideheadlen +\newfdim\hashlen +\newfdim\dashlen +\newfdim\dashspace +\newfdim\dotsize +\newfdim\griddotsize +\newfdim\dotspace +\newfdim\symbolspace +\mfpicunit1pt +\pointsize2pt +\shadespace1pt +\polkadotspace10pt +\hatchspace3pt +\headlen3pt +\axisheadlen5pt +\sideheadlen0pt +\hashlen4pt +\dashlen4pt +\dashspace4pt +\dotsize0.5pt +\griddotsize0.5pt +\dotspace3pt +\symbolspace5pt \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}}% + \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 + \griddotsize \the\griddotsize + \dotspace \the\dotspace + \symbolspace \the\symbolspace + \tlabel@hadj \the\tlabel@hadj + \tlabel@vadj \the\tlabel@vadj + \tlabel@sep \the\tlabel@sep + \tlpath@sep \the\tlpath@sep}}% \newdimen\mfp@scratch -\newdimen\mfp@scratchB \newdimen\mfpframesep \newdimen\mfpframethickness \newdimen\mfpicheight @@ -570,385 +658,387 @@ \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}% +\mfpiccaptionskip\medskipamount +\def\mfpicnumber#1{\global\mfp@count#1\relax}% +\newdef\mfpaddto#1#2{\mfp@scratch#1pt \advance\mfp@scratch#2pt + \edef#1{\strip@pt\mfp@scratch}}% +\newdef\mfpmultiply#1#2{\mfp@scratch#1pt \mfp@scratch#2\mfp@scratch + \edef#1{\strip@pt\mfp@scratch}}% +\mfp@ifundefined\strip@pt + \begingroup + \lccode`\/`\p + \lccode`\?`\t + \lowercase{% + \endgroup + \def\rem@pt#1.#2/?}{#1\ifnum#2>\z@.#2\fi}% + \def\strip@pt{\@xp\rem@pt\the}% +\mfp@enddef \newdef\pointdef#1(#2,#3){% + \@ifundefined{#1} {}{\Mfpic@warn{\mfp@b#1 already defined.}}% + \@ifundefined{#1x}{}{\Mfpic@warn{\mfp@b#1x already defined.}}% + \@ifundefined{#1y}{}{\Mfpic@warn{\mfp@b#1y already defined.}}% \@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}% +\newdef\setmfarray#1#2{\mfsrc{setarray (#1) (#2)}\mfp@writedata}% +\newlet\setmparray\setmfarray +\newdef\pairarray{\setmfarray{pair}}% +\newdef\numericarray{\setmfarray{numeric}}% +\newdef\colorarray{\setmfarray{color}}% +\newdef\globalsetmfarray#1#2{\mfsrc{gsetarray (#1) (#2)}\mfp@writedata}% +\newdef\lightershade{\shadespace1.2\shadespace}% +\newdef\darkershade{\shadespace.83333\shadespace}% +\newdef\dashlineset{\dashlen4pt \dashspace4pt }% +\newdef\dotlineset{\dashlen1pt \dashspace2pt }% \let\ifpointfill\iftrue \newdef\pointfilltrue{\mfp@let\ifpointfill\iftrue}% \newdef\pointfillfalse{\mfp@let\ifpointfill\iffalse}% +\newdef\mfpfor#1{\begingroup\mfsrc{for #1:}}% +\newdef\endmfpfor{\mfsrc{endfor}\endgroup}% +\newdef\mfploop{% + \begingroup\mfsrc{forever:}\let\@nountil\mfp@untilwarn}% +\newdef\mfpuntil#1{\mfcmd{exitif #1}\let\@nountil\@empty}% +\newdef\endmfploop{\@nountil\endmfpfor}% +\newdef\mfpwhile#1{\begingroup\mfcmd{forever: exitif not(#1)}}% +\newlet\endmfpwhile\endmfpfor +\newdef\plr#1{map (polar) (#1)}% +\newdef\midpoint#1{(0.5[#1])}% \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}% +\newif\if@mfpstart\@mfpstarttrue +\newif\if@mfprend\@mfprendtrue +\newdef\mfp@storepath{\mfsrc{\@nl store (curpath)}}% +\newdef\mfp@first{\relax + \if@mfpstart \mfp@storepath \@mfprendtrue \@mfpstartfalse\fi}% +\newdef\mfp@rendmac{\mfp@first \@mfprendfalse \mfsrc}% +\newdef\mfp@modmac{\mfp@first\mfp@autorend\mfsrc}% +\newdef\mfp@autorend{\if@mfprend\@xp\mfp@render\fi}% +\newdef\mfp@addmac{\mfp@first \mfsrc}% +\newdef\mfp@render{\draw[]}% +\newdef\setrender#1{\mfp@def\mfp@render{#1}}% +\newdef\mfp@figmacbase{\mfp@first \mfp@autorend \@mfpstarttrue}% +\newdef\mfp@figmac{\mfp@figmacbase\mfcmd}% +\newdef\mfp@listmac#1{\mfp@figmacbase\mfsrc{#1}\mfp@writedata}% +\newdef\mfp@writedata{\mfp@iftoken\datafile{\mfp@writefile}{\mflist}}% +\newdef\mfp@writefile{% + \mfp@ifopengraphsfile + {\mfp@processfile{\mfp@rwdata}}{\mfp@nooutput@error\datafile}}% +\newdef\mftitle#1{\@bsphack\mfp@title\mftitle{#1}\@esphack}% +\newdef\tmtitle#1{\mfp@title\tmtitle{#1}\wlog{\the\mfp@toks}{#1}}% +\newdef\mfp@title#1#2{\mfp@toks{#2}% + \mfp@write\mfp@src#1{mftitle "\the\mfp@toks";}}% +\newdef\mfp@processfile#1#2{% + \openin\mfp@data=#2\relax + \ifeof\mfp@data \mfp@nofile@error{#2}% \else - \begingroup + \mfp@DBlog{Opening file #2 for data.}% + {% \mfp@resetwhitespace \mfp@setcomment - \skipBlanksandComments - \ifeof\mfp@data \emptydatafileerror{#1}\else #2\fi - \global\mfp@n=\mfp@linetype - \endgroup - \mfp@linetype=\mfp@n + \mfp@skipblanklines + \ifeof\mfp@data + \mfp@nodata@error{#2}% + \else + \message{< Mfpic: Reading #2}% + #1% + \message{>}% + \fi + \@xp + }\@xp\mfp@linetype\number\mfp@linetype\relax + \mfp@DBlog{Closing file #2.}% \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 +\newdef\mfp@resetwhitespace{\mfp@restorepar + \endlinechar`\^^M \catcode`\^^M5 \catcode`\ 10 \catcode`\^^I10 }% +\newdef\mfp@skipcomments{\read\mfp@data to \mfp@temp + \ifx\mfp@temp\@empty \@xp\mfp@skipcomments\fi}% +\newdef\mfp@skipblanklines{\mfp@skipcomments \ifeof\mfp@data - \else\ifx\mfp@temp\mfp@par \@XP\skipBlanksandComments + \else\ifx\mfp@temp\mfp@par \@XP\mfp@skipblanklines \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)}% +\newdef\mfp@nextdatum{\@xp\parse@data\mfp@temp\mfp@end}% +\newdef\mfp@rwdata{\mfp@count1 \mfp@sequence1 + \def\sequence{\number\mfp@sequence}% + \edef\mfp@temp{\mfp@temp\space}% + \edef\mfp@buffer{(\mfp@nextdatum}\mfp@rwdataloop}% +\newdef\mfp@rwdataloop{% + \read\mfp@data to \mfp@temp + \ifx\mfp@temp\mfp@par + \mfcmd{\mfp@buffer)}% + \else + \ifx\mfp@temp\@empty \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}% + \edef\mfp@temp{\mfp@temp\space}% + \advance\mfp@sequence1 + \edef\mfp@buffer{\mfp@buffer\mfp@join}% + \ifnum\mfp@count<\mfpdataperline\relax \advance\mfp@count1 + \else \mfsrc{\mfp@buffer}\mfp@count1 \def\mfp@buffer{}% \fi - \@xp\mfp@rwdataloop - \fi}% -\newdef\drawpen#1{\mfcmd{\@nl resizedrawpen (#1)}}% -\newlet\pen=\drawpen \newlet\penwd=\drawpen + \edef\mfp@buffer{\mfp@buffer\mfp@nextdatum}% + \fi + \@xp\mfp@rwdataloop + \fi}% +\newdef\pen#1{\mfcmd{\@nl resizedrawpen (#1)}}% +\newlet\penwd\pen \newlet\drawpen\pen \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\dashpattern#1{\mfsrc{save #1; dashpat (#1)}\mfp@writedata}% \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} +\newdef\mfp@tlh@l{-1}% +\newdef\mfp@tlh@c{0}% +\newdef\mfp@tlh@r{1}% +\newdef\mfp@tlv@B{-1}% +\newdef\mfp@tlv@b{0}% +\newdef\mfp@tlv@c{1}% +\newdef\mfp@tlv@t{2}% +\newdef\tl@rot{}\tl@vpos-1 \tl@hpos-1 +\newdef\tlabeljustify#1{\mfp@ifexist{#1}{\mfp@justify#1\mfp@end}}% +\newdef\mfp@justify#1#2\mfp@end{\mfp@local\mfp@vconv{#1}% + \mfp@ifexist{#2}{\mfp@@justify#2\mfp@end}}% +\newdef\mfp@@justify#1#2\mfp@end{\mfp@local\mfp@hconv{#1}% + \mfp@local\edef\tl@rot{#2}% \@ifmplabels{}% - {\mfp@ifempty{#2}{}% + {\mfp@ifexist{#2}% {\Mfpic@warn{Rotation of labels is not supported without the - mplabels\@msgbreak option. Rotation may be ignored\@online .}}}}% + mplabels\@msgbreak option. Rotation setting\on@line\space + may be ignored.}}% + }}% \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}% + \@ifundefined{mfp@tlv@#1}% + {\tl@vpos-1 \mfp@justify@error}% + {\tl@vpos\@nameuse{mfp@tlv@#1}\relax}}% \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).}}% + \@ifundefined{mfp@tlh@#1}% + {\tl@hpos-1 \mfp@justify@error}% + {\tl@hpos\@nameuse{mfp@tlh@#1}\relax}}% \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@ifexist{#1}{\tlp@justify#1\mfp@end}}% +\newdef\tlp@justify#1#2\mfp@end{\mfp@def\tlpath@v{#1}% + \mfp@ifexist{#2}{\tlp@@justify#2\mfp@end}}% +\newdef\tlp@@justify#1#2\mfp@end{% \mfp@def\tlpath@h{#1}\mfp@def\tlpath@r{#2}}% \tlpathjustify{cc}% -\newdef\tlabelsep#1{\mfp@local\tlabel@sep=#1\relax +\newdef\tlpointsep#1{\mfp@local\tlabel@sep#1\relax \setmfnumeric{label_sep}{\the\tlabel@sep}}% +\newdef\tlpathsep#1{\mfp@local\tlpath@sep#1\relax + \setmfnumeric{labelpath_sep}{\the\tlpath@sep}}% +\newdef\tlabelsep#1{\tlpointsep{#1}\tlpathsep{#1}}% \newdef\tlabeloffset#1#2{% - \mfp@local\tlabel@hadj=#1\relax \mfp@local\tlabel@vadj=#2\relax - \setmfvariable{pair}{label_adjust}% + \mfp@local\tlabel@hadj#1\relax \mfp@local\tlabel@vadj#2\relax + \setmfpair{label_adjust}% {(\the\tlabel@hadj,\the\tlabel@vadj)}}% -\newdef\everytlabel{\afterassignment\@everytlabel - \mfp@local\every@tlabel}% -\newdef\@everytlabel{% +\newdef\everytlabel{\afterassignment\mfp@everytlabel\mfp@toks}% +\newdef\mfp@everytlabel{\mfp@local\edef\every@tlabel{\the\mfp@toks}% \mfp@ifmpost - {\@ifmfpfileisopen + {\mfp@ifopengraphsfile {\mfcmd{verbatimtex\@nl - \def\noexpand\everylabel{\the\every@tlabel} etex}}% + \def\noexpand\everylabel{\the\mfp@toks} etex}}% {}}% {}}% +\newdef\every@tlabel{}% +\newdef\extra@endtlabel{}% +\newdef\pinumber{3.14159}% \newdef\headshape#1#2#3{\mfcmd{\@nl headshape (#1, #2, #3)}}% +\newdef\mfp@arr@b#1{\edef\mfp@hlocate{#1}}% +\newdef\mfp@arr@c#1{\edef\mfp@hcolour{#1}}% +\newdef\mfp@arr@l#1{\edef\mfp@hlength{#1}}% +\newdef\mfp@arr@r#1{\edef\mfp@hrotate{#1}}% +\newlet\mfp@arr@f\mfp@arr@b +\newlet\mfp@arr@s\mfp@arr@l +\newdef\mfp@arc@s{pps}% +\newdef\mfp@arc@t{ppp}% +\newdef\mfp@arc@p{\ifmfp@switch plr\fi}% +\newdef\mfp@arc@a{\ifmfp@switch alt\fi}% +\newdef\mfp@arc@c{cp\ifmfp@switch s\fi}% +\newdef\mfp@arc@r{pp (\mfp@T)}% +\newdef\mfp@arc@q{pp (\mfp@F)}% \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\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}% +\mfp@newcolorcmd{hatch}\mfp@newcolorcmd{head}\mfp@newcolorcmd{point}% +\def\backgroundcolor{\mfp@nullopt{\mfp@defclr{background}}}% \newdef\dashedlines{\mfp@local\mfp@linetype0 - \mfp@def\mfp@setstyle{\gendashed{getdashpat\number\mfp@linetype}}}% + \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 + \mfp@def\mfp@setstyle{\draw[getcolor \number\mfp@linetype]}}% + {\Mfpic@warn{You can't use \mfp@b coloredlines in Metafont.\@msgbreak Using \dashedlines instead}% \dashedlines}}% \newdef\pointedlines{\mfp@local\mfp@linetype0 - \mfp@def\mfp@setstyle{\plot{getsymbol\number\mfp@linetype}}}% + \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}% +\newdef\mfplinetype#1{\mfp@local\mfp@linetype#1\relax}% \newlet\mfplinestyle\mfplinetype \mfplinetype{0}% -\newdef\mfp@lshift{0}% -\newdef\mfp@bshift{0}% -\newdef\mfp@rshift{0}% -\newdef\mfp@tshift{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}}% + \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}% +\def\mfp@axis@x{0}% +\def\mfp@axis@y{1}% +\def\mfp@axis@l{2}% +\def\mfp@axis@b{3}% +\def\mfp@axis@r{4}% +\def\mfp@axis@t{5}% +\def\mfp@getaxis#1#2\mfp@end#3{% + \@ifundefined{mfp@axis@#1}% + {\mfp@errmsg {Invalid axis letter "#1"}% + {The command #3 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.}\def\mfp@axisnum{0}\def\mfp@axisletter{x}}% + {\edef\mfp@axisnum{\@nameuse{mfp@axis@#1}}\def\mfp@axisletter{#1}}% + \edef\mfp@defheadlen{% + \the\ifnum\mfp@axisnum>1 \sideheadlen\else \axisheadlen\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{}}% +\newdef\mfp@smdata#1{\mfp@def\mfp@smoothness{#1}% + \mfp@nullopt{\mfp@def\mfp@tension}}% +\newdef\smoothdata{\mfp@smdata{s}}% +\newdef\unsmoothdata{\mfp@smdata{p}\@empty}% \unsmoothdata% default -\newdef\using#1#2{\mfp@def\parse@data#1\mfp@delim{#2}}% +\newdef\using#1#2{\mfp@def\parse@data#1\mfp@end{#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\mfp@par{\par}\newdef\mfp@join{,}% +\newcount\mfp@commentchar \mfp@commentchar`\%% \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 +\newdef\makepercentcomment{\catcode`\%14 }% +\newdef\mfpdatacomment#1{\mfp@local\mfp@commentchar`#1}% +\newdef\mfp@setcomment{\makepercentother\catcode\mfp@commentchar14 }% +\newdef\fdef{\begingroup\@makeother\#\mfp@keeplines\mfp@fdef}% +\newdef\mfp@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}{}}% +\newdef\mfp@grafmacs{% + \newdef\rect##1{\mfp@figmac{rect (##1)}}% + \newdef\regpolygon##1##2##3##4{% + \mfp@figmac{regularpolygon (##1) (##2) (##3; ##4;)}}% + \def\circle{\mfp@switchfalse\mfp@defaultopt\mfp@arccircle{p}}% + \newdef\ellipse{\mfp@defaultopt\mfp@ellipse{0}}% + \newdef\sector##1{\mfp@figmac{sector (##1)}}% + \newdef\arc{\mfp@iftoken*{\arccomplement\mfp@arc}{\mfp@arc}}% + \newdef\lines{\mfp@listi{polyline}\mfp@F}% + \newdef\polygon{\mfp@listi{polyline}\mfp@T}% + \newdef\computedspline{\mfp@listi{dospline}\mfp@F}% + \newdef\closedcomputedspline{\mfp@listi{dospline}\mfp@T}% + \newdef\qspline{\mfp@listi{qspline}\mfp@F}% + \newdef\closedqspline{\mfp@listi{qspline}\mfp@T}% + \newdef\cspline{\mfp@listi{cspline}\mfp@F}% + \newdef\closedcspline{\mfp@listi{cspline}\mfp@T}% + \newdef\qbeziers{\mfp@listi{qbezier}\mfp@F}% + \newdef\closedqbeziers{\mfp@listi{qbezier}\mfp@T}% + \newdef\fcnspline{\mfp@listi{fcnspline}\mfp@F}% + \newdef\periodicfcnspline{\mfp@listi{fcnspline}\mfp@T}% + \newlet\closedpolyline\polygon + \newlet\polyline\lines + \newdef\curve{\mfp@curve{curve}\mfp@F}% + \newdef\cyclic{\mfp@curve{curve}\mfp@T}% + \newdef\convexcurve{\mfp@curve{ccurve}\mfp@F}% + \newdef\convexcyclic{\mfp@curve{ccurve}\mfp@T}% + \newdef\mfbezier{\mfp@curve{bezier}\mfp@F}% + \newdef\closedmfbezier{\mfp@curve{bezier}\mfp@T}% + \newlet\closedcurve\cyclic + \newlet\closedconvexcurve\convexcyclic + \newdef\fcncurve{\mfp@nullopt\mfp@fcncurve}% + \newdef\turtle{\mfp@listmac{turtle}}% + \newdef\function{\mfp@fcn{function}s}% + \newdef\parafcn{\mfp@fcn{parafcn}s}% + \newdef\plrfcn{\mfp@fcn{plrfcn}s}% + \newdef\btwnfcn{\mfp@btwn{btwnfcn}}% + \newdef\btwnplrfcn{\mfp@btwn{btwnplrfcn}}% + \newdef\belowfcn{\mfp@fcn{belowfcn}p}% + \newdef\plrregion{\mfp@fcn{plrregion}p}% + \def\levelcurve{\mfp@fcn{levelset}p}% + \newdef\plotdata{\mfp@nullopt\mfp@plotdata}% + \newdef\datafile{\mfp@nullopt\mfp@datafile}% + \newdef\store##1##2{\mfp@rendmac{stored (##1)}##2}% + \newdef\norender{\mfp@first\@mfprendfalse}% + \newlet\mfobj\mfp@figmac \newlet\mpobj\mfobj + \newdef\mfpimage{\mfp@defaultopt\mfp@image{(0,0)}}% + \newdef\endmfpimage{\mfcmd{\@nl concludeimage}}% + \newdef\putmfpimage##1{\mfsrc{\@nl putimage (##1)}\mfp@writedata}% + \newdef\cutoffafter {\mfp@modi{cutoffafter}}% + \newdef\cutoffbefore{\mfp@modi{cutoffbefore}}% + \newdef\trimpath##1{\mfp@getdimens##1,,\mfp@end + \mfp@modi{trimmedpath}\mfp@thedimens}% + \newdef\partpath{\mfp@modi{partialpath}}% + \newdef\subpath{\mfp@modi{gsubpath}}% + \newdef\draw{\mfp@nullopt{\mfp@clroptrend{drawn}}}% + \newdef\doubledraw{\mfp@defaultopt\mfp@doubledraw{2penwd}}% + \newdef\dashed{\mfp@optrendi{DASHED}{\the\dashlen,\the\dashspace}}% + \newdef\dotted{\mfp@optrendi{dotted}{\the\dotsize,\the\dotspace}}% + \newdef\gendashed{\mfp@rendi{gendashed}}% + \newdef\zigzag{\mfp@rendi{zigzag}}% + \newdef\sinewave {\mfp@defaultopt{\mfp@wiggle{sinewave}}1}% + \newdef\coil{\mfp@defaultopt{\mfp@wiggle{corkscrew}}1}% + \newlet\corkscrew\coil + \newdef\plot{\mfp@optrendii{doplot}{\the\pointsize,\the\symbolspace}}% + \newdef\plotnodes{\mfp@optrendii{plotnodes}{\the\pointsize}}% + \newdef\showcontrols{\mfp@optrendii{showcontrols}{\the\pointsize}}% + \newdef\bclosed{\mfp@nullopt{\mfp@close b}}% + \newdef\sclosed{\mfp@nullopt{\mfp@close s}}% + \newdef\lclosed{\mfp@close l{}}% + \newdef\cbclosed{\mfp@close{cb}{}}% + \newdef\qbclosed{\mfp@close{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)}}% + \newdef\makesector{\mfp@modmac{makesector}}% + \newdef\tess{\mfp@rendi{tess}}% + \newdef\shade{\mfp@optrendi{shade}{\the\shadespace}}% + \newdef\polkadot{\mfp@optrendi{polkadot}{\the\polkadotspace}}% + \newdef\thatch{\mfp@defaultopt\mfp@thatch{\the\hatchspace,0}}% + \newdef\lhatch{\mfp@defaultopt\mfp@lhatch{\the\hatchspace}}% + \newdef\rhatch{\mfp@defaultopt\mfp@rhatch{\the\hatchspace}}% + \newdef\xhatch{\mfp@defaultopt\mfp@xhatch{\the\hatchspace}}% + \newlet\hatch\xhatch + \newdef\gfill{\mfp@nullopt{\mfp@clroptrend{filled}}}% + \newdef\gclear{\mfp@rendmac{unfilled}}% + \newdef\gclip{\mfp@rendmac{Clip}}% + \newdef\reverse{\mfp@addmac{reverse}}% + \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\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\yslantpath{\mfp@modi{yslantedpath}}% + \newdef\reflectpath{\mfp@modi{reflectedpath}}% + \newdef\transformpath{\mfp@modi{transformedpath}}% + \newdef\parallelpath{\mfp@modi{parapath}}% + \newdef\randomizepath{\mfp@modi{randompath}}% + \newdef\randomlines{\mfp@modi{randomlines}}% + \newdef\arccomplement{\mfp@modmac{arccomplement}}% + \newdef\arrowhead{\mfp@ifstar\mfp@arrowhead\mfp@T\mfp@F}% + \def\arrow{\mfp@ifstar\mfp@arrow{x}{}}% + \newdef\arrowtail##1{\mfp@arr 0{tailpath (##1)}}% + \newdef\arrowmid##1{\mfp@arr{0.5}{midpath (##1)}}% \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\turn{\mfp@defaultopt\mfp@turn{(0,0)}}% + \newdef\reflectabout##1##2{\applyT{reflectedabout (##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}}% @@ -959,478 +1049,467 @@ \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\xaxis{\mfp@defaultopt{\mfp@simple{xaxis}}{\the\axisheadlen}}% + \newdef\yaxis{\mfp@defaultopt{\mfp@simple{yaxis}}{\the\axisheadlen}}% + \newdef\axes{\mfp@defaultopt {\mfp@simple{axes}}{\the\axisheadlen}}% + \newdef\axis{\mfp@nullopt\mfp@axis}% + \newdef\axisline##1{\mfp@figmac{axisline.##1}}% + \newdef\doaxes{\mfp@nullopt\mfp@doaxes}% + \newdef\border{\mfp@figmac{borderrect}}% + \newdef\axismarks##1{\mfp@defaultopt{\mfp@marks{##1}}{\the\hashlen}}% \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}}% + \def\grid{\mfp@defaultopt{\mfp@simplei{vargrid}}{\the\griddotsize}}% + \newlet\gridpoints\grid \newlet\lattice\grid + \newdef\gridlines{\mfp@simple{gridlines}}% + \newdef\vgridlines{\mfp@simple{vgridlines}}% + \newdef\hgridlines{\mfp@simple{hgridlines}}% + \newdef\plrgrid{\mfp@simple{polargrid}}% + \newdef\plrgridpoints{% + \mfp@defaultopt{\mfp@simplei{polargridpoints}}{\the\griddotsize}}% + \newdef\gridarcs{\mfp@simple{gridarcs}}% + \newdef\gridrays{\mfp@simple{gridrays}}% + \newdef\plrpatch{\mfp@simple{polarpatch}}% + \newdef\vectorfield{\mfp@defaultopt{\mfp@vectorfield{}}{\the\headlen}} + \newdef\plrvectorfield{% + \mfp@defaultopt{\mfp@vectorfield{plr}}{\the\headlen}} + \newdef\point{\mfp@defaultopt\mfp@point{\the\pointsize}}% + \newdef\plotsymbol{\mfp@defaultopt\mfp@plotsymbol{\the\pointsize}}% + \newdef\plottext{\begingroup\mfp@resetwhitespace\mp@mksharpother + \mfp@defaultopt\mfp@plottext{cc}}% + \newdef\tile{\mfp@simple{tile}}% + \newdef\endtile{\mfcmd{\@nl endtile}}% \newdef\patharr##1{\begingroup \mfsrc{hide(numeric ##1; path ##1[]; ##1 = 0)}% - \def\store@path{\mfsrc{\@nl store (##1[incr ##1])}}% + \def\mfp@storepath{\mfsrc{\@nl store (##1[incr ##1])}}% \setrender{}}% \newdef\endpatharr{\endgroup}% - \newdef\connect{\@figmac{begingroup; save nexus}% - \patharr{nexus}}% + \newdef\connect{\mfp@figmac{begingroup; save mfpicnexus}% + \patharr{mfpicnexus}}% \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 + \mfcmd{\@nl mkpoly (\mfp@F, mfpicnexus)\@nl endgroup}% + \mfp@checklatexenv{connect}{\aftergroup\@mfpstarttrue}{}}% + \newlet\piechart\mfppiechart + \newdef\piewedge{\mfp@defaultopt\mfp@piewedge{d}}% + \newlet\barchart\mfpbarchart + \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\chartbar##1{\mfp@figmac{chartbar[##1]}}% + \newlet\graphbar\chartbar + \newlet\histobar\chartbar + \newlet\ganttbar\chartbar +}% end \mfp@grafmacs +\newdef\mfppiechart{\mfp@defaultopt\mfp@piechart{c}}% +\newdef\mfpbarchart{\mfp@defaultopt\mfp@barchart{0,1,1}}% +\newlet\mfpbargraph\mfpbarchart +\newlet\mfphistogram\mfpbarchart +\newlet\mfpgantt\mfpbarchart +\newdef\mfp@arc{\mfp@switchtrue\mfp@defaultopt\mfp@arccircle{s}}% +\newdef\arc@or@circle{\ifmfp@switch arc\else circle\fi}% +\newdef\mfp@arccircle#1#2{% + \@ifundefined{mfp@arc@#1}% + {\Mfpic@warn{Invalid option; ignoring \mfp@b\arc@or@circle\space + command.}% + \mfp@figmac{fallbackpath(\ifmfp@switch\mfp@F\else\mfp@T\fi) (#2)}}% + {\mfp@figmac{\arc@or@circle\@nameuse{mfp@arc@#1} (#2)}}}% +\newdef\mfp@ellipse#1#2{\mfp@figmac{ellipse (#2, #1)}}% +\newdef\mfp@curve#1#2{\mfp@nullopt{\mfp@@curve{#1}{#2}}}% +\newdef\mfp@@curve#1#2#3{% + \mfp@listmac{\mfp@ifempty{#3}{#1}{t#1 (#3)} (#2)}}% +\newdef\mfp@fcncurve#1{% + \mfp@listmac{\mfp@ifempty{#1}{fcncurve}{functioncurve (#1)}}}% +\newdef\mfp@fcn#1#2{% + \mfp@defaultopt{\mfp@dotension{\mfp@@fcn{#1}}}{#2}}% +\newdef\mfp@@fcn#1#2#3{% + \mfp@figmac{\mfp@t#1 (\mfp@sval) (#2) (#3)}}% +\newdef\mfp@btwn#1{% + \mfp@defaultopt{\mfp@dotension{\mfp@@btwn{#1}}}p}% +\newdef\mfp@@btwn#1#2#3#4{% + \mfp@figmac{\mfp@t#1 (\mfp@sval) (#2) (#3) (#4)}}% +\newdef\mfp@dotension#1#2{\mfp@@dotension#2\mfp@end#1}% +\newdef\mfp@@dotension#1#2\mfp@end{\def\mfp@t{}% + \if p#1\relax \let\mfp@sval\mfp@F + \else \let\mfp@sval\mfp@T + \mfp@ifexist{#2}{\def\mfp@t{t}\edef\mfp@sval{\mfp@sval, #2}}% + \fi}% +\newdef\mfp@plotdata#1{\mfp@processfile{\mfp@doplots{#1}}}% +\newdef\mfp@doplots#1{\mfp@setstyle + \advance\mfp@linetype1 \mfp@figmacbase + \mfp@@datafile{#1}\mfp@ifenddata{}{\mfp@doplots{#1}}}% +\newdef\mfp@ifenddata{% + \ifeof\mfp@data \@xp\@firstoftwo + \else \mfp@skipcomments + \ifx\mfp@temp\mfp@par \@XP\@firstoftwo + \else \@XP\@secondoftwo + \fi + \fi}% +\newdef\mfp@datafile#1{% + \mfp@figmacbase\mfp@processfile{\mfp@@datafile{#1}}}% +\newdef\mfp@@datafile#1{% + \mfp@ifempty{#1}% + {\mfp@dodatafile\mfp@smoothness\mfp@tension}% + {\mfp@dodatafile#1}\mfp@end}% +\newdef\mfp@dodatafile#1#2\mfp@end{% + \mfsrc{% + \if s#1 \mfp@ifempty{#2}{curve }{tcurve (#2) }% + \else polyline + \fi (\mfp@F)}\mfp@rwdata}% +\newdef\mfp@image#1#2{\mfsrc{\@nl makeimage (#2, #1)}}% +\newdef\mfp@getdimens#1,#2,#3\mfp@end{% + \mfp@scratch \@ifmtarg{#1}{\z@}{#1}\relax + \edef\mfp@thedimens{\the\mfp@scratch}% + \@ifmtarg{#3}{}{\mfp@scratch \@ifmtarg{#2}{\z@}{#2}\relax}% + \edef\mfp@thedimens{\mfp@thedimens,\the\mfp@scratch}}% +\newdef\mfp@doubledraw#1{% + \mfp@nullopt{\mfp@clroptrendi{doubledraw}{#1}}}% +\newdef\mfp@wiggle#1#2{\mfp@rendi{#1 (#2)}}% +\newdef\mfp@rendi#1#2{\mfp@rendmac{#1 (#2)}}% +\newdef\mfp@rendii#1#2#3{\mfp@rendmac{#1 (#3, #2)}}% +\newdef\mfp@optrendi#1{\mfp@defaultopt{\mfp@rendi{#1}}}% +\newdef\mfp@optrendii#1{\mfp@defaultopt{\mfp@rendii{#1}}}% +\newdef\mfp@modi#1#2{\mfp@modmac{#1 (#2)}}% +\newdef\mfp@listi#1#2{\mfp@listmac{#1 (#2)}}% +\newdef\mfp@clropt#1#2{\mfp@ifempty{#1}{#2}{\mfp@C#2 (#1)}}% +\newdef\mfp@clroptrend#1#2{\mfp@rendmac{\mfp@clropt{#2}{#1}}}% +\newdef\mfp@clroptrendi#1#2#3{\mfp@rendmac{\mfp@clropt{#3}{#1} (#2)}}% +\newdef\mfp@simple#1#2{\mfcmd{\@nl #1 (#2)}}% +\newdef\mfp@simplei#1#2#3{\mfcmd{\@nl #1 (#2, #3)}}% +\newdef\mfp@close#1#2{\mfp@modmac{#1closed\mfp@ifexist{#2}{t (#2)}}}% +\newdef\mfp@thatch#1{\mfp@nullopt{\mfp@clroptrendi{thatch}{#1}}}% +\newdef\mfp@lhatch#1{\mfp@thatch{#1,-45}}% +\newdef\mfp@rhatch#1{\mfp@thatch{#1,45}}% +\newdef\mfp@xhatch#1{\mfp@nullopt{\mfp@clroptrendi{xhatch}{#1}}}% +\newdef\mfp@arrowhead#1#2{\mfp@arr 0{Gheadpath (#1) (#2)}}% +\newdef\mfp@arrow#1{\mfp@arr 0{headpath#1}}% +\newdef\mfp@arr#1#2{\mfp@arr@c{}\mfp@arr@l{\the\headlen}% + \mfp@arr@b{#1}\edef\mfp@hcommand{#2}\mfp@arr@r{0}\mfp@@arr}% +\newdef\mfp@@arr{\@ifnextchar[{\mfp@arropt}{\mfp@doarrow}}% +\newdef\mfp@arropt[#1]{% + \mfp@ifexist{#1}{\mfp@@arropt#1\mfp@end}\mfp@@arr}% +\newdef\mfp@@arropt#1#2\mfp@end{% + \mfp@ifempty{#2}% + {\Mfpic@warn{Arrow option #1 has no value\on@line; + it will be ignored.}}% + {\@ifundefined{mfp@arr@#1}% + {\Mfpic@warn{Arrow option #1 invalid \on@line; + it will be ignored}}% + {\@nameuse{mfp@arr@#1}{#2}}% + }}% +\newdef\mfp@doarrow{% + \mfp@addmac{\mfp@clropt{\mfp@hcolour}{\mfp@hcommand} (\mfp@hlength, + \mfp@hrotate, \mfp@hlocate)}}% +\newdef\mfp@turn#1#2{\rotatearound{#1}{#2}}% +\newdef\mfp@axis#1#2{\mfp@getaxis#2{(none)}\mfp@end\axis + \mfp@addmac{headpath (\mfp@emptysub{#1}{\mfp@defheadlen}, 0, 0)}% + \axisline{\mfp@axisletter}}% +\newdef\mfp@doaxes#1#2{\def\mfp@@axis##1{\mfp@axis{#1}{##1}\mfp@@doaxis}% + \mfp@@doaxis#2\mfp@end}% +\newdef\mfp@@doaxis{\mfp@ifend{}\mfp@@axis}% +\newdef\mfp@marks#1#2{\mfsrc{\@nl #1marks (#2)}\mfp@writedata}% +\newdef\mfp@vectorfield#1#2#3#4#5{% + \mfcmd{#1vectorfield (#2, #3) (#4) (#5)}}% +\newdef\mfp@point#1{% + \mfsrc{\@nl pointd (#1, \ifpointfill\mfp@T\else\mfp@F\fi)}% + \mfp@writedata}% +\newdef\mfp@plotsymbol#1#2{% + \mfsrc{\@nl plotsymbol (#2, #1)}\mfp@writedata}% +\newdef\mfp@plottext#1#2#3{\tlabeljustify{#1}% + \def\tl@points{#3}\mfp@toks{#2}\mfp@thelabel\endgroup}% +\newdef\mfp@piechart#1{\mfp@@piechart#1\mfp@end}% +\newdef\mfp@@piechart#1#2\mfp@end#3{% #3 = center,radius + \mfsrc{\@nl piechart(\if a#1 \else-\fi1, % + \mfp@emptysub{#2}{90}, #3)}\mfp@writedata}% +\newdef\mfp@piewedge#1{\mfp@@piewedge#1\mfp@end}% +\newdef\mfp@@piewedge#1#2\mfp@end#3{% #3=number + \mfp@figmac{(piewedge[#3]% + \mfp@ifexist{#2}% + {\if #1x shifted (#2*piedirection[#3])% + \else\if #1s shifted (#2)% + \else\if #1m shifted (#2 - piecenter)% + \fi\fi\fi})}}% +\newdef\mfp@barchart#1#2{% + \mfsrc{\@nl barchart (#1, \if h#2\mfp@F\else\mfp@T\fi)}% + \mfp@writedata}% +\newdef\everymfpic{\afterassignment\@everymfpic\mfp@toks}% +\newdef\everyendmfpic{\afterassignment\@everyendmfpic\mfp@toks}% +\newdef\@everymfpic{\edef\every@mfpic{\the\mfp@toks}}% +\newdef\@everyendmfpic{\edef\every@endmfpic{\the\mfp@toks}}% +\everymfpic{}\everyendmfpic{}% +\newdef\mfpic{\mfp@defaultopt\@mfpicA{1}}% +\newdef\@mfpicA#1{\mfp@defaultopt{\@mfpic{#1}}{#1}}% \newdef\@mfpic#1#2#3#4#5#6{% \save@mfpicdimens + \@mfpicunit\mfpicunit \begingroup % ended near end of \endmfpic - \@ifmfpfileisopen{}% - {\if@mfp@nowrite\else \nooutputfileerror{\mfpic}% - \def\@mfsrc##1##2{}% + \edef\xmin{#3}\edef\xmax{#4}\edef\ymin{#5}\edef\ymax{#6}% + \@nameuse{@safe@activestrue}% + \mfp@ifopengraphsfile{}% + {\ifmfp@nowrite\else \mfp@nooutput@error\mfpic + \def\mfp@src##1##2{\endgroup}% \fi}% - \mfp@DBlog{Starting mfpic \number\mfp@count \@online.}% - \font\@tcurr=\fontname\font\relax + \mfp@DBlog{Starting mfpic \number\mfp@count \on@line.}% + \@xp\let\@xp\@tcurr\the\font \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 + \mfp@grafmacs + \mfp@additions + \mfp@setconv{#1}{#2}{#3}{#5}% + \mfp@inittlabels + \@xconv{#4}\@graphright + \@yconv{#6}\@graphtop + \@graphleft 0pt + \@graphbot 0pt + \mfsrc{\@nl \mfp@p\mfp@d\mfp@d<\number\mfp@count>\@nl + unitlen := \the\@mfpicunit\mfp@s;\@nl xscale := #1; yscale := #2;\@nl bounds (#3, #4, #5, #6);\@nl \@nl - beginmfpic(\number\mfp@count); \mf@p\space\@mfplineno. + beginmfpic(\number\mfp@count); \mfp@p\space\mfp@lineno. \mfp@ifmpost - {\@nl verbatimtex \@nl - \begingroup\space\font\noexpand\MFPcfont=\fontname\@tcurr\@nl + {\@nl verbatimtex + \bgroup\font\noexpand\MFPcfont=\fontname\@tcurr\relax 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\tlabel{\mfp@nullopt\mfp@label}% + \newdef\startbacktext{\let\mfp@restoreOL\@empty + \mfp@ifmpost + {\ifmfp@overlabels + \let\mfp@restoreOL\overlaylabels\nooverlaylabels + \fi \setmfboolean{underlaylabels}{\mfp@T}}{}% + \setbox\@wholegraph \box\@alltlabels + \setbox\@alltlabels \vbox{\hbox{}}}% + \newdef\stopbacktext{% + \setbox\@backtext \box\@alltlabels + \setbox\@alltlabels\box\@wholegraph + \mfp@ifmpost{\setmfboolean{underlaylabels}{\mfp@F}}{}% + \mfp@restoreOL}% + \newdef\tlabelrect{\mfp@labelpath{rect}{0}}% + \newdef\tlabeloval{\mfp@labelpath{oval}{1}}% + \newdef\tlabelellipse{\mfp@labelpath{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}% + \mfp@iftoken*{\tlabelellipse*[1]}{\tlabelellipse[1]}}% + \newdef\tlabels{\begingroup + \mfp@resetwhitespace\mp@mksharpother \mfp@labels}% + \newdef\axislabels{\mfp@axislabels{#3}{#4}{#5}{#6}}% + \let\mfp@docaption\@empty + \newdef\tcaption{\mfp@defaultopt\mfp@caption{1.2,1.0}}% + \every@mfpic}% End of \@mfpic +\newdef\mfp@setconv#1#2#3#4{% #1,#2=xscale,yscale. #3,#4=xmin,ymin. + \def\@xconv##1##2{% ##1 = coord. ##2 = dimension register or fdim + {\mfp@scratch=##1\@mfpicunit \advance\mfp@scratch by -#3\@mfpicunit + \mfp@scratch=#1\mfp@scratch + \global ##2=\mfp@scratch}}% + \def\@yconv##1##2{% ditto + {\mfp@scratch=##1\@mfpicunit \advance\mfp@scratch by -#4\@mfpicunit + \mfp@scratch=#2\mfp@scratch + \global ##2=\mfp@scratch}}}% +\newdef\mfp@inittlabels{% + \setbox\@alltlabels\vbox{\hbox{}}% + \setbox\@backtext\vbox{\hbox{}}% + \@tlabelsbot \maxdimen + \@tlabelstop -\maxdimen + \@tlabelsleft \maxdimen}% +\newdef\mfp@label#1{\begingroup\mfp@resetwhitespace\mp@mksharpother + \tlabeljustify{#1}\@ifnextchar({\mfp@label@}{\mfp@label@@}}% +\newdef\mfp@label@(#1,#2){\mfp@label@@{(#1,#2)}}% +\newdef\mfp@label@@#1#2{\def\tl@points{#1}\mfp@toks{#2}\mfp@thelabel + \endgroup\extra@endtlabel}% +\newdef\mfp@thelabel{\@ifmplabels\mp@tlabel\tex@tlabel}% +\newdef\mfp@btex#1{btex \noexpand\MFPtext{#1} etex}% +\newdef\mfp@setMPpos{% + \edef\mfp@MPpos{% + \ifcase\tl@hpos .5\or 1\else 0\fi, % horizontal + \ifcase\tl@vpos0\or .5\or 1\else 0\fi, % vertical + \ifnum \tl@vpos<0 \mfp@T\else\mfp@F\fi, % true=Baseline + \mfp@emptysub{\tl@rot}{0}}}% +\newdef\mp@tlabel{\mfp@setMPpos + \mfcmd{\@nl newgblabel(\mfp@MPpos)(\mfp@btex{\the\mfp@toks})\@nl + (\tl@points)}}% +\newdef\set@textbox#1{% + \setbox\@textbox\vbox{\def\\{\cr}\mfp@restorepar + \@tcurr\@nameuse{@safe@activesfalse}\every@tlabel + \halign{##\hfil\cr#1\crcr}}}% +\newdef\tex@tlabel{\@xp\@textlabel\tl@points\mfp@end}% +\newdef\@textlabel{\mfp@ifendorcomma{}\@textlabel\@@textlabel}% +\newdef\@@textlabel(#1,#2){\tex@@tlabel{#1}{#2}\@textlabel}% +\newdef\tex@@tlabel#1#2{% + \set@textbox{\the\mfp@toks}% + \mfp@scratch\tb@ht \advance\mfp@scratch\tb@dp + \tb@totalht\mfp@scratch + \@xconv{#1}\mfp@scratch + \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 (default) + \fi + \advance\mfp@scratch \tlabel@hadj + \ifdim \mfp@scratch<\@tlabelsleft + \@tlabelsleft\mfp@scratch + \fi + \tb@moveright\mfp@scratch + \endgroup + \@yconv{#2}\mfp@scratch + \begingroup + \ifcase\tl@vpos \advance\mfp@scratch \tb@totalht % bottom + \advance\mfp@scratch \tlabel@sep + \or \advance\mfp@scratch 0.5\tb@totalht % center + \or \advance\mfp@scratch -\tlabel@sep % top + \else \advance\mfp@scratch \tb@ht % baseline (default) + \fi + \advance\mfp@scratch \tlabel@vadj + \ifdim \mfp@scratch>\@tlabelstop + \@tlabelstop\mfp@scratch + \fi + \tb@raise\mfp@scratch + \endgroup + \begingroup + \ifcase\tl@vpos \advance\mfp@scratch \tlabel@sep % bottom + \or \advance\mfp@scratch -0.5\tb@totalht % center + \or \advance\mfp@scratch -\tb@totalht % top + \advance\mfp@scratch -\tlabel@sep + \else \advance\mfp@scratch -\tb@dp % baseline (default) + \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}}% +}% End \tex@@tlabel +\newdef\mfp@labels#1{\let\extra@endtlabel\mfp@dolabel + \mfp@dolabel#1\mfp@end}% +\newdef\mfp@dolabel{\mfp@ifend\endgroup\tlabel}% +\newdef\mfp@labelpath#1#2{\mfp@figmacbase + \begingroup % ended in \tlabelpath@ + \def\mfp@name{#1}\def\mfp@param{#2}% + \mfp@ifstar\mfp@tlpath\mfp@switchtrue\mfp@switchfalse}% +\newdef\mfp@tlpath#1{#1\mfp@defaultopt\mfp@@tlpath\mfp@param}% +\newdef\mfp@@tlpath#1{\edef\mfp@param{#1}% + \mfp@defaultopt\mfp@tlpath@{\tlpath@v\tlpath@h\tlpath@r}}% +\newdef\mfp@tlpath@#1{\mfp@resetwhitespace\mp@mksharpother + \tlabeljustify{#1}\@ifnextchar({\@tlabelpath}{\@@tlabelpath}}% +\newdef\@tlabelpath(#1,#2){\@@tlabelpath{(#1,#2)}}% +\newdef\@@tlabelpath#1#2{% + \def\tl@points{#1}\mfp@toks{#2}\tlabelpath@}% +\newdef\tlabelpath@{\@ifmplabels{}{\measure@textbox{\the\mfp@toks}}% + \mfp@setMPpos + \mfcmd{text\mfp@name x (\mfp@MPpos)\@nl + (\@ifmplabels{origin, \mfp@btex{\the\mfp@toks}}{\tb@ll, \tb@ur}, + \mfp@param) (\tl@points)}% + \ifmfp@switch\else \mfp@thelabel\fi \endgroup}% +\newdef\measure@textbox#1{\set@textbox{#1}% + \mfp@scratch-\tb@dp + \edef\tb@ll{(0, \the\mfp@scratch)}% + \edef\tb@ur{(\the\tb@wd, \the\tb@ht)}}% +\newdef\mfp@axislabels#1#2#3#4#5{% + \begingroup % ended in \mfp@(@)doaxislabel + \mfp@resetwhitespace + \tl@vpos1 \tl@hpos0 + \let\mfp@xcoord\@firstofone \let\mfp@ycoord\@firstofone + \mfp@getaxis#5\relax\mfp@end\axislabels + \ifcase\mfp@axisnum\relax + \tl@vpos2 \def\mfp@ycoord{0}\or + \tl@hpos1 \def\mfp@xcoord{0}\or + \tl@hpos1\edef\mfp@xcoord{\mfp@lshift}% + \mfpaddto\mfp@xcoord{#1}\or + \tl@vpos2\edef\mfp@ycoord{\mfp@bshift}% + \mfpaddto\mfp@ycoord{#3}\or + \tl@hpos-1 \edef\mfp@xcoord{-\mfp@rshift}% + \mfpaddto\mfp@xcoord{#2}\or + \tl@vpos0 \edef\mfp@ycoord{-\mfp@tshift}% + \mfpaddto\mfp@ycoord{#4}% \fi \ifx\@firstofone\mfp@xcoord - \edef\mfp@ycoord####1{\mfp@ycoord}% + \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 + \edef\mfp@xcoord##1{\mfp@xcoord}% + \fi \mp@mksharpother\mfp@nullopt\mfp@@axislabels}% +\newdef\mfp@@axislabels#1#2{% + \tlabeljustify{#1}\mfp@doaxislabel#2,\mfp@end}% +\newdef\mfp@doaxislabel{% + \mfp@ifendorcomma\endgroup\mfp@doaxislabel\mfp@@doaxislabel}% +\newdef\mfp@@doaxislabel#1{\mfp@toks{#1}% + \mfp@ifendorcomma\endgroup\mfp@doaxislabel\mfp@mkaxislabel}% +\newdef\mfp@mkaxislabel#1,{% + \@ifmtarg{#1}{}% + {\edef\tl@points{(\mfp@xcoord{#1},\mfp@ycoord{#1})}\mfp@thelabel}% + \mfp@doaxislabel}% +\newdef\mfp@caption#1{\begingroup\mfp@resetwhitespace + \mfp@@caption#1\mfp@end}% +\long\def\mfp@@caption#1,#2\mfp@end#3{\endgroup + \def\mfp@docaption{% + \setbox\@textbox + \hbox{\def\\{\hskip\@M\p@\let\\\relax}\mfp@restorepar + \@nameuse{@safe@activesfalse}\@tcurr#3}% + \mfp@scratch\wd\@wholegraph + \ifdim\tb@wd>#1\mfp@scratch + \setbox\@textbox + \hbox{% + \vbox{% + \hsize#2\mfp@scratch \mfp@restorepar + \leftskip0pt + \rightskip0pt + \mfp@capsettings + \@nameuse{@safe@activesfalse}\noindent\@tcurr #3% + }% End vbox. + }% End hbox. + \fi + \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 \mfp@docaption. +}% End \mfp@@caption. +\def\mfp@adjustdim#1#2#3#4{% + \mfp@scratch#1\relax \advance\mfp@scratch-#4 bp + \ifdim\mfp@scratch#2#3\relax #3\mfp@scratch \fi + #1\mfp@scratch}% \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}% +\newdef\endmfpic{\every@endmfpic + \mfsrc{\mfp@ifmpost{\@nl verbatimtex \egroup\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 - \if@shipping % - \global\setbox\@wholegraph=% + \ifmfp@noship \else + \global\setbox\@wholegraph \vbox{% \ifmfpicdraft \vbox to \@graphtop{\vss - \hbox to \@graphwd{\kern2pt\tt\#\number\mfp@count\hss}% - \kern2pt}% + \hbox to \@graphright{% + \kern2pt \mfpdraftfont\#\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 + \mfp@ifmpost{\vbox}{\vbox to \@graphtop}% + {\vss + \edef\@graphfilename{% + \setfilename\mfp@filename{\number\mfp@count}}% + \mfp@ifmpost + {\IfFileExists{\@graphfilename}{}% + {\Mfpic@msg{No graph file: \@graphfilename\space.}% + \let\@setmfpicgraphic\nofile@setmfpgraphic}% + \hbox}% + {\hbox to \@graphright}% + {\@xp\@setmfpicgraphic\@xp{\@graphfilename}\hss}% + \kern0pt }% End vbox \fi - }%% End vbox (\setbox\@wholegraph) + }%% End \setbox\@wholegraph \vbox \mfp@ifmpost - {\@graphright=\wd\@wholegraph - \@graphtop=\ht\@wholegraph - \@graphwd=\@graphright}{}% + {\@graphright\wd\@wholegraph + \@graphtop\ht\@wholegraph}{}% \ifmfpicdebug + \wlog{Mfpic debug: Dimensions of wholegraph before labels + are added, and before truebbox adjustments:}% \wlog{Mfpic: graphleft = \the\@graphleft}% \wlog{Mfpic: graphright = \the\@graphright}% \wlog{Mfpic: graphtop = \the\@graphtop}% @@ -1441,54 +1520,49 @@ \wlog{}% \fi \ifmfpicdebug + \wlog{Mfpic debug: Dimensions of alltlabels, before + truebbox adjustments:}% + \mfp@scratch\mfpicllx bp\relax + \wlog{Mfpic: mfpicllx = \the\mfp@scratch}% + \mfp@scratch\mfpiclly bp\relax + \wlog{Mfpic: mfpiclly = \the\mfp@scratch}% \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 + \kern \mfpiclly bp \moveleft \mfpicllx bp \box\@alltlabels\vss}% + \setbox\@backtext \vtop to 0pt{% + \kern \mfpiclly bp \moveleft \mfpicllx bp \box\@backtext \vss}% + \mfp@adjustdim\@tlabelsleft <\@graphleft \mfpicllx + \mfp@adjustdim\@tlabelstop >\@graphtop \mfpiclly + \mfp@adjustdim\@tlabelsbot <\@graphbot \mfpiclly + \ifmfpicdraft\else + \setbox\@wholegraph + \vtop{\offinterlineskip + \box\@backtext\kern-\ht\@wholegraph + \unvbox\@wholegraph\box\@alltlabels}% \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 debug: Dimensions of alltlabels after + truebbox adjustments:}% \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 + \mfp@scratch\@graphtop \advance\mfp@scratch by -\@graphbot - \global \setbox\@wholegraph=% + \global \setbox\@wholegraph \vbox to \mfp@scratch{\vss \hbox{\kern-\@graphleft\box\@wholegraph}% \kern-\@graphbot}% End vbox. \ifmfpicdebug + \wlog{Mfpic debug: Dimensions of wholegraph after + labels are added:}% \wlog{Mfpic: graphleft = \the\@graphleft}% \wlog{Mfpic: graphright = \the\@graphright}% \wlog{Mfpic: graphtop = \the\@graphtop}% @@ -1498,10 +1572,9 @@ \wlog{Mfpic: graphdp = \the\dp\@wholegraph}% \wlog{}% \fi - \@docaption - \global\mfpicheight\ht\@wholegraph - \global\mfpicwidth\wd\@wholegraph + \mfp@docaption \ifmfpicdebug + \wlog{Mfpic debug: Values after tcaption added:}% \wlog{Mfpic: graphleft = \the\@graphleft}% \wlog{Mfpic: graphright = \the\@graphright}% \wlog{Mfpic: graphtop = \the\@graphtop}% @@ -1511,46 +1584,53 @@ \wlog{Mfpic: graphdp = \the\dp\@wholegraph}% \wlog{}% \fi + \global\mfpicheight\ht\@wholegraph + \global\mfpicwidth\wd\@wholegraph \ifmfpicdraft - \setbox\@wholegraph=% - \hbox{\@mfpframed{-\mfpframethickness}{\box\@wholegraph}}% + \setbox\@wholegraph + \hbox{\@mfpframed{-\mfpframethickness}{\box\@wholegraph}}% \fi + \global\setbox\@wholegraph\box\@wholegraph + \global \advance\mfp@count1 + \fi % \ifmfp@noship + \endgroup % Begun near start of \@mfpic + \ifmfp@noship \else \mfp@ifdefined\s@vemfpic - {\global\setbox\s@vemfpic=\box\@wholegraph}% + {\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 + \restore@mfpicdimens + \mfp@checklatexenv{mfpic}{\@ignoretrue}{}% + \global\let\in@mfpicenv\iffalse \ignorespaces -}% -\newdef\newsavepic#1{% - \if@mfp@latex \newsavebox{#1}% - \else +}% endmfpic +\ifmfp@latex + \newdef\mfp@checklatexenv#1#2#3{% + \def\mfp@tempa{#1}\ifx\mfp@tempa\@currenvir #2\else #3\fi}% +\else + \newdef\mfp@checklatexenv#1#2#3{#3}% +\fi +\ifmfp@latex + \newlet\newsavepic\newsavebox +\else + \newdef\newsavepic#1{% \mfp@ifdefined{#1}% - {\mfp@errmsg - {Command \string #1 already defined.}% + {\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 + {\@nameuse{newbox}#1}}% +\fi +\newlet\newpic\newsavepic \newdef\savepic#1{\relax \mfp@ifdefined{#1}{\gdef\s@vemfpic{#1}}% - {\mfp@errmsg{Box \string#1 undefined.}% + {\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{\mfp@defaultopt\@mfpframed\mfpframesep}% +\newdef\mfpframe{\mfp@defaultopt\@mfpframe\mfpframesep}% \newdef\@mfpframed#1#2{\@mfpframe{#1}#2\endmfpframe}% \newdef\@mfpframe#1{% \leavevmode\hbox\bgroup @@ -1570,34 +1650,28 @@ \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=}% +\mfp@ifdefined\framed{}{\let\framed\mfpframed}% +\def\mfpverbtex{\futurelet\mfp@next\@mfpverbtex}% +\def\@mfpverbtex{% + \begingroup + \@makeother\#\@makeother\%\mfp@keeplines + \afterassignment\mfp@writetex\global\mfp@verbtex}% +\newif\ifmfp@verbtex \def\mfp@writetex{% \endgroup - \@ifmfpfileisopen + \mfp@ifopengraphsfile {\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}% + {\mfsrc{ verbatimtex\@nl \the\mfp@verbtex}\mfcmd{etex}}% + {\mfp@noMP@error\mfpverbtex}% + \global\mfp@verbtexfalse\mfp@verbtex{}}% + {\global\mfp@verbtextrue}}% +\mfpicnumber{1}% +\InputIfFileExists{mfppatch.tex}{}{}% +\mfp@ifdefined\mfpdraftfont{}{\newdef\mfpdraftfont{\tt}}% \mfp@DBlog{Punctuation, etc., will revert to old catcodes now.}% \let\+\mfpsaveplus -\restorenewlinechar -\MFPicpackagE% -\MFPICinput{mfpic.usr}% +\mfp@restoreALL% +\InputIfFileExists{mfpic.usr}{}{}% \endinput %% %% End of file `mfpic.tex'. diff --git a/Master/texmf-dist/tex/generic/mfpic/mfppatch.tex b/Master/texmf-dist/tex/generic/mfpic/mfppatch.tex new file mode 100644 index 00000000000..3d47072f8ef --- /dev/null +++ b/Master/texmf-dist/tex/generic/mfpic/mfppatch.tex @@ -0,0 +1,14 @@ +%%% File: mfppatch.tex +%%% A patch for mfpic 0.9 2006/05/26 +%%% +\def\mfp@versionpatched{0.9}% +\def\mfp@patchinfo{% + \Mfpic@warn{This patch is only for mfpic version \mfp@versionpatched!\@nl}}% +\let\mfp@dopatches\endinput +\ifx\mfpfileversion\mfp@versionpatched + \def\mfp@patchinfo{}% + \def\mfp@dopatches{}% +\fi +\mfp@patchinfo +\mfp@dopatches +\endinput |