diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/mfpic/mfpic.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/mfpic/mfpic.tex | 197 |
1 files changed, 142 insertions, 55 deletions
diff --git a/Master/texmf-dist/tex/generic/mfpic/mfpic.tex b/Master/texmf-dist/tex/generic/mfpic/mfpic.tex index 5e8b1d89110..7cabca9b5bf 100644 --- a/Master/texmf-dist/tex/generic/mfpic/mfpic.tex +++ b/Master/texmf-dist/tex/generic/mfpic/mfpic.tex @@ -8,25 +8,28 @@ %% %% ------------------------------------------------------------------- %% -%% Copyright 2002--2006, Daniel H. Luecking +%% Copyright 2002--2009, Daniel H. Luecking %% %% Mfpic may be distributed and/or modified under the conditions of the -%% LaTeX Project Public License, either version 1.3b of this license or (at +%% LaTeX Project Public License, either version 1.3c of this license or (at %% your option) any later version. The latest version of this license is in %% <http://www.latex-project.org/lppl.txt> -%% and version 1.3b or later is part of all distributions of LaTeX version -%% 2005/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX version +%% 2008/12/01 or later. %% %% Mfpic has maintenance status "author-maintained". The Current Maintainer %% is Daniel H. Luecking. There are several Base Interpreters associated %% with mfpic: plain TeX, LaTeX, plain Metafont and plain MetaPost. %% +%%% File: mfpic.dtx +%%% A part of mfpic 1.00 2009/09/22 +%%% \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}% + \gdef\mfpfileversion{1.00}% + \gdef\mfpfiledate{2009/09/22}% + \gdef\mfpicversion{100}% }% \let\mfpsaveplus\+% \let\+\tabalign% @@ -180,6 +183,9 @@ {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\mfp@noMF@warn#1{% + \Mfpic@warn + {Metapost does not support \string#1, it will be ignored.}}% \def\mfp@afteropen@error#1{% \mfp@errmsg{Improper use of command \string#1\on@line}% {You must issue the command #1 prior to \opengraphsfile. @@ -212,18 +218,32 @@ \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{% - \mfp@ifopengraphsfile{\mfcmd{setvariable (#1) (#2) #3}}% +\newdef\mfmode#1{\edef\mfp@mode{#1}% + \mfp@ifopengraphsfile% + {\mfp@afteropen@error\mfmode}% + {\mfp@ifmpost{\mfp@noMF@warn\mfmode}{}}}% +\newdef\mfresolution#1{\edef\mfp@resolution{#1}% + \mfp@ifopengraphsfile% + {\mfp@afteropen@error\mfresolution}% + {\mfp@ifmpost{\mfp@noMF@warn\mfresolution}{}}}% +\newdef\setmfvariable#1{% + \MFP@sp@def\mfp@tempa{#1}\@setmfvariable\mfp@tempa}% +\newdef\@setmfvariable#1#2#3{% + \mfp@ifopengraphsfile% + {\mfcmd{set#1 (#2) #3}}% {\mfp@nooutput@error\setmfvariable}}% -\newlet\setmpvariable\setmfvariable -\newdef\setmfboolean {\setmfvariable{boolean}}% -\newdef\setmfnumeric {\setmfvariable{numeric}}% -\newdef\setmfpair {\setmfvariable{pair}}% -\newdef\setmfcolor {\setmfvariable{color}}% +\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@sp@def\mfp@tempa{#1}% + \mfp@ifopengraphsfile + {\mfcmd{\ifx\mfp@tempa\mfp@C gsetcolor \else gsetvariable (#1) \fi + (#2) #3}}% {\mfp@nooutput@error\globalsetmfvariable}}% -\newlet\globalsetvariable\globalsetmfvariable +\newlet\setmpvariable\setmfvariable +\newlet\globalsetmpvariable\globalsetmfvariable \newlet\ifin@mfpicenv\iffalse \newdef\mfp@local{\relax\ifin@mfpicenv\else\global\fi}% \newdef\mfp@let{\mfp@local\let}% @@ -291,10 +311,24 @@ \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} +\newdef\mfp@sanitized{\@xp\strip@prefix\meaning}% \newlet\@setmfpicgraphic\normal@setmfpgraphic \usemetafont \newdef\setfilename#1#2{#1.#2}% +\newdef\setfilenametemplate#1{% + \begingroup + \def\_{\mfp@p j}% + \def\#{\mfp@p c}% + \let\@nl\relax + \xdef\mfp@settemplate{\@nl setoutputtemplate "#1";\@nl}% + \let\number\relax + \let\mfp@count\relax + \let\mfp@filename\relax + \def\_{\mfp@filename}% + \def\#{\number\mfp@count}% + \xdef\setfilename##1##2{#1}% + \endgroup +}% \newif\ifmfpicdraft \newlet\ifmfp@draft\iffalse \newlet\ifmfp@final\iffalse @@ -318,17 +352,24 @@ \AtEndDocument{\mfp@closegraphsfile}% \else \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}}}% + \newdef\mfp@useMP#1#2#3#4#5{% + \mfp@ifdefined#1{}{% + \InputIfFileExists{#2}{}{% + \InputIfFileExists{#3}{}{% + \mfp@errmsg{Files not found: #1, #2}% + {One of the two named files is necessary + for mfpic, but neither was found.}}}}% + \global\let\setmfpicgraphic\mfp@includeMPS + \gdef\getmfpicoffset##1{\xdef\mfpicllx{#4}\xdef\mfpiclly{#5}}}% \ifmfp@pdf \newdef\mfp@includeMPS#1{\convertMPtoPDF{#1}{1}{1}}% \newdef\@usemetapost{% - \mfp@useMP\convertMPtoPDF{supp-pdf}\MPllx\MPlly}% + \mfp@useMP\convertMPtoPDF{supp-pdf.mkii}{supp-pdf.tex}% + \MPllx\MPlly}% \else \newdef\mfp@includeMPS#1{\epsfbox{#1}}% - \newdef\@usemetapost{\mfp@useMP\epsfbox{epsf}\epsfllx\epsflly}% + \newdef\@usemetapost{% + \mfp@useMP\epsfbox{epsf.tex}{epsf.sty}\epsfllx\epsflly}% \fi \fi \mfp@DBlog{Handlers for optional parameters.}% @@ -354,6 +395,16 @@ \def\:{\@xifnch}\@xp\gdef\: {\futurelet\@let@token\@ifnch}% }% \mfp@enddef +\def\mfp@tempa#1{% + \def\MFP@sp@def##1##2{% + \futurelet\mfp@next\MFP@sp@d##2\@nil\@nil#1\@nil\relax##1}% + \def\MFP@sp@d{% + \ifx\mfp@next\@sptoken \expandafter\MFP@sp@b + \else \expandafter\MFP@sp@b\expandafter#1% + \fi}% + \def\MFP@sp@b#1##1 \@nil{\MFP@sp@c##1}}% +\mfp@tempa{ }% +\def\MFP@sp@c#1\@nil#2\relax#3{\mfp@toks{#1}\edef#3{\the\mfp@toks}}% \def\mfp@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}% @@ -428,7 +479,7 @@ \ht0=0pt \dp0=0pt \shipout\hbox{\box0}}% \def\MFPtext#1{\vbox{\def\\{\cr}\MFPcfont\everylabel \halign{##\hfil\cr#1\crcr}}}% - }\endgroup + }\endgroup% \newdef\mfp@versioninfo{% \mfp@p\space\mfp@filename.m\mfp@ifmpost{p}{f}, generated by Mfpic, v\mfpfileversion\space\mfpfiledate,\@nl @@ -477,14 +528,26 @@ \ifmfp@verbtex \the\mfp@verbtex\@nl \fi \the\mfp@commonverbatimtex\@nl \def\noexpand\everylabel{\the\mfp@toks}\@nl - etex;\@nl}% + etex;\@nl + \mfp@ifdefined\mfp@settemplate\mfp@settemplate{}% + }% \global\mfp@verbtexfalse \global\mfp@verbtex{}% \@ifmplabels\usemplabels{}% \ifmfp@truebbox \usetruebbox \fi \ifmfp@overlabels \overlaylabels \fi}% +\def\mfp@MFextras{% + \mfp@ifdefined\mfp@resolution% + {GBresolution := \mfp@resolution;\@nl}{}% + \mfp@ifdefined\mfp@mode{mode := \mfp@mode;\@nl}{}}% +\def\mfp@dospecials{\do\$\do\&\do\#\do\^\do\_\do\%\do\~}% \mfp@DBlog{Macros to open and close graphs files.}% -\newdef\opengraphsfile#1{\@bsphack - \def\mfp@tempa{#1}% +\newdef\opengraphsfile{\@bsphack + \begingroup + \let\do\@makeother + \mfp@dospecials\@opengraphsfile}% +\newdef\@opengraphsfile#1{% + \xdef\mfp@tempa{#1}% + \endgroup \mfp@ifopengraphsfile% {\Mfpic@warn {\@nl An attempt has been made to open a graph file, @@ -492,7 +555,7 @@ while another, \mfp@filename, is still open. \@msgbreak Closing \mfp@filename.}\mfp@closegraphsfile}% {}% - \xdef\mfp@filename{\mfp@sanitized\mfp@tempa} + \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 @@ -500,7 +563,8 @@ \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}% + \mfsrc{\mfp@versioninfo \mfp@ifmpost{}\mfp@MFextras + \mfp@init@outfile \mfp@versioncheck}% \mfp@ifmpost\mfp@MPextras{}% \ifmfp@clip \clipmfpic \fi \ifmfp@clearsym \clearsymbols \fi @@ -524,8 +588,8 @@ #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}}% + {\mfp@msg{}\Mfpic@msg{No value for \string#2\ifin@mfpicenv\space in + mfpic figure \number\mfp@count\fi.\@nl}}% {}% \mfsrc{\@ifmplabels{\@nl verbatimtex #1\def\string#2{#2} etex;\@nl}{}% message "\string\mfpicvalue";\@nl @@ -683,7 +747,10 @@ \newdef\pairarray{\setmfarray{pair}}% \newdef\numericarray{\setmfarray{numeric}}% \newdef\colorarray{\setmfarray{color}}% +\newdef\rgbcolorarray{\setmfarray{rgbcolor}}% +\newdef\cmykcolorarray{\setmfarray{cmykcolor}}% \newdef\globalsetmfarray#1#2{\mfsrc{gsetarray (#1) (#2)}\mfp@writedata}% +\newlet\globalsetmparray\globalsetmfarray \newdef\lightershade{\shadespace1.2\shadespace}% \newdef\darkershade{\shadespace.83333\shadespace}% \newdef\dashlineset{\dashlen4pt \dashspace4pt }% @@ -934,6 +1001,7 @@ \newdef\ellipse{\mfp@defaultopt\mfp@ellipse{0}}% \newdef\sector##1{\mfp@figmac{sector (##1)}}% \newdef\arc{\mfp@iftoken*{\arccomplement\mfp@arc}{\mfp@arc}}% + \newdef\pshcircle{\mfp@ifstar\mfp@pshcircle\mfp@F\mfp@T}% \newdef\lines{\mfp@listi{polyline}\mfp@F}% \newdef\polygon{\mfp@listi{polyline}\mfp@T}% \newdef\computedspline{\mfp@listi{dospline}\mfp@F}% @@ -944,6 +1012,8 @@ \newdef\closedcspline{\mfp@listi{cspline}\mfp@T}% \newdef\qbeziers{\mfp@listi{qbezier}\mfp@F}% \newdef\closedqbeziers{\mfp@listi{qbezier}\mfp@T}% + \newdef\cbeziers{\mfp@listi{cbezier}\mfp@F}% + \newdef\closedcbeziers{\mfp@listi{cbezier}\mfp@T}% \newdef\fcnspline{\mfp@listi{fcnspline}\mfp@F}% \newdef\periodicfcnspline{\mfp@listi{fcnspline}\mfp@T}% \newlet\closedpolyline\polygon @@ -958,6 +1028,7 @@ \newlet\closedconvexcurve\convexcyclic \newdef\fcncurve{\mfp@nullopt\mfp@fcncurve}% \newdef\turtle{\mfp@listmac{turtle}}% + \newdef\brownianmotion##1{\mfp@figmac{brownianpath (##1)}}% \newdef\function{\mfp@fcn{function}s}% \newdef\parafcn{\mfp@fcn{parafcn}s}% \newdef\plrfcn{\mfp@fcn{plrfcn}s}% @@ -1074,9 +1145,10 @@ \newdef\gridarcs{\mfp@simple{gridarcs}}% \newdef\gridrays{\mfp@simple{gridrays}}% \newdef\plrpatch{\mfp@simple{polarpatch}}% - \newdef\vectorfield{\mfp@defaultopt{\mfp@vectorfield{}}{\the\headlen}} + \newdef\vectorfield{% + \mfp@defaultopt{\mfp@vectorfield{}}{\the\headlen}}% \newdef\plrvectorfield{% - \mfp@defaultopt{\mfp@vectorfield{plr}}{\the\headlen}} + \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 @@ -1104,6 +1176,17 @@ \newlet\histobar\chartbar \newlet\ganttbar\chartbar }% end \mfp@grafmacs +\def\mfp@abc#1#2#3#4#5#6#7#8/{#6#3#1#2#6#7#6#4#5}% +\@namedef{\mfp@abc STAGGER LEE/}{% +\mfpic[20]{-2}{2}{-3}{3}% + \tile{peter, 1pt, 10, 10, false}% + \penwd{1pt}% + \draw[(1,0,0)]\lines{(0,0), (5,5), (10,0)}% + \pointcolor{(0,.8,0)}% + \point[3pt]{(2.5,7.5)}% + \endtile + \draw\tess{peter}\gfill[(1,1,0)]\ellipse{(0,0),2,3}% +\endmfpic}% \newdef\mfppiechart{\mfp@defaultopt\mfp@piechart{c}}% \newdef\mfpbarchart{\mfp@defaultopt\mfp@barchart{0,1,1}}% \newlet\mfpbargraph\mfpbarchart @@ -1118,6 +1201,7 @@ \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@pshcircle#1#2{\mfp@figmac{pshcircle (#1, #2)}}% \newdef\mfp@curve#1#2{\mfp@nullopt{\mfp@@curve{#1}{#2}}}% \newdef\mfp@@curve#1#2#3{% \mfp@listmac{\mfp@ifempty{#3}{#1}{t#1 (#3)} (#2)}}% @@ -1244,9 +1328,8 @@ \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 - \edef\xmin{#3}\edef\xmax{#4}\edef\ymin{#5}\edef\ymax{#6}% + \@mfpicunit\mfpicunit \@nameuse{@safe@activestrue}% \mfp@ifopengraphsfile{}% {\ifmfp@nowrite\else \mfp@nooutput@error\mfpic @@ -1259,10 +1342,12 @@ \nullfont \mfp@grafmacs \mfp@additions - \mfp@setconv{#1}{#2}{#3}{#5}% + \edef\xfactor{#1}\edef\yfactor{#2}% + \edef\xmin{#3}\edef\xmax{#4}\edef\ymin{#5}\edef\ymax{#6}% + \mfp@setconv \mfp@inittlabels - \@xconv{#4}\@graphright - \@yconv{#6}\@graphtop + \@xconv\xmax\@graphright + \@yconv\ymax\@graphtop \@graphleft 0pt \@graphbot 0pt \mfsrc{\@nl \mfp@p\mfp@d\mfp@d<\number\mfp@count>\@nl @@ -1295,18 +1380,18 @@ \mfp@iftoken*{\tlabelellipse*[1]}{\tlabelellipse[1]}}% \newdef\tlabels{\begingroup \mfp@resetwhitespace\mp@mksharpother \mfp@labels}% - \newdef\axislabels{\mfp@axislabels{#3}{#4}{#5}{#6}}% + \newlet\axislabels\mfp@axislabels \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. +\newdef\mfp@setconv{% \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 + {\mfp@scratch=##1\@mfpicunit \advance\mfp@scratch by -\xmin\@mfpicunit + \mfp@scratch=\xfactor\mfp@scratch \global ##2=\mfp@scratch}}% \def\@yconv##1##2{% ditto - {\mfp@scratch=##1\@mfpicunit \advance\mfp@scratch by -#4\@mfpicunit - \mfp@scratch=#2\mfp@scratch + {\mfp@scratch=##1\@mfpicunit \advance\mfp@scratch by -\ymin\@mfpicunit + \mfp@scratch=\yfactor\mfp@scratch \global ##2=\mfp@scratch}}}% \newdef\mfp@inittlabels{% \setbox\@alltlabels\vbox{\hbox{}}% @@ -1410,23 +1495,23 @@ \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{% +\newdef\mfp@axislabels#1{% \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 + \mfp@getaxis#1\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 + \mfpaddto\mfp@xcoord\xmin\or \tl@vpos2\edef\mfp@ycoord{\mfp@bshift}% - \mfpaddto\mfp@ycoord{#3}\or + \mfpaddto\mfp@ycoord\ymin\or \tl@hpos-1 \edef\mfp@xcoord{-\mfp@rshift}% - \mfpaddto\mfp@xcoord{#2}\or + \mfpaddto\mfp@xcoord\xmax\or \tl@vpos0 \edef\mfp@ycoord{-\mfp@tshift}% - \mfpaddto\mfp@ycoord{#4}% + \mfpaddto\mfp@ycoord\ymax \fi \ifx\@firstofone\mfp@xcoord \edef\mfp@ycoord##1{\mfp@ycoord}% @@ -1655,16 +1740,18 @@ \def\@mfpverbtex{% \begingroup \@makeother\#\@makeother\%\mfp@keeplines - \afterassignment\mfp@writetex\global\mfp@verbtex}% + \afterassignment\mfp@writetex\global\mfp@toks}% \newif\ifmfp@verbtex \def\mfp@writetex{% \endgroup \mfp@ifopengraphsfile {\mfp@ifmpost - {\mfsrc{ verbatimtex\@nl \the\mfp@verbtex}\mfcmd{etex}}% - {\mfp@noMP@error\mfpverbtex}% - \global\mfp@verbtexfalse\mfp@verbtex{}}% - {\global\mfp@verbtextrue}}% + {\mfsrc{ verbatimtex\@nl \the\mfp@toks}\mfcmd{etex}}% + {\mfp@noMP@error\mfpverbtex}% + \global\mfp@verbtexfalse\global\mfp@verbtex{}}% + {\edef\mfp@tempa{\the\mfp@verbtex\the\mfp@toks}% + \global\mfp@verbtex\@xp{\mfp@tempa}% + \global\mfp@verbtextrue}}% \mfpicnumber{1}% \InputIfFileExists{mfppatch.tex}{}{}% \mfp@ifdefined\mfpdraftfont{}{\newdef\mfpdraftfont{\tt}}% |