diff options
author | Hans Hagen <pragma@wxs.nl> | 2006-11-16 12:02:00 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2006-11-16 12:02:00 +0100 |
commit | 2129e59b313d0a032b7b6eb3dab287dd32437ef9 (patch) | |
tree | 23b8818581484b897723bf6fb42a12a1b660afb6 /tex/generic | |
parent | f9c73d27ce69d59cfaeb543664e69c620642a0dc (diff) | |
download | context-2129e59b313d0a032b7b6eb3dab287dd32437ef9.tar.gz |
stable 2006.11.16 12:02
Diffstat (limited to 'tex/generic')
-rw-r--r-- | tex/generic/context/m-metapo.tex | 46 | ||||
-rw-r--r-- | tex/generic/context/mptopdf.tex | 141 |
2 files changed, 94 insertions, 93 deletions
diff --git a/tex/generic/context/m-metapo.tex b/tex/generic/context/m-metapo.tex index a71c91910..8680f69c6 100644 --- a/tex/generic/context/m-metapo.tex +++ b/tex/generic/context/m-metapo.tex @@ -1,71 +1,71 @@ %D \module %D [ file=m-metapo, %D version=1999.03.26, -%D title=\LATEX\ Modules, +%D title=\LATEX\ Modules, %D subtitle=\METAPOST\ Inclusion, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ distribution and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. -%D We quit when \CONTEXT\ is found and use some deep down +%D We quit when \CONTEXT\ is found and use some deep down %D macro to trigger this: -\ifx\undefined\dodoplaceexternalfigure \else \expandafter \endinput \fi +\ifx\undefined\dodoplaceexternalfigure \else \expandafter \endinput \fi -%D \macros +%D \macros %D {includeMPgraphics} %D %D This rather small \LATEX\ module is dedicated to David %D Arnold. It takes care of including the fonts used in %D \METAPOST\ graphics in the file. This hack is needed when %D one uses another \DVI\ driver than \DVIPS. This module -%D falls back on the generic \CONTEXT\ support module: +%D falls back on the generic \CONTEXT\ support module: -\ifx\undefined\includeMPfonts \input supp-mps.tex \relax \fi +\ifx\undefined\includeMPfonts \input supp-mps.tex \relax \fi %D Instead of using \type {\includegraphics}, one should use its -%D little brother \type {\includeMPgraphics}. This macro takes -%D the same arguments. +%D little brother \type {\includeMPgraphics}. This macro takes +%D the same arguments. \def\includeMPgraphics#1#% {\leavevmode\vbox\bgroup\hbox\bgroup \def\includeMPgraphics##1% {\includeMPfonts{##1}% - \includegraphics#1{##1}% + \includegraphics#1{##1}% \egroup\egroup}% \includeMPgraphics} -%D An example of using this module is given below: -%D +%D An example of using this module is given below: +%D %D \starttyping %D \documentclass[10pt]{article} -%D +%D %D \usepackage{graphicx} %D \usepackage{m-metapo} -%D +%D %D \begin{document} %D \includeMPgraphics{somefile.1} %D \includeMPgraphics[angle=90]{somefile.2} %D \end{document} %D \stoptyping %D -%D This module needs \type {supp-mps} and \type {supp-mis}, +%D This module needs \type {supp-mps} and \type {supp-mis}, %D that both are present in the \CONTEXT\ path. %D -%D Please do not forget to say \type {prologues:=2} at the +%D Please do not forget to say \type {prologues:=1} at the %D top of the metapost file! -%D -%D For non \LATEX\ (and \CONTEXT) users we provide an -%D alternative inclusion macro. This one has no optional -%D arguments. +%D +%D For non \LATEX\ (and \CONTEXT) users we provide an +%D alternative inclusion macro. This one has no optional +%D arguments. \ifx\includegraphics\undefined - \ifx\undefined\dogetEPSboundingbox \input supp-eps.tex \relax \fi + \ifx\undefined\dogetEPSboundingbox \input supp-eps.tex \relax \fi \def\includeMPgraphics#1% {\hbox\bgroup @@ -86,4 +86,4 @@ \fi -\endinput +\endinput diff --git a/tex/generic/context/mptopdf.tex b/tex/generic/context/mptopdf.tex index 97f2890a6..84a8aa380 100644 --- a/tex/generic/context/mptopdf.tex +++ b/tex/generic/context/mptopdf.tex @@ -2,103 +2,104 @@ %D [ file=mptopdf, %D version=2000.03.27, %D title=\METAPOST, -%D subtitle=conversion to \PDF, +%D subtitle=conversion to \PDF, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. -%D The file \type {mptopdf} provides a quick way to convert -%D \METAPOST\ files to \PDF\ using a slightly stripped down -%D plain \TEX, \PDFTEX, and a few \CONTEXT\ modules. +%D The file \type {mptopdf} provides a quick way to convert +%D \METAPOST\ files to \PDF\ using a slightly stripped down +%D plain \TEX, \PDFTEX, and a few \CONTEXT\ modules. %D %D First generate a format, which in \WEBC\ looks like: %D -%D \starttyping -%D pdftex --ini mptopdf -%D \stoptyping +%D \starttyping +%D pdftex --ini mptopdf +%D \stoptyping %D -%D or: +%D or: %D -%D \starttyping -%D texexec --make --tex=pdftex --format=mptopdf --alone -%D \stoptyping +%D \starttyping +%D texexec --make --tex=pdftex --format=mptopdf --alone +%D \stoptyping %D -%D Since this conversion only works with \PDFTEX\ or \PDFETEX, -%D the session is aborted when another \TEX\ is used. When -%D finished, the resulting \type {fmt} file should be moved to -%D the right location. +%D Since this conversion only works with \PDFTEX\ or \PDFETEX, +%D the session is aborted when another \TEX\ is used. When +%D finished, the resulting \type {fmt} file should be moved to +%D the right location. %D -%D The conversion itself is accomplished by: +%D The conversion itself is accomplished by: +%D +%D \starttyping +%D pdftex &mptopdf \relax filename.number +%D \stoptyping %D -%D \starttyping -%D pdftex &mptopdf \relax filename.number -%D \stoptyping -%D %D The \type {\relax} is needed since we don't want to process %D the file directly. Instead we pick up the filename using %D \type {\everypar}. Since this file is still the first one %D we load, although delayed, the jobname is as we expect. So, %D at least in \WEBC, the result of the conversion comes %D available in the file \type {filename.pdf}. This conversion -%D process is roughly compatible with: +%D process is roughly compatible with: %D -%D \starttyping +%D \starttyping %D texexec --pdf --fig=c --result=filename filename.number -%D \stoptyping +%D \stoptyping %D -%D This uses \CONTEXT, and is therefore slower. Therefore, -%D we provide a small \PERL\ script that does a faster job, -%D using the minimal format. Given that a format is -%D generated, one can say: +%D This uses \CONTEXT, and is therefore slower. Therefore, +%D we provide a small \PERL\ script that does a faster job, +%D using the minimal format. Given that a format is +%D generated, one can say: %D -%D \starttyping -%D mptopdf somefile +%D \starttyping +%D mptopdf somefile %D mptopdf somefile.123 -%D mptopdf mp*.* -%D \stoptyping -%D -%D The results are copied into files named \type -%D {somefile-number}. This mechanism will also be available +%D mptopdf mp*.* +%D \stoptyping +%D +%D The results are copied into files named \type +%D {somefile-number}. This mechanism will also be available %D in a next release of \TEXUTIL. -%D The \TEX\ implementation is rather simple, since we use some +%D The \TEX\ implementation is rather simple, since we use some %D generic \CONTEXT\ modules. Because we need a few register -%D allocation macros, we preload plain \TEX. We don't load -%D fonts yet. +%D allocation macros, we preload plain \TEX. We don't load +%D fonts yet. \input syst-tex -%D We check for the usage of \PDFTEX, and quit if another -%D \TEX\ is used. +%D We check for the usage of \PDFTEX, and quit if another +%D \TEX\ is used. -\ifx\pdfoutput\undefined - \message{Sorry, you should use pdf(e)TeX instead.} - \expandafter \endinput +\ifx\pdfoutput\undefined + \message{Sorry, you should use pdf(e)TeX instead.} + \expandafter \endinput \fi -%D The conversion to \PDF\ is carried out by macros, that -%D are collected in the file: +%D The conversion to \PDF\ is carried out by macros, that +%D are collected in the file: -\input supp-pdf +\input supp-mis +\input supp-pdf \input supp-mpe \MPcmykcolorstrue \MPspotcolorstrue -%D We use no output routine. +%D We use no output routine. -\output{} +\output{} -%D Since we need to calculate and set the bounding box, +%D Since we need to calculate and set the bounding box, %D we definitely don't want to indent paragraphs. -\parindent=0pt +\parindent=0pt %D We use \type {\everypar} to pick up the filename and -%D process the \METAPOST\ graphic. +%D process the \METAPOST\ graphic. -\everypar{\processMPfile} +\everypar{\processMPfile} %D The main macro shows a few \PDFTEX\ primitives. The main %D work is done by the macro \type {\convertMPtoPDF} which is @@ -107,39 +108,39 @@ %D learn a few (\PDF) tricks. Apart from some path %D transformations, which are needed since \PDF\ has a %D different vision on paths, the graphic is positioned in -%D such a way that accuracy in \PDF\ xforms is guaranteed. +%D such a way that accuracy in \PDF\ xforms is guaranteed. \def\processMPfile#1 % - {\pdfoutput=1 + {\pdfoutput=1 \pdfcompresslevel=9 \chardef\makeMPintoPDFobject=1 \hsize=100in \vsize=\hsize - \hoffset=-1in + \hoffset=-1in \voffset=\hoffset \topskip=0pt \setbox0=\vbox{\convertMPtoPDF{#1}{1}{1}}% - \ifdim\wd0<1in \message{[warning: width<1in]}\fi - \ifdim\ht0<1in \message{[warning: height<1in]}\fi - \pdfpageheight=\ht0 - \pdfpagewidth=\wd0 + \ifdim\wd0<1in \message{[warning: the width is less than 1in]}\fi + \ifdim\ht0<1in \message{[warning: the height is less than 1in]}\fi + \pdfpageheight=\ht0 + \pdfpagewidth=\wd0 \box0 \bye} -%D The \type {\chardef} forces the converter to build a so +%D The \type {\chardef} forces the converter to build a so %D called xform object. This is needed in case the graphic -%D uses special trickery, like shading. +%D uses special trickery, like shading. -%D Since \ACROBAT\ has troubles with figures smaller than -%D 1~inch, we issue a warning. When embedding graphics in -%D documents, a size less that 1~inch does not harm. In -%D order to overload runtime directives in the \PDFTEX\ -%D configuration file, we set the offsets and output method +%D Since \ACROBAT\ has troubles with figures smaller than +%D 1~inch, we issue a warning. When embedding graphics in +%D documents, a size less that 1~inch does not harm. In +%D order to overload runtime directives in the \PDFTEX\ +%D configuration file, we set the offsets and output method %D in the macro. -%D +%D %D The resulting \PDF\ file is about as efficient as such a %D self contained file can be. However, if needed, this \PDF\ -%D file can be converted to \EPS\ using for instance the -%D \PDFTOPS\ program (in \WEBC) or \GHOSTSCRIPT. +%D file can be converted to \EPS\ using for instance the +%D \PDFTOPS\ program (in \WEBC) or \GHOSTSCRIPT. \dump |