Debian Codegraph @

texmf-dist/doc/metapost/base/source-tutorial/compilation.tex

raw
1 \begin{figure*}[tp]
2 \centering
3 \includegraphics[width=\textwidth]{previewer}
4 \caption{\MP{} Previewer}
5 \label{fig:previewer}
6 \end{figure*}
7
8 \section{\MP{} compilation}
9 \label{sec:mpcompilation}
10
11 A typical \MP{} source file consists of one or more figures.
12 Compilation of the source file generates an \EPS{} graphic for each
13 figure. These \EPS{} graphics are self-contained (i.e., the fonts used
14 in labels are embedded into the graphic) provided that |prologues:=3| is
15 declared.
16
17 If \File{foo.mp} is a typical \MP{} source file, then its contents are
18 likely of the following form:
19
20 \begin{lstlisting}[style=MP]
21 prologues:=3;
22 outputtemplate:="%j-%c.mps";
23 beginfig(1);
24 |\normalfont\textit{draw commands}|
25 endfig;
26 beginfig(2);
27 |\normalfont\textit{draw commands}|
28 endfig;
29 |\dots|
30 beginfig(|\normalfont$n$|);
31 |\normalfont\textit{draw commands}|
32 endfig;
33 end
34 \end{lstlisting}
35
36 Executing
37
38 \begin{lstlisting}[style=text]
39 mpost foo.mp
40 \end{lstlisting}
41 yields the following output:
42
43 \begin{lstlisting}[style=text]
44 This is MetaPost, Version |\normalfont$\langle$\textit{version}$\rangle$|
45 (foo.mp [1] [2] |\normalfont\ldots| [|\normalfont$n$|] )
46 |\normalfont$n$| output files written: foo-1.mps .. foo-|\normalfont$n$|.mps
47 Transcript written on foo.log.
48 \end{lstlisting}
49
50 For users who just want to ``get started'' using \MP{}, a \MP{}
51 previewer is available at \url{http://www.tlhiv.org/mppreview}. This
52 previewer (illustrated in \autoref{fig:previewer}) is simply a graphical
53 interface to \MP{} itself. It generates a single graphic with the
54 option to save the output in \EPS{}, \PDF{}, and \SVG{} formats. Users
55 may also choose to save the source code and can view the compilation log
56 to assist in debugging.