summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-mpprologues.html
blob: 848e69324462edc840c3ebbddbd5879c52b55173 (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 &lsquo;standard&rsquo; Metafont fonts (that you&rsquo;ve specified) are already
defined &mdash; for example, as a figure in TeX document.  If you&rsquo;re
debugging your MetaPost code, you may want to view it in
<i>ghostscript</i> (or some other PostScript previewer).  However,
the PostScript &lsquo;engine&rsquo; in <i>ghostscript</i> <em>doesn&rsquo;t</em>
ordinarily have the fonts loaded, and you&rsquo;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&rsquo;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&rsquo;re suffering such problems (the symptom is that
characters disappear, or are wrongly presented) the only solution is
to view the &lsquo;original&rsquo; 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&rsquo;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&rsquo;s, by
Dan Luecking.  Dan&rsquo;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...
<dl>
<dt><tt><i>mps2eps</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/support/mps2eps.zip">support/mps2eps</a> (<a href="ftp://cam.ctan.org/tex-archive/support/mps2eps.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/support/mps2eps/">browse</a>)
<dt><tt><i>mpsproof.tex</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/graphics/metapost/contrib/misc/mpsproof.tex">graphics/metapost/contrib/misc/mpsproof.tex</a>
<dt><tt><i>mptopdf</i></tt><dd>Part of <a href="ftp://cam.ctan.org/tex-archive/macros/pdftex/graphics.zip">macros/pdftex/graphics</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/pdftex/graphics.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/pdftex/graphics/">browse</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>