True WYSIWYG LaTeX System
Windows     Mac     Linux  

Import MetaPost Graphics

Import MP-files using graphics package.

Beginning from BaKoMa TeX 11.50 import of MetaPost files is as simple as 1-2-3. Just use graphics package:

\documentclass{article}
\usepackage{graphicx}

\begin{document}

Test of import MetaPost graphics:

\includegraphics{foo.mp}

\end{document}

This approach is ideal for WYSIWYG editing (i.e. for TeXWord) because it have efficient caching and will not slow down editing process.

Another Packages

There are another LaTeX packages to integrate MetaPost graphics into LaTeX documents.

However, these packages will run Metapost at every keystroke in TeXWord without any caching. It may noticeably degradate responce of TeXWord. In this reason, we recommend to import MetaPost figures from separate files using \includegraphics.

We explore all such packages available on CTAN. Results are on below table.

  • mpostinl (LPPL) - V 1.12 - Jun-2017 - Looks as most supported package.
  • mpgraphics (LPPL)- V 0.3 - Apr-2013 - Looks as stopped in middle.
  • gmp - (LPPL) V 1.0 (C) 2011 by Enrico Gregorio
  • emp (GNU) - V 1.3 11/1997, Docs: 2008,2011. GNU !!!

Sample of using gmp package is below:

\documentclass[12pt,a4paper]{article}
\usepackage{gmp}

\begin{document}
Test

\begin{mpost}[name=swelled]
breadth=.667\mpdim{\linewidth};
height=2pt;
x1=0;
x2=x6=.333x4;x5=x3=.667x4;
x4=breadth;
y1=y4=height/2;
y2=y3=height;
y5=y6=0;
fill z1--z2--z3--z4--
z5--z6--cycle;
\end{mpost}
End of test.
\end{document}

Work around to use such packages.

If packages are slow down responce of TeXWord becase of running external programs such as MetaPost we recommend do following:
  • Disable \write18 in TeXWord
  • Open your document simulteniously in Centaur.
  • Run TeX from Centaur will run all programs and create proper preview in TeXWord.

MetaPost version included into BaKoMa TeX

BaKoMa TeX beginning from V 11.50 includes MetaPost 2.0 build without PNG backend and with dynamically linked MPFR and MPIR libraries.