1

I have a MetaPost file which gives an output as EPS. When I convert the EPS file to a PDF, the resolution is very poor. Does any one know how to fix this?

Here is the code of the file:

prologues:=3;
outputtemplate:="%j.eps";
verbatimtex
%&latex
  \documentclass{article}
  \usepackage{times}
  \begin{document}
etex
  beginfig(0);
  drawarrow (0,0)--(10cm,0);
  drawarrow (0,0)--(0,10cm);
  label.lrt(btex\small$y$ etex, (0cm,6.4cm));
  label.lrt(btex\small$x$ etex, (8.4cm,0cm)); 
    pair A, B, C;
    A:=(0,0); C:=(4cm,3cm);
    draw A--C;
draw (4cm,3cm) .. (6cm,3.6cm) .. (8cm,3.62cm);
  drawarrow (2cm, 0cm)--(2cm,1cm);
  drawarrow (4cm, 0cm)--(4cm,1cm);
  label.lrt(btex\tiny$x^{m}$ etex, (0.2cm,2.2cm));
  label.lrt(btex\tiny$const-R^{-n}$ etex, (4.6cm,4.4cm));
  label.lrt(btex\tiny$\Delta_{1}$ etex, (2cm,0.2cm));
  label.lrt(btex\tiny$\Delta_{2}$ etex, (4cm,0.2cm));
  label.lrt(btex\tiny$\Delta v$ etex, (6cm,0.2cm));
drawarrow (6cm, 0cm)--(6cm,1cm);
endfig;
end
  • Welcome to TeX.SX! How do you do the conversion to PDF? – egreg Aug 9 '16 at 10:08
  • through some website. – titanium Aug 9 '16 at 10:11
  • What operating system and TeX distribution are you running? Do you need the PDF for inclusion in a LaTeX document? – egreg Aug 9 '16 at 10:15
  • I am using Mac. Yes, I need pdf for inclusion in LaTex document. – titanium Aug 9 '16 at 10:55
  • You are aware that metapost output can be included directly in latex? Both standard latex and pdflatex, no need for any conversion – daleif Aug 9 '16 at 12:14
1

You don't need to convert to PDF via unknown software. It's very easy if you know how to use the Terminal.

Change the outputtemplate line into

outputtemplate:="%j.mps";

and also \usepackage{times} into

\usepackage{mathptmx}

if you want Times also for math symbols.

If you run the command line mpost titanium (assuming titanium.mp) is the file name, you can then include directly it in a LaTeX file by doing

\documentclass{article}
\usepackage{graphicx}

\begin{document}

\includegraphics{titanium}

\end{document}

enter image description here

If you want to obtain a PDF file from the MetaPost file, remove the outputtemplate line and run the command line

mptopdf titanium.mp

that will produce a file named titanium-0.pdf, which you can rename to your likings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.