# [tex-live] What is the right way to include eps in latex for pdf generating?

Stephan Hennig sh-list at posteo.net
Mon Nov 10 18:51:19 CET 2014

```Am 10.11.2014 um 14:52 schrieb Askar Safin:
>> Because .eps is not a supported extension for use with pdflatex.
> OK, thanks.
>> In standard LaTeX you have the same thing, *everything* is assumed to be EPS no matter the extension.
> So, what is the right way to include mpost in latex for pdf generating? X_X
> At the moment I see the two right ways:
> 1. The way I used before
> .mp: outputtemplate:="%j.%c"; (default)
> .tex: \usepackage{graphicx}
> .tex: \includegraphics{file.1}
> shell: mpost file.mp
> shell: latex file.tex
> shell: dvipdfm file.dvi
> 2. The way from http://math.berkeley.edu/~vojta/tex/samp-l/mpost.html
> .mp: outputtemplate:="%j%c.mps";
> .tex: \usepackage{graphicx}
> .tex: \includegraphics{file1.mps} (or \includegraphics{file1})
> shell: mpost file.mp
> shell: pdflatex file.tex
>
> Both work. But what of them are the right way? The first one is
> better because it uses standard "latex", which generates .dvi (device
> independent file), which is supposed to be converted to other formats
> (this is original Knuth's intention). The second one is better
> because it generates pdf directly from tex.

The second variant is recommended in the MetaPost manual, because it
works with both formats, LaTeX as well as pdfLaTeX, when giving full
file name to \includegraphics, i.e., \includegraphics{file1.mps}.  With
pdfLaTeX, .mps is a known file extension, triggering on-the-fly PDF
conversion.  With LaTeX, .mps is an unknown file extension, triggering
.eps file inclusion.

What is the best for distributing works and publishing them in the internet?

Recent versions of MetaPost can also generate SVG (since v1.200) and PNG
output (since v1.800).  The MetaPost manual contains example code for
embedding such files into HTML.

Best regards,
Stephan Hennig

```