% \iffalse
% +AMDG  This document was begun on 3 August 11EE, the eve
% of the Feast of St. Dominic, C, and it is humbly
% dedicated to him and to the Immaculate Heart of Mary, for
% their prayers, and to the Sacred Heart of Jesus, for His
% mercy.
% 
% This document is copyright 2015 by Donald P. Goodman, and is
% released publicly under the LaTeX Project Public License.  The
% distribution and modification of this work is constrained by the
% conditions of that license.  See
% 	http://www.latex-project.org/lppl.txt
% for the text of the license.  This document is released
% under version 1.3 of that license, and this work may be distributed
% or modified under the terms of that license or, at your option, any
% later version.
% 
% This work has the LPPL maintenance status 'maintained'.
% 
% The Current Maintainer of this work is Donald P. Goodman
% (dgoodmaniii@gmail.com).
% 
% This work consists of the files lroundrect.dtx and
% lroundrect.ins, along with the generated file lroundrect.sty
% and lroundrect.pdf, and the README.
% \fi

% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{lroundrect}[2015/09/01 v1.0 LaTeX macros utilizing the Metapost roundrect code]
%<*driver>

\documentclass{ltxdoc}
\usepackage{url}
\usepackage[typeone]{dozenal}
\usepackage{verbatim}
\usepackage{mflogo}
\usepackage[everymp={input roundrect;},latex]{gmp}
	\usempxpackage{color}
