1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
|
% \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}
|