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
|
% This is a modification of mproof.tex (as found on CTAN in
% /systems/knuth/local/lib). The name was changed to mpsproof.tex
% to honor the license restrictions.
%
%%%% These are the comments of the original mproof.tex:
%% To produce proof sheets from MetaPost output (includes date and time):
%% tex mproof <MetaPost output file names>
%%%%
%
% In contrast, mpsproof allows either pdftex or ordinary tex to be used:
%
% [pdf]tex mpsproof [\noheaders] <mpost output file names>
%
% Examples: pdftex mpsproof figur.1 figur.2
% tex mpsproof \noheaders figur.1 figur.2 figur.3
%
% With \noheaders, the filenames, datestamp and page numbers are omitted.
% Using mpsproof one can also produce encapsulated output:
%
% [pdf]tex mpsproof \encapsulate <one_mpost_output_file_name>
%
% Examples: pdftex mpsproof \encapsulate figur.1
% tex mpsproof \encapsulate figur.3
%
% "Encapsulated" means that the pdf output (or the .ps resulting from
% dvips mpsproof.dvi), has the same "bounding box" as the MetaPost figure.
% Actually, it produces a file whose *page size* is the same as that
% bounding box.
%
% If pdftex is used and \pdfoutput = 1, the result will be a pdf file,
% otherwise the result is a dvi file containing dvips graphics \specials.
%
% Limitations: the production of pdf requires supp-pdf.tex and the
% macros therein use up TeX's memory. The specific portion that is used
% is the "save_size". A lot of short paths is no problem, but a single
% long path might exceed the limits on your system. On most systems the
% limit can be increased by editing texmf.cnf.
%
% Placed in the public domain by Daniel H. Luecking.
%
% Change HISTORY:
% 2003/04/08 -- Original release
% 2004/05/02 -- Allow "_" in filenames.
% 2004/05/07 -- Added the \noheaders option.
% 2005/10/07 -- sanitize the filename (\meaning)
% 2006/04/06 -- encapsulation added
% 2006/06/30 -- Better documentation (the above comments)
% 2008/11/11 -- make dvi output identical to mproof.tex
%
% Test for pdf:
\newif\ifpdf
\pdffalse
\ifx\pdfoutput\undefined
\else\ifx\pdfoutput\relax
\else\ifnum\pdfoutput<1
\else \pdftrue
\fi\fi\fi
% Graphic inclusion macros:
\ifpdf
\input supp-pdf
\def\includemps#1{\convertMPtoPDF{#1}{1}{1}}
\def\MPSpresets{\pdfoutput=1 \pdfcompresslevel=9
\chardef\makeMPintoPDFobject=1\relax}
\def\encapspecial{\pdfpageheight=\ht0 \pdfpagewidth=\wd0}
\else
\input epsf
\def\includemps#1{\epsfverbosetrue\epsfbox{#1}}
\def\MPSpresets{}
\def\encapspecial{\special{papersize=\the\wd0,\the\ht0}}
\fi
\let\EA\expandafter
\def\EAEAEA{\EA\EA\EA}
\def\processMPfile{%
\MPSpresets \hsize=100in \vsize=\hsize
\hoffset=-1in \voffset=\hoffset \topskip=0pt
\setbox0=\vbox{\hbox{\EA\includemps\EA{\theMPfile}}}%
\ifdim\wd0<1in \message{[warning: width<1in]}\fi
\ifdim\ht0<1in \message{[warning: height<1in]}\fi
\encapspecial \box0 \end}
% To omit printing of files name, page numbers and date stamp:
\newif\ifheaders\headerstrue
\def\noheaders{\headersfalse}
% produce output with same bounding box:
\newif\ifencapsulate
\def\encapsulate{\noheaders\encapsulatetrue}
\def\maybeprint#1{\ifheaders#1\fi}
\def\stripprefix#1>{}
\font\textt=cmtex10 \textt
\def\okbreak{\vfil\penalty2000\vfilneg}
\def\today{\ifcase\month\or
January\or February\or March\or April\or May\or June\or
July\or August\or September\or October\or November\or December\fi
\space\number\day, \number\year}
\newcount\m \newcount\n
\n=\time \divide\n 60 \m=-\n \multiply\m 60 \advance\m \time
\def\hours{\twodigits\n\twodigits\m}
\def\twodigits#1{\ifnum #1<10 0\fi \number#1}
\footline={\ifheaders\sevenrm\today\ at \hours\hss\tenrm\folio\hss\fi}
% DHL - \convertMPtoPDF redefines \\, so we replace it with \?.
\def\endit{\?}
\def\munch#1 {\def\theMPfile{#1}%
\ifx\theMPfile\endit
\EA\endit
\else
% sanitize the filename:
\edef\theMPfile{\EA\stripprefix\meaning\theMPfile}%
\ifencapsulate \EAEAEA\processMPfile
\else \leavevmode\maybeprint\theMPfile
$$\EA\includemps\EA{\theMPfile}$$\par\okbreak%
\fi
\fi\munch}
\def\?{\let\munch=\relax\def\?{}}
% Encapsulation requires no indentation.
\everypar{{\ifencapsulate\setbox0=\lastbox\fi}\everypar{}\relax\munchline}
% We need the space before \? to ensure that it doesn't end up
% in a filename.
\obeylines\def\munchline#1
{\catcode`\^^M=5 \munch#1 \? \vfill\end}%
|