[Tugindia] Harnessing MetaPost, EMP and TeXnicCenter
Duvvuri Venu Gopal
venugopal_duvvuri at rediffmail.com
Mon Apr 18 07:07:51 CEST 2005
Harnessing MetaPost, EMP and TeXnicCenter
An easier way of including MetaPost figures in LaTeX documents is described below.
MetaPost is a powerful programme created by John Hobby by modifying the MetaFont programme of Donald E. Knuth for creating beautiful looking diagrams, figures, graphs etc. for inclusion in TeX documents. Like TeX, the code for MetaPost is created in an editor and saved with the file extension .mp and the MetaPost (mp or mpost) is run on this file to create the figure.
MPEdit is an IDE for easily creating and viewing the MetaPost figures. It can be downloaded from the CTAN archives.
The problem with both these methods is one has to separately place the figure at the desired place using the epsf or graphicx package. The metapost file and LaTeX files are separate entities and there is need that one has to update both these files.
Using the emp package (Encapsulated MetaPost) created by Thorsten Ohl (1997) one can place the MetaPost code in LaTeX document itself. All the MetaPost code is shipped out to a mp file and after running the MetaPost on the mp file so created, another LaTeX run is required and the MetaPost figure so created embeds in the document at the appropriate place. (For full details read the emp manual).
In TeXnicCenter, distributed with the MikTeX , one can configure it to process and postprocess the tex documents. The details for configuring it to run MetaPost on the file created by the emp package is given below.
In TeXnicCenter click on Build menu.
In the last there is a menu item Define output profiles. Click on it.
Click on Add and create a profile LaTeX => MP => DVI
Select the (La)TeX tab. Select the Run (La)TeX in this profile.
In Path to LaTeX Compiler give the path where LaTeX is residing
i.e., C:\texmf\miktex\bin\latex.exe.
In command line arguments type the following
--src interaction=nonstopmode %Wm
Click on postprocessor tab and add the following :
Create
1) MetaPost in the Postprocessors to run after LaTeX
in the Executable area type : C:\texmf\miktex\bin\mp.exe
in the Arguments area type : %Bm.mp
2) LaTeX to DVI in the Postprocessors to run after LaTeX
in the Executable area type : C:\texmf\miktex\bin\latex.exe
and in the Arguments area type : --src -interaction=nonstopmode "%Wm"
Now the TeXnicCenter is ready to postprocess and include the MetaPost figures in the document.
I welcome your comments.
D. Venu Gopal
TeX User No. 4091
More information about the tugindia
mailing list