Debian Codegraph @

texmf-dist/source/latex/lroundrect/lroundrect.dtx

raw
1 % \iffalse
2 % +AMDG This document was begun on 3 August 11EE, the eve
3 % of the Feast of St. Dominic, C, and it is humbly
4 % dedicated to him and to the Immaculate Heart of Mary, for
5 % their prayers, and to the Sacred Heart of Jesus, for His
6 % mercy.
7 %
8 % This document is copyright 2015 by Donald P. Goodman, and is
9 % released publicly under the LaTeX Project Public License. The
10 % distribution and modification of this work is constrained by the
11 % conditions of that license. See
12 % http://www.latex-project.org/lppl.txt
13 % for the text of the license. This document is released
14 % under version 1.3 of that license, and this work may be distributed
15 % or modified under the terms of that license or, at your option, any
16 % later version.
17 %
18 % This work has the LPPL maintenance status 'maintained'.
19 %
20 % The Current Maintainer of this work is Donald P. Goodman
21 % ([email protected]).
22 %
23 % This work consists of the files lroundrect.dtx and
24 % lroundrect.ins, along with the generated file lroundrect.sty
25 % and lroundrect.pdf, and the README.
26 % \fi
27
28 % \iffalse
29 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
30 %<package>\ProvidesPackage{lroundrect}[2015/09/01 v1.0 LaTeX macros utilizing the Metapost roundrect code]
31 %<*driver>
32
33 \documentclass{ltxdoc}
34 \usepackage{url}
35 \usepackage[typeone]{dozenal}
36 \usepackage{verbatim}
37 \usepackage{mflogo}
38 \usepackage[everymp={input roundrect;},latex]{gmp}
39 \usempxpackage{color}
40 \usepackage{color}
41 \usepackage{makeidx}
42 \usepackage{lroundrect}
43 \makeindex
44 \long\def\demonstrate#1#2{%
45 \bigskip%
46 \hrule%
47 \hbox to\linewidth{%
48 \hbox to0.5\linewidth{%
49 \vbox to2in{\vfil#1\vfil}%
50 }\hbox to0.5\linewidth{%
51 \vbox to2in{\vfil#2\vfil}%
52 }%
53 }%
54 \hrule%
55 \bigskip%
56 }
57
58 \begin{document}
59 \DocInput{lroundrect.dtx}
60 \end{document}
61 %</driver>
62 % \fi
63 % \title{The \texttt{lroundrect} Package, v1.0}
64 % \author{Donald P.\ Goodman III}
65 % \date{\today}
66 %
67 % \maketitle
68 % \begin{abstract}\noindent
69 % The |lroundrect| package is the \LaTeX\ companion for the
70 % |roundrect| macros for \MP; they provide an easy interface
71 % for a few specific formats, and a good example for how to
72 % write your own rounded-rectangle macros for use in \LaTeX\
73 % documents or elsewhere. The idea with this package and
74 % with the \MP\ |roundrect| macros was to
75 % provide a \MP-based replacement for the incredibly
76 % versatile |tcolorbox| package; this package is far from
77 % achieving that goal. But it is nevertheless extremely
78 % useful.
79 % \end{abstract}
80 %
81 % \tableofcontents
82 %
83 % \section{Introduction}
84 %
85 % While Ti\textit{k}Z and its many accompanying packages,
86 % particularly |tcolorbox|, are wonderful and powerful
87 % tools, whenever using them I inevitably feel completely
88 % lost, and I exert great effort doing comparatively simple
89 % things. Contrariwise, thanks to my experience with the
90 % |drm| and |dozenal| packages, writing in \MP\ is quite
91 % straightforward for me. So I decided to try to write some
92 % generalized macros to provide functionality similar to
93 % that of |tcolorbox|. This package (along with
94 % |roundrect|, its accompanying \MP\ package) is not even
95 % close to that kind of flexibility or power, but it's still
96 % quite useful and versatile, so I make it available for
97 % anyone who might be interested.
98 %
99 % This document was typeset in accordance with the
100 % |docstrip| utility, which allows the automatic extraction
101 % of code and documentation from the same document.
102 %
103 % \section{Prerequisites and Conventions}
104 %
105 % Some prerequesites for using this package are \MP\ itself
106 % (obviously). If you're using the package with \LaTeX, the
107 % |gmp| package would probably be helpful; be sure to use
108 % the |latex| package option. Finally, the
109 % package internally calls |TEX.mp|, so that is also
110 % required. All of these should be packaged in any
111 % reasonably modern \LaTeX\ system, such as \TeX Live or
112 % Mik\TeX.
113 %
114 % This documentation assumes nothing about your personal
115 % \TeX\ or \MP\ environment. Con\TeX t and the various
116 % forms of Lua\TeX\ have \MP\ built-in; with pdf\LaTeX, the
117 % author's choice, one can use the |gmp| package to
118 % include the source directly in one's document (that's
119 % what's been done in this documentation) or develop a
120 % simple script to compile them afterwards and include them
121 % in the source via |\includegraphics| (probably the
122 % quickest option, since compilation is done in advance).
123 % Here, we simply post the plain vanilla \MP\ code, and let
124 % you work out those details however you prefer.
125 %
126 % \section{Basic Usage}
127 %
128 % |lroundrect| utilizes the \MP\ |roundrect| macros to
129 % perform typesetting within a \LaTeX\ document. To do
130 % this, it has a number of predefined styles which can be
131 % selected. These styles consist of different names and,
132 % often, different numbers of arguments. Here is the
133 % simplest, \DescribeMacro{\rralertbox}|\rralertbox|:
134 %
135 % \begin{quote}
136 % |\rralertbox{\unexpanded{\Huge This is an rralertbox!}}|
137 % \end{quote}
138 %
139 % \noindent yields the following:
140 %
141 % \hbox to\linewidth{%
142 % \hfil%
143 % \rralertbox{\unexpanded{\Huge This is an rralertbox!}}%
144 % \hfil%
145 % }
146 %
147 % The |\unexpanded| is simply to protect the font commands
148 % when they are used with the |gmp| package in pdf\LaTeX;
149 % it is not necessary otherwise. |\rralertbox| is produced
150 % with the following code:
151 %
152 % \begin{macrocode}
153 \def\rralertbox#1{%
154 \begin{mpost}
155 rrborderpen(pencircle scaled 3);
156 rrbodytext := "#1";
157 rrbordercolor(0.8red);
158 rrtextcolor := 0.8red;
159 rrinnercolor := 0.5[red,white];
160 roundrect(1in,2in)(alertbox);
161 draw alertbox;
162 \end{mpost}
163 }%
164 % \end{macrocode}
165 %
166 % \noindent
167 % It's not claimed that this particularly good style; it
168 % serves merely as an example of what we can do.
169 %
170 % Another simple example (and likely equally ugly
171 % color-wise) is
172 % \DescribeMacro{\rrorangebluebox}|\rrorangebluebox| (using
173 % the |mpcolornames| package for color names):
174 %
175 % \hbox to\linewidth{%
176 % \hfil%
177 % \rrorangebluebox{Title}{This is the body of the box, and
178 % has lots of very interesting text in it. Enough, in
179 % fact, that it wraps, so we can see how the box expands
180 % based on the size of its argument.}
181 % \hfil%
182 % }%
183 %
184 % This is the sort of macro that might be useful for, say,
185 % chapter headings:
186 %
187 % \hbox to\linewidth{%
188 % \hfil%
189 % \rrorangebluebox{Chapter 5}{The Very Interesting Chapter Title}
190 % \hfil%
191 % }
192 %
193 % \noindent
194 % This provides an interesting way to display things,
195 % particularly items like headings and definitions. Both
196 % the title and the body will expand to fit their contents
197 % as necessary, though if the title is too long its
198 % positioning won't work well. (By ``title'' I mean the
199 % orange box.) The code producing these boxes is below.
200 %
201 % \begin{macrocode}
202 \newlength{\rrorangewid}
203 \newdimen\rrblueht
204 \newdimen\rrorangeht
205 \newbox\rrbluebox
206 \newbox\rrorangebox
207 \def\rrorangebluebox#1#2{%
208 \settowidth{\rrorangewid}{\ \scshape #1\ }
209 \savebox\rrbluebox{\parbox{\linewidth}{#2}}
210 \advance\rrorangewid by6pt
211 \savebox\rrorangebox{\parbox{\rrorangewid}{#1}}
212 \rrorangeht=\ht\rrorangebox
213 \advance\rrorangeht by\dp\rrorangebox
214 \advance\rrorangeht by\baselineskip
215 \rrblueht=\ht\rrbluebox
216 \advance\rrblueht by\dp\rrbluebox
217 \advance\rrblueht by\baselineskip
218 \begin{mpost}
219 input mpcolornames;
220 rrborderrad(10pt);
221 rrbotlftborderrad := 0pt;
222 rrbotrtborderrad := 0pt;
223 rrbordercolor(DarkGoldenrod1);
224 rrinnercolor := DarkGoldenrod1;
225 rrtextalign := "\unexpanded{\raggedright}";
226 rrtextfont := "\unexpanded{\scshape}";
227 rrbodytext := "#1";
228 roundrect(\mpdim{\rrorangeht})(\mpdim{\rrorangewid})(orangebluebox);
229 rrrestorevals;
230 rrborderrad(10pt);
231 rrbordercolor(blue);
232 rrinnercolor := blue;
233 rrbodytext := "#2";
234 rrtextcolor := white;
235 rrtextfont := "\unexpanded{\bfseries}";
236 rrtextalign := "";
237 roundrect(\mpdim{\rrblueht})(\mpdim{\linewidth})(mainbox);
238 draw orangebluebox shifted (-\mpdim{0.3\linewidth},0);
239 draw mainbox shifted (0,-\mpdim{\rrblueht}/2-\mpdim{\rrorangeht}/2);
240 \end{mpost}
241 }%
242 % \end{macrocode}
243 %
244 % As we can see, the hardest thing about this macro is
245 % ensuring that the heights and widths are correct; that
246 % done, all is really rather simple.
247 %
248 % We can also imitate the sort of boxes that |tcolorbox|
249 % produces by default with \DescribeMacro{\rrdefaultbox}
250 % |\rrdefaultbox|:
251 %
252 % \noindent
253 % \rrdefaultbox{Title}{This is the body of the box, and has
254 % lots of very interesting text in it; so much, in fact,
255 % that it will have to be wrapped, thus displaying the way
256 % that this macro produces boxes
257 % which \unexpanded{\special{1 0 0 setrgbcolor}}will expand
258 % appropriately according to their contents. Even more,
259 % we'll \unexpanded{\emph{put in some font changes}} to show that we can
260 % \unexpanded{\textsc{style our text}} without
261 % causing trouble.}
262 %
263 % The code producing these boxes is here:
264 %
265 % \begin{macrocode}
266 \newlength{\rrtitlewid}
267 \newlength{\rrtitleht}
268 \newlength{\rrmainht}
269 \newbox\rrtitlebox\newbox\rrmainbox
270 \def\rrdefaultbox#1#2{%
271 \settowidth{\rrtitlewid}{\ \scshape #1\ }
272 \savebox\rrmainbox{\parbox{\linewidth}{#2}}
273 \advance\rrtitlewid by6pt
274 \savebox\rrtitlebox{\parbox{\rrtitlewid}{#1}}
275 \rrtitleht=\ht\rrtitlebox
276 \advance\rrtitleht by\dp\rrtitlebox
277 \advance\rrtitleht by\baselineskip
278 \rrmainht=\ht\rrmainbox
279 \advance\rrmainht by\dp\rrmainbox
280 \advance\rrmainht by\baselineskip
281 \begin{mpost}
282 input mpcolornames;
283 rrborderrad(10pt);
284 rrbotlftborderrad := 0pt;
285 rrbotrtborderrad := 0pt;
286 rrbodytext := "#1";
287 roundrect(\mpdim{\rrtitleht})(\mpdim{\linewidth})(titlebox);
288 rrrestorevals;
289 rrborderrad(10pt);
290 rrtoplftborderrad := 0pt;
291 rrtoprtborderrad := 0pt;
292 rrtopborderpen := pencircle scaled 1;
293 rrbodytext := "#2";
294 rrtextalign := "";
295 roundrect(\mpdim{\rrmainht})(\mpdim{\linewidth})(mainbox);
296 draw titlebox;
297 draw mainbox shifted (0,-\mpdim{\rrmainht}/2-\mpdim{\rrtitleht}/2);
298 \end{mpost}
299 }
300 % \end{macrocode}
301 %
302 % Remember, if you are including these in a (pdf)\LaTeX\
303 % document using |gmp|, you need to wrap your font changing
304 % commands in |\unexpanded|, or \LaTeX\ will give \MP\ a
305 % bunch of gobbledygook that it can't understand.
306 % |\unexpanded| ensures that \MP\ gets something it can work
307 % with. With other methods of inclusion, however,
308 % |\unexpanded| is not necessary.
309 %
310 % |lroundrect| also provides a box similar to that used in
311 % the |tcolorbox| documentation for examples:
312 %
313 % \begin{quote}
314 % |\rrtcolorex{\texttt{$\backslash$tcbuselibrary{listings,theorems}}}|
315 % \end{quote}
316 %
317 % \noindent
318 % \rrtcolorex{\unexpanded{\texttt{$\backslash$tcbuselibrary{listings,theorems}}}}
319 %
320 % The following code produces these boxes (and assumes that
321 % the contents will be only one line):
322 %
323 % \begin{macrocode}
324 \def\rrtcolorex#1{%
325 \begin{mpost}
326 rrborderrad(10pt);
327 rrbordercolor(blue);
328 rrtopbordercolor := 0.5[green,black];
329 rrinnercolor := 0.8[blue,white];
330 rrbodytext := "#1";
331 roundrect(2\mpdim{\baselineskip},\mpdim{\linewidth})(rrexampbox);
332 draw rrexampbox;
333 \end{mpost}
334 }%
335 % \end{macrocode}
336 %
337 % The tags from the |tcolorbox| documentation can also be
338 % closely reproduced using the
339 % \DescribeMacro{\rrtcoltag}|\rrtcoltag| macro:
340 %
341 % \begin{quote}
342 % |\rrtcoltag{LIB}{skins}| \\
343 % |\rrtcoltag{ALT}{rasterized}| \\
344 % |\rrtcoltag{DEF}{wow, this one is really long}| \\
345 % \end{quote}
346 %
347 % \rrtcoltag{LIB}{skins}
348 % \rrtcoltag{ALT}{rasterized}
349 % \rrtcoltag{DEF}{wow, this one is really long}
350 %
351 % \noindent This is one of the more complicated definitions
352 % in this little package; but it works well when the first
353 % argument is short and the second is limited to one line.
354 %
355 % \begin{macrocode}
356 \newdimen\rrtcoltagwd
357 \newbox\rrtcoltagbox
358 \def\rrtcoltag#1#2{%
359 \settowidth{\rrtcoltagwd}{#2}
360 \advance\rrtcoltagwd by12pt
361 \begin{mpost}
362 input mpcolornames;
363 rrborderrad(5pt);
364 rrbotlftborderrad := 0pt;
365 rrbotrtborderrad := 0pt;
366 rrnobot := true;
367 rrinnercolor := 0.5[green,white];
368 rrbodytext := "#1";
369 rrtextfont := "\unexpanded{\sffamily}";
370 rrtextcolor := Khaki1;
371 roundrect(\mpdim{1.5em},2.5\mpdim{\baselineskip})(rrtaglabel);
372 rrrestorevals;
373 rrborderrad(5pt);
374 rrtoplftborderrad := 0pt;
375 rrbotlftborderrad := 0pt;
376 rrinnercolor := 0.7[green,white];
377 rrnolft := true;
378 rrbodytext := "#2";
379 roundrect(2.5\mpdim{\baselineskip},\mpdim{\rrtcoltagwd})(rrtextlabel);
380 draw rrtaglabel rotatedaround((0,0),90);
381 draw rrtextlabel shifted (\mpdim{\rrtcoltagwd}/2+0.625\mpdim{\baselineskip},0);
382 \end{mpost}
383 }%
384 % \end{macrocode}
385 %
386 % \section{Using metafun Extensions}
387 %
388 % We can also create interesting effects with drop shadows
389 % and transparency, if we're willing to use |metafun|
390 % macros. Note that these won't work with |gmp| by default, which
391 % includes Metapost |.mps| files rather than |.pdf|;
392 % transparency effects require conversion to |pdf| first.
393 % However, |gmp| does perform conversion to |pdf| when the
394 % engine is Xe\TeX, so it's certainly possible; we simply
395 % need to redefine |\gmp@innermpost| to run |mptopdf| and
396 % include the |pdf| rather than the |mps|. |lroundrect|
397 % provides the \DescribeMacro{\rrincludepdf}|\rrincludepdf|
398 % macro, which does all this for you. Just issue:
399 %
400 % \begin{quote}
401 % |\rrincludepdf|
402 % \end{quote}
403 %
404 % After doing this, you can use all the |metafun| tricks you
405 % want, including transparency, and the resulting |pdf| will
406 % be included rather than the |mps|.
407 % \DescribeMacro{\rrtransbox}|\rrtransbox| takes a single
408 % argument, the text you want included, and it contains
409 % oddly-colored transparent |rrinnercolor| and
410 % |rrshadowcolor|s:
411 %
412 % \rrincludepdf
413 % \begin{quote}
414 % |\rrtransbox{Some text}|
415 % \end{quote}
416 %
417 % \rrtransbox{Some text}
418 %
419 % The code which produces this is:
420 %
421 % \begin{macrocode}
422 \def\rrtransbox#1{%
423 \begin{mpost}[mpmem=metafun]
424 rrbodytext := "#1";
425 rrdropshadow := true;
426 rrborderrad(20pt);
427 rrinnercolor := transparent(0.5,0.5,0.5red);
428 rrshadowcolor := transparent(0.5,0.5,0.625blue);
429 rrshadowx := rrbotlftborderrad/4;
430 rrshadowy := -rrbotlftborderrad/4;
431 roundrect(1in,2in)(rectangle);
432 draw rectangle;
433 \end{mpost}
434 }%
435 % \end{macrocode}
436 %
437 % The transparency here is interesting, if oddly colored;
438 % and this serves as a good example of what can be done with
439 % judicious use of shadows and transparency.
440 %
441 % To turn off the inclusion of |pdf|s (including them rather
442 % than |mps| does slow down compilation, since |mptopdf|
443 % needs to be run), issue
444 % \DescribeMacro{\rrincludemps}|\rrincludemps|, and |mps|
445 % files will be included as before.
446 %
447 % Using transparency from |metafun| enables us to do some
448 % really impressive things. For example, the logo from the
449 % cover of the |tcolorbox| manual, modified to encompass
450 % |roundrect| (almost the same, anyway; |roundrect| still
451 % doesn't really support gradients, and I picked different
452 % colors):
453 %
454 % \begin{mpost}
455 % input mpcolornames;
456 % rrinnercolor := DarkOliveGreen4;
457 % rrborderrad(0pt);
458 % rrtoplftborderrad := 20pt;
459 % rrtextfont := "\unexpanded{\bfseries}";
460 % rrtextcolor := white;
461 % rrbodytext := "roundrect 2.2";
462 % rrborderpen(pencircle scaled 0);
463 % roundrect(\mpdim{\baselineskip},0.3\mpdim{\linewidth})(toplftwingtitle);
464 % roundrect(\mpdim{\baselineskip},0.25\mpdim{\linewidth})(botlftwingtitle);
465 % rrborderrad(0pt);
466 % rrtoprtborderrad := 20pt;
467 % roundrect(\mpdim{\baselineskip},0.3\mpdim{\linewidth})(toprtwingtitle);
468 % roundrect(\mpdim{\baselineskip},0.25\mpdim{\linewidth})(botrtwingtitle);
469 % rrrestorevals;
470 % rrborderrad(0pt);
471 % rrbotlftborderrad := 20pt;
472 % rrbodytext := "roundrect";
473 % rrborderpen(pencircle scaled 0);
474 % rrinnercolor := DarkOliveGreen1;
475 % roundrect(1in,0.3\mpdim{\linewidth})(toplftwing);
476 % rrbodytext := "";
477 % rrbotrtborderrad := 20pt;
478 % roundrect(1in,0.25\mpdim{\linewidth})(botlftwing);
479 % rrbodytext := "Manual for version 2.2 (2016/02/19)";
480 % rrborderrad(0pt);
481 % rrbotrtborderrad := 20pt;
482 % roundrect(1in,0.3\mpdim{\linewidth})(toprtwing);
483 % rrtextwd := 0.2\mpdim{\linewidth};
484 % rrbodytext := "Donald P.\ Goodman";
485 % rrbotlftborderrad := 20pt;
486 % roundrect(1in,0.25\mpdim{\linewidth})(botrtwing);
487 % rrrestorevals;
488 % rrinnercolor := (0.5,0.5,0.5);
489 % rrborderpen(pencircle scaled 0);
490 % rrbordercolor((0.5,0.5,0.5));
491 % rrborderrad(10pt);
492 % roundrect(1in+\mpdim{\baselineskip},0.25in)(topmid);
493 % roundrect(0.25in,0.25in)(head);
494 % draw toplftwingtitle;
495 % draw toprtwingtitle shifted (0.3\mpdim{\linewidth}+0.5in,0);
496 % draw botlftwingtitle shifted (0.025\mpdim{\linewidth},
497 % -1in-1.5\mpdim{\baselineskip});
498 % draw botrtwingtitle shifted % (0.3\mpdim{\linewidth}+0.5in-
499 % 0.025\mpdim{\linewidth},-1in-1.5\mpdim{\baselineskip});
500 % draw toplftwing shifted (0,-0.5in-0.5\mpdim{\baselineskip});
501 % draw toprtwing shifted
502 % (0.3\mpdim{\linewidth}+0.5in,-0.5in-0.5\mpdim{\baselineskip});
503 % draw botlftwing shifted (0.025\mpdim{\linewidth},
504 % -1in-5\mpdim{\baselineskip});
505 % draw botrtwing shifted (0.3\mpdim{\linewidth}+0.5in-
506 % 0.025\mpdim{\linewidth},-1in-5\mpdim{\baselineskip});
507 % draw topmid shifted (0.15\mpdim{\linewidth}+0.25in,-0.5in);
508 % draw topmid yscaled 1.2 shifted
509 % (0.15\mpdim{\linewidth}+0.25in,-1.5in-1.6\mpdim{\baselineskip});
510 % draw head shifted (0.15\mpdim{\linewidth}+0.25in,0.2in);
511 % pickup pencircle scaled 2;
512 % path p; p = (0,0){up}..{dir -200}(-0.175in,0.35in);
513 % draw p shifted (0.15\mpdim{\linewidth}+0.25in,0.25in)
514 % withcolor (0.5,0.5,0.5);
515 % draw p reflectedabout ((0,0),(0,0.5in)) shifted
516 % (0.15\mpdim{\linewidth}+0.25in,0.25in)
517 % withcolor (0.5,0.5,0.5);
518 % \end{mpost}
519 %
520 % This ``butterfly'' logo is quite similar (again, but for
521 % different colors and the lack of gradients), and it's got
522 % the advantage that the antennae are actually curved, since
523 % nicely curved lines are so much easier to do in \MP\ than
524 % in Ti\emph{k}Z. This is a nice demonstration of the power
525 % that |roundrect| puts at your fingertips.
526 %
527 % \rrincludemps
528 %
529 % \begin{macrocode}
530 \def\rrincludepdf{%
531 \long\def\gmp@innermpost##1\end##2{%
532 \ifgmp@nowrite\else
533 \gmp@write\gmp@out{%
534 ##1^^Jendfig;^^Jend.%
535 \gmp@doiflatex{^^Jverbatimtex^^J\string\end{document}^^Jetex}}%
536 \gmp@closeout\gmp@out
537 \count@=\gmp@runs
538 \loop\ifnum\count@>\z@
539 \gmp@shellcommand{\gmp@command\space
540 -tex=\gmp@mpxprogram\space\gmp@jobname\gmp@ext
541 \gmp@fourdigits{\gmp@number}}%
542 \advance\count@\m@ne
543 \repeat
544 \ifxetex
545 \gmp@shellcommand{epstopdf --hires
546 \gmp@jobname\gmp@ext
547 \gmp@fourdigits{\gmp@number}.mps}%
548 \fi
549 \gmp@shellcommand{mptopdf
550 --result=\gmp@jobname\gmp@ext
551 \gmp@fourdigits{\gmp@number}.pdf
552 \gmp@jobname\gmp@ext
553 \gmp@fourdigits{\gmp@number}.mps}%
554 \gmp@shellcommand{mv
555 \gmp@jobname\gmp@ext
556 \gmp@fourdigits{\gmp@number}-mps.pdf
557 \gmp@jobname\gmp@ext
558 \gmp@fourdigits{\gmp@number}.pdf}%
559 \egroup
560 \end{##2}\ifgmp@use
561 \gmp@usempost{\thegmp@count}\fi}
562 \def\gmp@usempost##1{%
563 \edef\gmp@thempsfile{\gmp@jobname\gmp@ext\gmp@fourdigits{##1}}%
564 \IfFileExists{\[email protected]}%
565 {\includegraphics{\[email protected]}}%
566 {\gmp@nemessage\gmp@box}}
567 \renewcommand\usempost[2][]{%
568 \IfFileExists{\gmp@jobname\gmp@ext\csname gmp@fig##2\endcsname.pdf}%
569 {\includegraphics[##1]
570 {\gmp@jobname\gmp@ext\csname gmp@fig##2\endcsname.pdf}}%
571 {\gmp@nemessage\gmp@box}}
572 }%
573 \def\rrincludemps{%
574 \long\def\gmp@innermpost##1\end##2{%
575 \ifgmp@nowrite\else
576 \gmp@write\gmp@out{%
577 ##1^^Jendfig;^^Jend.%
578 \gmp@doiflatex{^^Jverbatimtex^^J\string\end{document}^^Jetex}}%
579 \gmp@closeout\gmp@out
580 \count@=\gmp@runs
581 \loop\ifnum\count@>\z@
582 \gmp@shellcommand{\gmp@command\space
583 -tex=\gmp@mpxprogram\space\gmp@jobname\gmp@ext
584 \gmp@fourdigits{\gmp@number}}%
585 \advance\count@\m@ne
586 \repeat
587 \ifxetex
588 \gmp@shellcommand{epstopdf --hires \gmp@jobname\gmp@ext
589 \gmp@fourdigits{\gmp@number}.mps}%
590 \fi
591 \fi
592 \egroup
593 \end{##2}\ifgmp@use
594 \gmp@usempost{\thegmp@count}\fi}
595 \ifxetex
596 \def\gmp@usempost##1{%
597 \edef\gmp@thempsfile{\gmp@jobname\gmp@ext\gmp@fourdigits{##1}}%
598 \IfFileExists{\[email protected]}%
599 {\includegraphics{\[email protected]}}%
600 {\gmp@nemessage\gmp@box}}
601 \renewcommand\usempost[2][]{%
602 \IfFileExists{\gmp@jobname\gmp@ext\csname gmp@fig##2\endcsname.pdf}%
603 {\includegraphics[##1]
604 {\gmp@jobname\gmp@ext\csname gmp@fig##2\endcsname.pdf}}%
605 {\gmp@nemessage\gmp@box}}
606 \else
607 \def\gmp@usempost##1{%
608 \edef\gmp@thempsfile{\gmp@jobname\gmp@ext\gmp@fourdigits{##1}}%
609 \IfFileExists{\[email protected]}%
610 {\includegraphics[hiresbb]{\[email protected]}}%
611 {\gmp@nemessage\gmp@box}}
612 \renewcommand\usempost[2][]{%
613 \IfFileExists{\gmp@jobname\gmp@ext\csname gmp@fig##2\endcsname.mps}%
614 {\includegraphics[hiresbb,##1]
615 {\gmp@jobname\gmp@ext\csname gmp@fig##2\endcsname.mps}}%
616 {\gmp@nemessage\gmp@box}}
617 \fi
618 }%
619 % \end{macrocode}
620 % \end{document}