[Tex/LaTex] mpgraphics: Unable to compile using MikTex on Windows

epstopdfmetapostmiktex

This is an example from mpgraphics package documentation:

\documentclass{article}
\usepackage{mpgraphics}
\begin{document}
\begin{mpinline}
draw (20,20)--(0,0)--(0,30)--(30,0)--(0,0)
\end{mpinline}
\end{document}

I am getting something like this:
enter image description here

I'm using:
– mpost version 1.504 (MiKTeX 2.9)
– pdfTeX, Version 3.1415926-2.3-1.40.12 (MiKTeX 2.9)
– MiKTeX EPS-to-PDF Converter 2.9.3275 (MiKTeX 2.9)

I compile using wrige using TexMaker and compile by means of:
latexmk -e "$pdflatex=q/pdflatex -synctex=1 -shell-escape -interaction=nonstopmode/" -pdf %.tex

or

pdflatex -interaction=nonstopmode -synctex=1 -shell-escape %.tex
(result is the same)

What am I doing wrong?

You can find the log file here. Example compiled by: pdflatex -interaction=nonstopmode -enable-write18 -synctex=1 -shell-escape %.tex

Resulting pdf: link

EDIT:
I tried to compile it by a command line. This is what I got:
The whole folder with source and logs

Best Answer

As I said in a previous comment, your example compiled without problem in my OSX box, so I was guessing the problem was in your Windows setup.

Looking carefully at your _COMMAND_LINE_.txt file, I noticed the following, in line 72:

Preloading the plain mem file, version 1.004))epstopdf: -o: unknown option

Note the error at the end of the line. Your epstopdf program is refusing -o option, and thus it is not producing the pdf output. mpgraphics package issues a Warning, which somehow, instead of appearing in the standard output or in the .log file, appears in the final pdf. This is why your documment contains the strange text mpgrahphics******** etc. (this could be considered a bug in mpgraphics implementation.)

Nevertheless, the problem is with your epstopdf program. mpgraphics package recommends a "recent" version of epstopdf. I don't know if the problem is that your epstopdf version is not recent enough or whether epstopdf is broken in Windows.

You can try to execute epstopdf --help in command line and learn which switch it uses instead of -o (which is for setting the name of the resulting pdf). Once you know this, you can hack the file mpgraphics.sty (search for the string -o in that file, in my version is at line 77), and change it appropiately.