\usepackage{color}
\usepackage{makeidx}
\usepackage{lroundrect}
\makeindex
\long\def\demonstrate#1#2{%
	\bigskip%
	\hrule%
	\hbox to\linewidth{%
		\hbox to0.5\linewidth{%
			\vbox to2in{\vfil#1\vfil}%
		}\hbox to0.5\linewidth{%
			\vbox to2in{\vfil#2\vfil}%
		}%
	}%
	\hrule%
	\bigskip%
}

\begin{document}
\DocInput{lroundrect.dtx}
\end{document}
%</driver>
% \fi
% \title{The \texttt{lroundrect} Package, v1.0}
% \author{Donald P.\ Goodman III}
% \date{\today}
%
% \maketitle
% \begin{abstract}\noindent
% The |lroundrect| package is the \LaTeX\ companion for the
% |roundrect| macros for \MP; they provide an easy interface
% for a few specific formats, and a good example for how to
% write your own rounded-rectangle macros for use in \LaTeX\
% documents or elsewhere.  The idea with this package and
% with the \MP\ |roundrect| macros was to
% provide a \MP-based replacement for the incredibly
% versatile |tcolorbox| package; this package is far from
% achieving that goal.  But it is nevertheless extremely
% useful.
% \end{abstract}
% 
% \tableofcontents
%
% \section{Introduction}
%
% While Ti\textit{k}Z and its many accompanying packages,
% particularly |tcolorbox|, are wonderful and powerful
% tools, whenever using them I inevitably feel completely
% lost, and I exert great effort doing comparatively simple
% things.  Contrariwise, thanks to my experience with the
% |drm| and |dozenal| packages, writing in \MP\ is quite
% straightforward for me.  So I decided to try to write some
% generalized macros to provide functionality similar to
% that of |tcolorbox|.  This package (along with
% |roundrect|, its accompanying \MP\ package) is not even
% close to that kind of flexibility or power, but it's still
% quite useful and versatile, so I make it available for
% anyone who might be interested.
%
% This document was typeset in accordance with the
% |docstrip| utility, which allows the automatic extraction
% of code and documentation from the same document.
%
% \section{Prerequisites and Conventions}
%
% Some prerequesites for using this package are \MP\ itself
% (obviously).  If you're using the package with \LaTeX, the
% |gmp| package would probably be helpful; be sure to use
% the |latex| package option.  Finally, the
% package internally calls |TEX.mp|, so that is also
% required.  All of these should be packaged in any
% reasonably modern \LaTeX\ system, such as \TeX Live or
% Mik\TeX.
%
% This documentation assumes nothing about your personal
% \TeX\ or \MP\ environment.  Con\TeX t and the various
% forms of Lua\TeX\ have \MP\ built-in; with pdf\LaTeX, the
% author's choice, one can use the |gmp| package to
% include the source directly in one's document (that's
% what's been done in this documentation) or develop a
% simple script to compile them afterwards and include them
% in the source via |\includegraphics| (probably the
% quickest option, since compilation is done in advance).
% Here, we simply post the plain vanilla \MP\ code, and let
% you work out those details however you prefer.
%
% \section{Basic Usage}
%
% |lroundrect| utilizes the \MP\ |roundrect| macros to
% perform typesetting within a \LaTeX\ document.  To do
% this, it has a number of predefined styles which can be
% selected.  These styles consist of different names and,
% often, different numbers of arguments.  Here is the
% simplest, \DescribeMacro{\rralertbox}|\rralertbox|:
%
% \begin{quote}
%	|\rralertbox{\unexpanded{\Huge This is an rralertbox!}}|
% \end{quote}
%
% \noindent yields the following:
%
% \hbox to\linewidth{%
%	\hfil%
%	\rralertbox{\unexpanded{\Huge This is an rralertbox!}}%
%	\hfil%
% }
%
% The |\unexpanded| is simply to protect the font commands
% when they are used with the |gmp| package in pdf\LaTeX;
% it is not necessary otherwise.  |\rralertbox| is produced
% with the following code:
%
%    \begin{macrocode}
\def\rralertbox#1{%
	\begin{mpost}
	rrborderpen(pencircle scaled 3);
	rrbodytext := "#1";
	rrbordercolor(0.8red);
	rrtextcolor := 0.8red;
	rrinnercolor := 0.5[red,white];
	roundrect(1in,2in)(alertbox);
	draw alertbox;
	\end{mpost}
}%
%    \end{macrocode}
%
% \noindent
% It's not claimed that this particularly good style; it
% serves merely as an example of what we can do.
%
% Another simple example (and likely equally ugly
% color-wise) is
% \DescribeMacro{\rrorangebluebox}|\rrorangebluebox| (using
% the |mpcolornames| package for color names):
%
% \hbox to\linewidth{%
%	\hfil%
%	\rrorangebluebox{Title}{This is the body of the box, and
%	has lots of very interesting text in it.  Enough, in
%	fact, that it wraps, so we can see how the box expands
%	based on the size of its argument.}
%	\hfil%
% }%
%
% This is the sort of macro that might be useful for, say,
% chapter headings:
%
% \hbox to\linewidth{%
%	\hfil%
%	\rrorangebluebox{Chapter 5}{The Very Interesting Chapter	Title}
%	\hfil%
% }
%
% \noindent
% This provides an interesting way to display things,
% particularly items like headings and definitions.  Both
% the title and the body will expand to fit their contents
% as necessary, though if the title is too long its
% positioning won't work well.  (By ``title'' I mean the
% orange box.)  The code producing these boxes is below.
%
%    \begin{macrocode}
\newlength{\rrorangewid}
\newdimen\rrblueht
\newdimen\rrorangeht
\newbox\rrbluebox
\newbox\rrorangebox
\def\rrorangebluebox#1#2{%
	\settowidth{\rrorangewid}{\ \scshape #1\ }
	\savebox\rrbluebox{\parbox{\linewidth}{#2}}
	\advance\rrorangewid by6pt
	\savebox\rrorangebox{\parbox{\rrorangewid}{#1}}
	\rrorangeht=\ht\rrorangebox
	\advance\rrorangeht by\dp\rrorangebox
	\advance\rrorangeht by\baselineskip
	\rrblueht=\ht\rrbluebox
	\advance\rrblueht by\dp\rrbluebox
	\advance\rrblueht by\baselineskip
	\begin{mpost}
	input mpcolornames;
	rrborderrad(10pt);
	rrbotlftborderrad := 0pt;
	rrbotrtborderrad := 0pt;
	rrbordercolor(DarkGoldenrod1);
	rrinnercolor := DarkGoldenrod1;
	rrtextalign := "\unexpanded{\raggedright}";
	rrtextfont := "\unexpanded{\scshape}";
	rrbodytext := "#1";
	roundrect(\mpdim{\rrorangeht})(\mpdim{\rrorangewid})(orangebluebox);
	rrrestorevals;
	rrborderrad(10pt);
	rrbordercolor(blue);
	rrinnercolor := blue;
	rrbodytext := "#2";
	rrtextcolor := white;
	rrtextfont := "\unexpanded{\bfseries}";
	rrtextalign := "";
	roundrect(\mpdim{\rrblueht})(\mpdim{\linewidth})(mainbox);
	draw orangebluebox shifted (-\mpdim{0.3\linewidth},0);
	draw mainbox shifted (0,-\mpdim{\rrblueht}/2-\mpdim{\rrorangeht}/2);
	\end{mpost}
}%
%    \end{macrocode}
%
% As we can see, the hardest thing about this macro is
% ensuring that the heights and widths are correct; that
% done, all is really rather simple.  
%
% We can also imitate the sort of boxes that |tcolorbox|
% produces by default with \DescribeMacro{\rrdefaultbox}
% |\rrdefaultbox|:
%
% \noindent
% \rrdefaultbox{Title}{This is the body of the box, and has
% lots of very interesting text in it; so much, in fact,
% that it will have to be wrapped, thus displaying the way
% that this macro produces boxes
% which \unexpanded{\special{1 0 0 setrgbcolor}}will expand
% appropriately according to their contents.  Even more,
% we'll \unexpanded{\emph{put in some font changes}} to show that we can
% \unexpanded{\textsc{style our text}} without
% causing trouble.}
%
% The code producing these boxes is here:
%
%    \begin{macrocode}
\newlength{\rrtitlewid}
\newlength{\rrtitleht}
\newlength{\rrmainht}
\newbox\rrtitlebox\newbox\rrmainbox
\def\rrdefaultbox#1#2{%
	\settowidth{\rrtitlewid}{\ \scshape #1\ }
	\savebox\rrmainbox{\parbox{\linewidth}{#2}}
	\advance\rrtitlewid by6pt
	\savebox\rrtitlebox{\parbox{\rrtitlewid}{#1}}
	\rrtitleht=\ht\rrtitlebox
	\advance\rrtitleht by\dp\rrtitlebox
	\advance\rrtitleht by\baselineskip
	\rrmainht=\ht\rrmainbox
	\advance\rrmainht by\dp\rrmainbox
	\advance\rrmainht by\baselineskip
	\begin{mpost}
	input mpcolornames;
	rrborderrad(10pt);
	rrbotlftborderrad := 0pt;
	rrbotrtborderrad := 0pt;
	rrbodytext := "#1";
	roundrect(\mpdim{\rrtitleht})(\mpdim{\linewidth})(titlebox);
	rrrestorevals;
	rrborderrad(10pt);
	rrtoplftborderrad := 0pt;
	rrtoprtborderrad := 0pt;
	rrtopborderpen := pencircle scaled 1;
	rrbodytext := "#2";
	rrtextalign := "";
	roundrect(\mpdim{\rrmainht})(\mpdim{\linewidth})(mainbox);
	draw titlebox;
	draw mainbox shifted (0,-\mpdim{\rrmainht}/2-\mpdim{\rrtitleht}/2);
	\end{mpost}
}
%    \end{macrocode}
%
% Remember, if you are including these in a (pdf)\LaTeX\
% document using |gmp|, you need to wrap your font changing
% commands in |\unexpanded|, or \LaTeX\ will give \MP\ a
% bunch of gobbledygook that it can't understand.
% |\unexpanded| ensures that \MP\ gets something it can work
% with.  With other methods of inclusion, however,
% |\unexpanded| is not necessary.
%
% |lroundrect| also provides a box similar to that used in
% the |tcolorbox| documentation for examples:
%
% \begin{quote}
% |\rrtcolorex{\texttt{$\backslash$tcbuselibrary{listings,theorems}}}|
% \end{quote}
%
% \noindent
% \rrtcolorex{\unexpanded{\texttt{$\backslash$tcbuselibrary{listings,theorems}}}}
%
% The following code produces these boxes (and assumes that
% the contents will be only one line):
%
%    \begin{macrocode}
\def\rrtcolorex#1{%
	\begin{mpost}
	rrborderrad(10pt);
	rrbordercolor(blue);
	rrtopbordercolor := 0.5[green,black];
	rrinnercolor := 0.8[blue,white];
	rrbodytext := "#1";
	roundrect(2\mpdim{\baselineskip},\mpdim{\linewidth})(rrexampbox);
	draw rrexampbox;
	\end{mpost}
}%
%    \end{macrocode}
%
% The tags from the |tcolorbox| documentation can also be
% closely reproduced using the
% \DescribeMacro{\rrtcoltag}|\rrtcoltag| macro:
%
% \begin{quote}
% |\rrtcoltag{LIB}{skins}| \\
% |\rrtcoltag{ALT}{rasterized}| \\
% |\rrtcoltag{DEF}{wow, this one is really long}| \\
% \end{quote}
%
% \rrtcoltag{LIB}{skins}
% \rrtcoltag{ALT}{rasterized}
% \rrtcoltag{DEF}{wow, this one is really long}
%
% \noindent This is one of the more complicated definitions
% in this little package; but it works well when the first
% argument is short and the second is limited to one line.
%
%    \begin{macrocode}
\newdimen\rrtcoltagwd
\newbox\rrtcoltagbox
\def\rrtcoltag#1#2{%
	\settowidth{\rrtcoltagwd}{#2}
	\advance\rrtcoltagwd by12pt
	\begin{mpost}
	input mpcolornames;
	rrborderrad(5pt);
	rrbotlftborderrad := 0pt;
	rrbotrtborderrad := 0pt;
	rrnobot := true;
	rrinnercolor := 0.5[green,white];
	rrbodytext := "#1";
	rrtextfont := "\unexpanded{\sffamily}";
	rrtextcolor := Khaki1;
	roundrect(\mpdim{1.5em},2.5\mpdim{\baselineskip})(rrtaglabel);
	rrrestorevals;
	rrborderrad(5pt);
	rrtoplftborderrad := 0pt;
	rrbotlftborderrad := 0pt;
	rrinnercolor := 0.7[green,white];
	rrnolft := true;
	rrbodytext := "#2";
	roundrect(2.5\mpdim{\baselineskip},\mpdim{\rrtcoltagwd})(rrtextlabel);
	draw rrtaglabel rotatedaround((0,0),90);
	draw rrtextlabel shifted (\mpdim{\rrtcoltagwd}/2+0.625\mpdim{\baselineskip},0);
	\end{mpost}
}%
%    \end{macrocode}
%
% \section{Using metafun Extensions}
%
% We can also create interesting effects with drop shadows
% and transparency, if we're willing to use |metafun|
% macros.  Note that these won't work with |gmp| by default, which
% includes Metapost |.mps| files rather than |.pdf|;
% transparency effects require conversion to |pdf| first.
% However, |gmp| does perform conversion to |pdf| when the
% engine is Xe\TeX, so it's certainly possible; we simply
% need to redefine |\gmp@innermpost| to run |mptopdf| and
% include the |pdf| rather than the |mps|.  |lroundrect|
% provides the \DescribeMacro{\rrincludepdf}|\rrincludepdf|
% macro, which does all this for you.  Just issue:
%
% \begin{quote}
% |\rrincludepdf|
% \end{quote}
%
% After doing this, you can use all the |metafun| tricks you
% want, including transparency, and the resulting |pdf| will
% be included rather than the |mps|.
% \DescribeMacro{\rrtransbox}|\rrtransbox| takes a single
% argument, the text you want included, and it contains
% oddly-colored transparent |rrinnercolor| and
% |rrshadowcolor|s:
%
% \rrincludepdf
% \begin{quote}
%	|\rrtransbox{Some text}|
% \end{quote}
%
% \rrtransbox{Some text}
%
% The code which produces this is:
%
%    \begin{macrocode}
\def\rrtransbox#1{%
	\begin{mpost}[mpmem=metafun]
	rrbodytext := "#1";
	rrdropshadow := true;
	rrborderrad(20pt);
	rrinnercolor := transparent(0.5,0.5,0.5red);
	rrshadowcolor := transparent(0.5,0.5,0.625blue);
	rrshadowx := rrbotlftborderrad/4;
	rrshadowy := -rrbotlftborderrad/4;
	roundrect(1in,2in)(rectangle);
	draw rectangle;
	\end{mpost}
}%
%    \end{macrocode}
%
% The transparency here is interesting, if oddly colored;
% and this serves as a good example of what can be done with
% judicious use of shadows and transparency.
%
% To turn off the inclusion of |pdf|s (including them rather
% than |mps| does slow down compilation, since |mptopdf|
% needs to be run), issue
% \DescribeMacro{\rrincludemps}|\rrincludemps|, and |mps|
% files will be included as before.
%
% Using transparency from |metafun| enables us to do some
% really impressive things.  For example, the logo from the
% cover of the |tcolorbox| manual, modified to encompass
% |roundrect| (almost the same, anyway; |roundrect| still
% doesn't really support gradients, and I picked different
% colors):
%
% \begin{mpost}
%	input mpcolornames;
%	rrinnercolor := DarkOliveGreen4;
%	rrborderrad(0pt);
%	rrtoplftborderrad := 20pt;
%	rrtextfont := "\unexpanded{\bfseries}";
%	rrtextcolor := white;
%	rrbodytext := "roundrect 2.2";
%	rrborderpen(pencircle scaled 0);
%	roundrect(\mpdim{\baselineskip},0.3\mpdim{\linewidth})(toplftwingtitle);
%	roundrect(\mpdim{\baselineskip},0.25\mpdim{\linewidth})(botlftwingtitle);
%	rrborderrad(0pt);
%	rrtoprtborderrad := 20pt;
%	roundrect(\mpdim{\baselineskip},0.3\mpdim{\linewidth})(toprtwingtitle);
%	roundrect(\mpdim{\baselineskip},0.25\mpdim{\linewidth})(botrtwingtitle);
%	rrrestorevals;
%	rrborderrad(0pt);
%	rrbotlftborderrad := 20pt;
%	rrbodytext := "roundrect";
%	rrborderpen(pencircle scaled 0);
%	rrinnercolor := DarkOliveGreen1;
%	roundrect(1in,0.3\mpdim{\linewidth})(toplftwing);
%	rrbodytext := "";
%	rrbotrtborderrad := 20pt;
%	roundrect(1in,0.25\mpdim{\linewidth})(botlftwing);
%	rrbodytext := "Manual for version 2.2 (2016/02/19)";
%	rrborderrad(0pt);
%	rrbotrtborderrad := 20pt;
%	roundrect(1in,0.3\mpdim{\linewidth})(toprtwing);
%	rrtextwd := 0.2\mpdim{\linewidth};
%	rrbodytext := "Donald P.\ Goodman";
%	rrbotlftborderrad := 20pt;
%	roundrect(1in,0.25\mpdim{\linewidth})(botrtwing);
%	rrrestorevals;
%	rrinnercolor := (0.5,0.5,0.5);
%	rrborderpen(pencircle scaled 0);
%	rrbordercolor((0.5,0.5,0.5));
%	rrborderrad(10pt);
%	roundrect(1in+\mpdim{\baselineskip},0.25in)(topmid);
%	roundrect(0.25in,0.25in)(head);
%	draw toplftwingtitle;
%	draw toprtwingtitle shifted (0.3\mpdim{\linewidth}+0.5in,0);
%	draw botlftwingtitle shifted (0.025\mpdim{\linewidth},
%		-1in-1.5\mpdim{\baselineskip});
%	draw botrtwingtitle shifted %	(0.3\mpdim{\linewidth}+0.5in-
%		0.025\mpdim{\linewidth},-1in-1.5\mpdim{\baselineskip});
%	draw toplftwing shifted (0,-0.5in-0.5\mpdim{\baselineskip});
%	draw toprtwing shifted 
%		(0.3\mpdim{\linewidth}+0.5in,-0.5in-0.5\mpdim{\baselineskip});
%	draw botlftwing shifted (0.025\mpdim{\linewidth},
%		-1in-5\mpdim{\baselineskip});
%	draw botrtwing shifted (0.3\mpdim{\linewidth}+0.5in-
%		0.025\mpdim{\linewidth},-1in-5\mpdim{\baselineskip});
%	draw topmid shifted (0.15\mpdim{\linewidth}+0.25in,-0.5in);
%	draw topmid yscaled 1.2 shifted
%		(0.15\mpdim{\linewidth}+0.25in,-1.5in-1.6\mpdim{\baselineskip});
%	draw head shifted (0.15\mpdim{\linewidth}+0.25in,0.2in);
%	pickup pencircle scaled 2;
%	path p; p = (0,0){up}..{dir -200}(-0.175in,0.35in);
%	draw p shifted (0.15\mpdim{\linewidth}+0.25in,0.25in)
%		withcolor (0.5,0.5,0.5);
%	draw p reflectedabout ((0,0),(0,0.5in)) shifted 
%		(0.15\mpdim{\linewidth}+0.25in,0.25in)
%		withcolor (0.5,0.5,0.5);
% \end{mpost}
%
% This ``butterfly'' logo is quite similar (again, but for
% different colors and the lack of gradients), and it's got
% the advantage that the antennae are actually curved, since
% nicely curved lines are so much easier to do in \MP\ than
% in Ti\emph{k}Z.  This is a nice demonstration of the power
% that |roundrect| puts at your fingertips.
%
% \rrincludemps
%
%    \begin{macrocode}
\def\rrincludepdf{%
 \long\def\gmp@innermpost##1\end##2{%
	\ifgmp@nowrite\else
		\gmp@write\gmp@out{%
		##1^^Jendfig;^^Jend.%
		\gmp@doiflatex{^^Jverbatimtex^^J\string\end{document}^^Jetex}}%
	\gmp@closeout\gmp@out
	\count@=\gmp@runs
	\loop\ifnum\count@>\z@
		\gmp@shellcommand{\gmp@command\space
			-tex=\gmp@mpxprogram\space\gmp@jobname\gmp@ext
			\gmp@fourdigits{\gmp@number}}%
		\advance\count@\m@ne
		\repeat
		\ifxetex
			\gmp@shellcommand{epstopdf --hires
			\gmp@jobname\gmp@ext
				\gmp@fourdigits{\gmp@number}.mps}%
		\fi
			\gmp@shellcommand{mptopdf 
			--result=\gmp@jobname\gmp@ext
				\gmp@fourdigits{\gmp@number}.pdf 
			\gmp@jobname\gmp@ext
				\gmp@fourdigits{\gmp@number}.mps}%
			\gmp@shellcommand{mv
				\gmp@jobname\gmp@ext
				\gmp@fourdigits{\gmp@number}-mps.pdf 
				\gmp@jobname\gmp@ext
				\gmp@fourdigits{\gmp@number}.pdf}% 
		\egroup
		\end{##2}\ifgmp@use
		\gmp@usempost{\thegmp@count}\fi}
  \def\gmp@usempost##1{%
    \edef\gmp@thempsfile{\gmp@jobname\gmp@ext\gmp@fourdigits{##1}}%
    \IfFileExists{\gmp@thempsfile.pdf}%
    {\includegraphics{\gmp@thempsfile.pdf}}%
    {\gmp@nemessage\gmp@box}}
  \renewcommand\usempost[2][]{%
    \IfFileExists{\gmp@jobname\gmp@ext\csname gmp@fig##2\endcsname.pdf}%
    {\includegraphics[##1]
      {\gmp@jobname\gmp@ext\csname gmp@fig##2\endcsname.pdf}}%
    {\gmp@nemessage\gmp@box}}
}%
\def\rrincludemps{%
	\long\def\gmp@innermpost##1\end##2{%
	  \ifgmp@nowrite\else
	    \gmp@write\gmp@out{%
	      ##1^^Jendfig;^^Jend.%
	      \gmp@doiflatex{^^Jverbatimtex^^J\string\end{document}^^Jetex}}%
	    \gmp@closeout\gmp@out
	    \count@=\gmp@runs
	    \loop\ifnum\count@>\z@
	      \gmp@shellcommand{\gmp@command\space
	        -tex=\gmp@mpxprogram\space\gmp@jobname\gmp@ext
	        \gmp@fourdigits{\gmp@number}}%
	    \advance\count@\m@ne
	    \repeat
	    \ifxetex
	      \gmp@shellcommand{epstopdf --hires \gmp@jobname\gmp@ext
	        \gmp@fourdigits{\gmp@number}.mps}%
	    \fi
	  \fi
	  \egroup
	  \end{##2}\ifgmp@use
	  \gmp@usempost{\thegmp@count}\fi}
	\ifxetex
	  \def\gmp@usempost##1{%
	    \edef\gmp@thempsfile{\gmp@jobname\gmp@ext\gmp@fourdigits{##1}}%
	    \IfFileExists{\gmp@thempsfile.pdf}%
	    {\includegraphics{\gmp@thempsfile.pdf}}%
	    {\gmp@nemessage\gmp@box}}
	  \renewcommand\usempost[2][]{%
	    \IfFileExists{\gmp@jobname\gmp@ext\csname gmp@fig##2\endcsname.pdf}%
	    {\includegraphics[##1]
	      {\gmp@jobname\gmp@ext\csname gmp@fig##2\endcsname.pdf}}%
	    {\gmp@nemessage\gmp@box}}
	\else
	  \def\gmp@usempost##1{%
	    \edef\gmp@thempsfile{\gmp@jobname\gmp@ext\gmp@fourdigits{##1}}%
	    \IfFileExists{\gmp@thempsfile.mps}%
	    {\includegraphics[hiresbb]{\gmp@thempsfile.mps}}%
	    {\gmp@nemessage\gmp@box}}
	\renewcommand\usempost[2][]{%
	  \IfFileExists{\gmp@jobname\gmp@ext\csname gmp@fig##2\endcsname.mps}%
	  {\includegraphics[hiresbb,##1]
	    {\gmp@jobname\gmp@ext\csname gmp@fig##2\endcsname.mps}}%
	  {\gmp@nemessage\gmp@box}}
	\fi
}%
%    \end{macrocode}
% \end{document}
