summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-mpprologues.html
blob: 5c5e71bb957093918f5a991cd13fb4771cda7a76 (plain)
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
<head>
<title>UK TeX FAQ -- question label mpprologues</title>
</head><body>
<h3>Displaying MetaPost output in <i>ghostscript</i></h3>
<p/>MetaPost ordinarily expects its output to be included in some context
where the &#8216;standard&#8217; Metafont fonts (that you&#8217;ve specified) are already
defined &#8212; for example, as a figure in TeX document.  If you&#8217;re
debugging your MetaPost code, you may want to view it in
<i>ghostscript</i> (or some other PostScript previewer).  However,
the PostScript &#8216;engine&#8217; in <i>ghostscript</i> <em>doesn&#8217;t</em>
ordinarily have the fonts loaded, and you&#8217;ll experience an error such
as
<blockquote>
<pre>
Error: /undefined in cmmi10
</pre>
</blockquote><p>
There is provision in MetaPost for avoiding this problem: issue the
command <code>prologues := 2;</code> at the start of the <code>.mp</code> file.
<p/>Unfortunately, the PostScript that MetaPost inserts in its output,
following this command, is incompatible with ordinary use of the
PostScript in inclusions into (La)TeX documents, so it&#8217;s best to
make the <code>prologues</code> command optional.  Furthermore, MetaPost takes a
very simple-minded approach to font encoding: since TeX font
encodings regularly confuse sophisticated minds, this can prove
troublesome.  If you&#8217;re suffering such problems (the symptom is that
characters disappear, or are wrongly presented) the only solution is
to view the &#8216;original&#8217; MetaPost output after processing through
LaTeX and <i>dvips</i>.
<p/>Conditional compilation may be done either
by inputting <i>MyFigure.mp</i> indirectly from a simple wrapper
<i>MyFigureDisplay.mp</i>:
<blockquote>
<pre>
prologues := 2;
input MyFigure
</pre>
</blockquote><p>
or by issuing a shell command such as
<blockquote>
<pre>
mp '\prologues:=2; input MyFigure'
</pre>
</blockquote><p>
(which will work without the quote marks if you&#8217;re not using a Unix
shell).
<p/>A suitable LaTeX route would involve processing
<i>MyFigure.tex</i>, which contains:
<blockquote>
<pre>
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\thispagestyle{empty}
\includegraphics{MyFigure.1}
\end{document}
</pre>
</blockquote><p>
Processing the resulting DVI file with the <i>dvips</i>
command
<blockquote>
<pre>
dvips -E -o MyFigure.eps MyFigure
</pre>
</blockquote><p>
would then give a satisfactory Encapsulated PostScript file.  This
procedure may be automated using the <i>Perl</i> script
<i>mps2eps</i>, thus saving a certain amount of tedium.
<p/>The Plain TeX user may use an adaptation of a jiffy of Knuth&#8217;s, by
Dan Luecking.  Dan&#8217;s version <i>mpsproof.tex</i> will work under
TeX to produce a DVI file for use with <i>dvips</i>, or
under PDFTeX to produce a PDF file, direct.  The output is
set up to look like a proof sheet.
<p/>A script application, <i>mptopdf</i>, is available in recent
(La)TeX distributions: it seems fairly reliably to produce
PDF from MetaPost, so may reasonably be considered an answer to
the question&#8230;
<dl>
<dt><tt><i>mps2eps</i></tt><dd><a href="http://mirror.ctan.org/support/mps2eps.zip">support/mps2eps</a> (or <a href="http://mirror.ctan.org/support/mps2eps/">browse the directory</a>)
<dt><tt><i>mpsproof.tex</i></tt><dd><a href="http://mirror.ctan.org/graphics/metapost/contrib/misc/mpsproof.tex">graphics/metapost/contrib/misc/mpsproof.tex</a>; <a href="http://mirror.ctan.org//help/Catalogue/entries/mpsproof.html">catalogue entry</a>
<dt><tt><i>mptopdf</i></tt><dd>Part of <a href="http://mirror.ctan.org/graphics/metapost/contrib/tools/mptopdf.zip">graphics/metapost/contrib/tools/mptopdf</a> (or <a href="http://mirror.ctan.org/graphics/metapost/contrib/tools/mptopdf/">browse the directory</a>); <a href="http://mirror.ctan.org/help/Catalogue/entries/pdf-mps-supp.html">catalogue entry</a>
</dl>
<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=mpprologues">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=mpprologues</a>
</body>