| 1 |
% This is a modification of mproof.tex (as found on CTAN in |
| 2 |
% /systems/knuth/local/lib). The name was changed to mpsproof.tex |
| 3 |
% to honor the license restrictions. |
| 4 |
% |
| 5 |
%%%% These are the comments of the original mproof.tex: |
| 6 |
%% To produce proof sheets from MetaPost output (includes date and time): |
| 7 |
%% tex mproof <MetaPost output file names> |
| 8 |
%%%% |
| 9 |
% |
| 10 |
% In contrast, mpsproof allows either pdftex or ordinary tex to be used: |
| 11 |
% |
| 12 |
% [pdf]tex mpsproof [\noheaders] <mpost output file names> |
| 13 |
% |
| 14 |
% Examples: pdftex mpsproof figur.1 figur.2 |
| 15 |
% tex mpsproof \noheaders figur.1 figur.2 figur.3 |
| 16 |
% |
| 17 |
% With \noheaders, the filenames, datestamp and page numbers are omitted. |
| 18 |
% Using mpsproof one can also produce encapsulated output: |
| 19 |
% |
| 20 |
% [pdf]tex mpsproof \encapsulate <one_mpost_output_file_name> |
| 21 |
% |
| 22 |
% Examples: pdftex mpsproof \encapsulate figur.1 |
| 23 |
% tex mpsproof \encapsulate figur.3 |
| 24 |
% |
| 25 |
% "Encapsulated" means that the pdf output (or the .ps resulting from |
| 26 |
% dvips mpsproof.dvi), has the same "bounding box" as the MetaPost figure. |
| 27 |
% Actually, it produces a file whose *page size* is the same as that |
| 28 |
% bounding box. The shorthand \bbox can be used in place of |
| 29 |
% \encapsulate. |
| 30 |
% |
| 31 |
% If pdftex is used and \pdfoutput = 1, the result will be a pdf file, |
| 32 |
% otherwise the result is a dvi file containing dvips graphics \specials. |
| 33 |
% |
| 34 |
% Limitations: the production of pdf requires supp-pdf.tex and the |
| 35 |
% macros therein use up TeX's memory. The specific portion that is used |
| 36 |
% is the "save_size". A lot of short paths is no problem, but a single |
| 37 |
% long path might exceed the limits on your system. On most systems the |
| 38 |
% limit can be increased by editing texmf.cnf. |
| 39 |
% |
| 40 |
% Placed in the public domain by Daniel H. Luecking. |
| 41 |
% |
| 42 |
% Change HISTORY: |
| 43 |
% 2003/04/08 -- Original release |
| 44 |
% 2004/05/02 -- Allow "_" in filenames. |
| 45 |
% 2004/05/07 -- Added the \noheaders option. |
| 46 |
% 2005/10/07 -- Sanitize the filename (\meaning) |
| 47 |
% 2006/04/06 -- Encapsulation added |
| 48 |
% 2006/06/30 -- Better documentation (the above comments) |
| 49 |
% 2008/11/11 -- Make dvi output identical to mproof.tex |
| 50 |
% 2010/10/13 -- Added \bbox (short for \encapsulate) |
| 51 |
% |
| 52 |
% Test for pdf: |
| 53 |
\newif\ifpdf |
| 54 |
\pdffalse |
| 55 |
\ifx\pdfoutput\undefined |
| 56 |
\else\ifx\pdfoutput\relax |
| 57 |
\else\ifnum\pdfoutput<1 |
| 58 |
\else \pdftrue |
| 59 |
\fi\fi\fi |
| 60 |
|
| 61 |
% Graphic inclusion macros: |
| 62 |
\ifpdf |
| 63 |
\input supp-pdf.mkii |
| 64 |
\def\includemps#1{\convertMPtoPDF{#1}{1}{1}} |
| 65 |
\def\MPSpresets{\pdfoutput=1 \pdfcompresslevel=9 |
| 66 |
\chardef\makeMPintoPDFobject=1\relax} |
| 67 |
\def\encapspecial{\pdfpageheight=\ht0 \pdfpagewidth=\wd0} |
| 68 |
\else |
| 69 |
\input epsf |
| 70 |
\def\includemps#1{\epsfverbosetrue\epsfbox{#1}} |
| 71 |
\def\MPSpresets{} |
| 72 |
\def\encapspecial{\special{papersize=\the\wd0,\the\ht0}} |
| 73 |
\fi |
| 74 |
|
| 75 |
\let\EA\expandafter |
| 76 |
\def\EAEAEA{\EA\EA\EA} |
| 77 |
|
| 78 |
\def\processMPfile{% |
| 79 |
\MPSpresets \hsize=100in \vsize=\hsize |
| 80 |
\hoffset=-1in \voffset=\hoffset \topskip=0pt |
| 81 |
\setbox0=\vbox{\hbox{\EA\includemps\EA{\theMPfile}}}% |
| 82 |
\ifdim\wd0<1in \message{[warning: width<1in]}\fi |
| 83 |
\ifdim\ht0<1in \message{[warning: height<1in]}\fi |
| 84 |
\encapspecial \box0 \end} |
| 85 |
|
| 86 |
% To omit printing of files name, page numbers and date stamp: |
| 87 |
\newif\ifheaders\headerstrue |
| 88 |
\def\noheaders{\headersfalse} |
| 89 |
|
| 90 |
% produce output with same bounding box: |
| 91 |
\newif\ifencapsulate |
| 92 |
\def\encapsulate{\noheaders\encapsulatetrue} |
| 93 |
\let\bbox\encapsulate |
| 94 |
|
| 95 |
\def\maybeprint#1{\ifheaders#1\fi} |
| 96 |
\def\stripprefix#1>{} |
| 97 |
|
| 98 |
\font\textt=cmtex10 \textt |
| 99 |
\def\okbreak{\vfil\penalty2000\vfilneg} |
| 100 |
|
| 101 |
\def\today{\ifcase\month\or |
| 102 |
January\or February\or March\or April\or May\or June\or |
| 103 |
July\or August\or September\or October\or November\or December\fi |
| 104 |
\space\number\day, \number\year} |
| 105 |
\newcount\m \newcount\n |
| 106 |
\n=\time \divide\n 60 \m=-\n \multiply\m 60 \advance\m \time |
| 107 |
\def\hours{\twodigits\n\twodigits\m} |
| 108 |
\def\twodigits#1{\ifnum #1<10 0\fi \number#1} |
| 109 |
|
| 110 |
\footline={\ifheaders\sevenrm\today\ at \hours\hss\tenrm\folio\hss\fi} |
| 111 |
|
| 112 |
% DHL - \convertMPtoPDF redefines \\, so we replace it with \?. |
| 113 |
\def\endit{\?} |
| 114 |
|
| 115 |
\def\munch#1 {\def\theMPfile{#1}% |
| 116 |
\ifx\theMPfile\endit |
| 117 |
\EA\endit |
| 118 |
\else |
| 119 |
% sanitize the filename: |
| 120 |
\edef\theMPfile{\EA\stripprefix\meaning\theMPfile}% |
| 121 |
\ifencapsulate \EAEAEA\processMPfile |
| 122 |
\else \leavevmode\maybeprint\theMPfile |
| 123 |
$$\EA\includemps\EA{\theMPfile}$$\par\okbreak% |
| 124 |
\fi |
| 125 |
\fi\munch} |
| 126 |
|
| 127 |
\def\?{\let\munch=\relax\def\?{}} |
| 128 |
|
| 129 |
% Encapsulation requires no indentation. |
| 130 |
\everypar{{\ifencapsulate\setbox0=\lastbox\fi}\everypar{}\relax\munchline} |
| 131 |
|
| 132 |
% We need the space before \? to ensure that it doesn't end up |
| 133 |
% in a filename. |
| 134 |
\obeylines\def\munchline#1 |
| 135 |
{\catcode`\^^M=5 \munch#1 \? \vfill\end}% |