I am using Metapost software 18.0.1. I have created some plots. How should I export them that I can easily import all plots in Latex?

| improve this question | | | | |
  • 1
    Does MetaPost really have such a high version number? You can use something like outputtemplate := "figure%c.mps"; at the beginning of your MetaPost file (.mp extension), then \includegraphics{figure1}, \includegraphics{figure2} etc. in your .tex files. You may also use the job name %j in outputtemplate if you don't want a hardcoded stem such as figure in the generate files (see Customizing Run-Time Behavior in the MetaPost manual). – frougon Aug 2 '19 at 11:27

This is a difficult question to answer correctly, because there are several equally good ways to use MetaPost output with TeX. This means my answer is largely my own opinion, which might fall outside the normal guidelines for this site. You might want to read this guidance: https://tex.stackexchange.com/help/dont-ask

Nevertheless, just in case it is helpful to you and other new users of MetaPost, here is a description of my work flow for plain MetaPost. I work on a mac os system, and I use MacVim to edit MP source, and Skim.app to view the output files (.EPS and/or .PDF). I have the whole of MacTex installed locally.

I use this template file:

prologues := 3;
outputtemplate := "%j%c.eps";


The first two lines are important: prologues := 3; makes MP put the full font details in the output so that the files are self-contained; the outputtemplate line means that the output will be written to files with an extension of .eps (suggesting that they are Encapsulated PostScript).

I then add drawing and label commands, etc, and I compile the source with mpost. Usually I need several attempts to get a diagram right, so I open Skim to preview the output with open -a Skim xxxxx.eps. I have Skim set up so that when I recompile the source, it automatically updates the view of the PostScript output.

enter image description here

If I want to use the diagram in a LaTeX document I can include the EPS file directly with


but usually I prefer to convert the EPS to PDF using epstopdf rather than rely on the automatic conversion. This is mainly because the PDFs are generally more useful files to have about (I can include them in presentations etc).

Your mileage may vary.

| improve this answer | | | | |

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.