summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/metapost/mpsproof.tex
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2009-05-27 13:45:19 +0000
committerTaco Hoekwater <taco@elvenkind.com>2009-05-27 13:45:19 +0000
commita6de62371f5f16b69c8acb1302df944de36db154 (patch)
tree945c77ea0b229d83db080d0eff034fc5ae8b4ecf /Master/texmf-dist/tex/generic/metapost/mpsproof.tex
parenta26d67f7f3f19cd6cbc3d16a94bc75a4513f09df (diff)
move the metapost proof files from misc/ to metapost/
git-svn-id: svn://tug.org/texlive/trunk@13494 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/metapost/mpsproof.tex')
-rw-r--r--Master/texmf-dist/tex/generic/metapost/mpsproof.tex131
1 files changed, 131 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/metapost/mpsproof.tex b/Master/texmf-dist/tex/generic/metapost/mpsproof.tex
new file mode 100644
index 00000000000..1c3e0923939
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/metapost/mpsproof.tex
@@ -0,0 +1,131 @@
+% 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)
+%
+% 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{\hbox{\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{\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\?{}}
+
+\everypar{\everypar{}\relax\munchline}
+
+\parindent 0pt
+% 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}%