# Inserting a .EMF file into a LaTeX document.

I had a question about a file extension I was dealing with after creating a graphics file using the computing software Maxima. When I created the plot I wanted, I saved the file and it saved as a .EMF file. I am not too familiar with this file extension and wanted some advice as to how (if possible) can this file be implemented into the .tex file I am trying to create.

-
See: fileinfo.com/extension/emf . You will have to find a way to convert that to PDF or EPS, because pdflatex or latex/dvips do not support this format. –  Taco Hoekwater Jun 23 '11 at 7:37
Your question body doesn't really match your title, do you want to know which (graphics) file types can be used in a LaTeX document, or do you want to know how to implement a .emf file into a document, i.e. how to convert it to a compatible format? –  doncherry Jun 23 '11 at 9:25
@doncherry: Thanks. Exactly right! I just could not think of a good relevant title for what I was trying to accomplish at the time in relating to the body of the text. –  night owl Jun 23 '11 at 10:14

You need to export the plot in a graphics file. This can be either a .png, .jpg, .eps or .pdf.

However from looking at the Maxima website, it has a list of help articles for TeX exports - here. I've not used Maxima to create graphs as I tend to use GNUPlot as I find it the easiest method to create graphs and then export them into LaTeX. Might be worth investigating that if it can help.

-
Thanks for the response. It is quite helpful. I will definitely look into GNUPlot. I have just recently started using Maxima as I regularly use Mathematica. I just wanted to explore and learn a new system. Thanks. –  night owl Jun 23 '11 at 10:19
Also take a look to matplotlib plotting library for python. –  TheBug Jul 1 '11 at 8:11

If this software can't produce a EPS or PDF file itself you should convert the EMF file (Enhanced Windows Metafile, a Windows (read Microsoft) vector graphics format) to either PDF (pdflatex) or EPS (latex). I would not recommend to convert it to a raster image format like PNG and especially not to the lossy JPG format. (See also Quickest way to include graphics for more.)

You can try to use the convert tool (under Windows sometimes called imgconvert) of Image Magick:

convert somefile.emf somefile.pdf


But often it doesn't work well with the fonts.

There is also Inkscape (under Linux I mean), a vector graphic drawing program which reads and writes a lot of formats and does a very good job.

Under MS Windows you might also try to simply open the EMF file using whatever tool Windows provides for it and print it using a PDF printer (e.g. the free pdfcreator) to a PDF (or even EPS, IIRC). Then you can use pdfcrop to remove the resulting page margins around it.

-
Thanks, this is some wonderful information. I think you wanted to say Inkscape instead of inkscrape. Just wanted to point that out so others won't look for the wrong titled program. –  night owl Jun 23 '11 at 11:25
@nightowl: Thanks. I fixed it and also added a link to the SW homepage. –  Martin Scharrer Jun 23 '11 at 11:34

The Lyx people have links to a Metafile to EPS converter, which works for both WMF and EMF files. This needs to be installed on a Windows system, but provided you have one of these available seems to work well. Sometimes the resulting EPS file is rather large, but for me conversion to PDF format seems to resolve this (if you are using pdfLaTeX, of course).

-

There are a lot of ways converting an EPS to PDF - however most of them don't work properly. For example the ImageMagick convert function places a rasterized image with unreadable textes in the PDF.

The best results I got was using the Windows built in "Windows Picture and Fax Viewer" and then print to PDF using an PDFCreator (Adobe PDF 9 created small errors). After changing the paper orientation manually to landscape printing worked like a charm and the result is a vector based image.

-