A lot of my work involves manipulating data, drawing a pretty plot of it and then inserting that graphic into a report written in Microsoft Word, under Windows.1 The fun comes with the exporting part. If the audience don't have the Mathematica fonts installed, negative signs, parentheses etc will come up as missing-characters in the WMF graphic and in Word.

You can fix this using the PrivateFontOptions option, either in the notebook or in the Options Inspector.

SetOptions[$FrontEnd, PrivateFontOptions -> {"OperatorSubstitution" -> False}]

But I still find the output a bit disappointing, in that the spacing around parentheses and other characters in the WMF file looks wrong (sorry, I can't show the whole graphic because the data are confidential).

enter image description here

The code to produce the graph above rests partly on a package, so here is a minimal example:

 test = Grid[{{DisplayForm[
  Style["Source: REDACTED (confidential)", 13, 
   FontFamily -> "Arial", Black], 
        BoxMargins -> {{3, 0}, {0, 0}}]]}}]

enter image description here

This is how it looks in Win7 and Office 2010: the first two are with operator substitution ON, the second pair are with operator substitution OFF. There is still a bit too much space but it is better than in Word 2007.

enter image description here

As highlighted, there is just too much space between the text and the closing parenthesis. This is not apparent in the Mathematica notebook, where it looks just fine. It must be something to do with Mathematica's WMF export routine: other applications with WMF export don't do this.

Is there any way of automatically ensuring that the spacing around letters in the resulting WMF file is a bit more acceptable? Some kind of auto-kerning option? Ideally it should be something I can set in a package so my colleagues don't have to know the internals of how to do it.

1Actually I have people to do that now, but you get the idea.

  • $\begingroup$ Could you please show your complete code (including export) which results in a bad WMF and then convert/screenshot your WMF to PNG/JPG and post it here? I'd be nice if you could also circle in Windows Paint the bad areas of the image. $\endgroup$ Jan 18, 2012 at 3:58
  • $\begingroup$ @Verbeia these don't appear to be Mathematica fonts causing this problem. i.e. you are using Arial which is a system font isn't it? If you don't have the private font options set what font is used when others open the WMF? What happens if you do not have an adjustment box (there are other methods to indent if this is the problem). Is there always an adjustment box when these font issues arise? The parts of the plot you cannot show that have problems: are these plot or line labels? $\endgroup$ Jan 18, 2012 at 6:43
  • 3
    $\begingroup$ Your SetOptions construction is wrong. It should be either SetOptions[$FrontEnd, PrivateFontOptions -> Append[DeleteCases[ PrivateFontOptions /. Options[$FrontEnd, PrivateFontOptions], _[ "OperatorSubstitution", _]], "OperatorSubstitution" -> False]] or shorter CurrentValue[$FrontEnd, {PrivateFontOptions, "OperatorSubstitution"}] = False $\endgroup$ Jan 18, 2012 at 11:12
  • 1
    $\begingroup$ @Mike Strange, I thought this would overwrite the other options that are also in PrivateFontOptions. Apparently it doesn't. Anyway, $FrontEnd should have been included. $\endgroup$ Jan 18, 2012 at 12:13
  • 1
    $\begingroup$ Is WMF the best choice for importing graphics into Word? I never used to like anything but EPS or PDF when I was doing it for a living... (I suspect that this doesn't seem like a helpful comment. If so, sorry .) $\endgroup$
    – cormullion
    Jan 18, 2012 at 15:40

3 Answers 3


I can only guess that the following could be a work-around for you (I don't have Windows). Define the following wrapper function for Export:

outlinedExport[name_, gr_, opts : OptionsPattern[]] := 
  First@ImportString[ExportString[gr, "PDF"], "PDF", 
    "TextMode" -> "Outlines"], opts]

On my Mac, I cannot export to WMF so I'll have to trust that it will work the same way it does with SVG which I did try. Assuming your graphics object is g, you would do something like this:

outlinedExport["output.wmf", g, ImageSize -> 600]

There is no need to embed any fonts because they have all been replaced by outlined paths (again, not sure if Mathematica on Windows does this properly). The downside is that the file size increases, but the upside is that you'll never have any font headaches again.

  • $\begingroup$ Late comment, but this works on Windows too. The final format probably ought to be EMF rather than WMF, though. $\endgroup$ Jan 14, 2013 at 1:43
  • $\begingroup$ Late comment, I was trying to get some Mathematica content into Illustrator and having the same font issues. I found this solution and it works great for me. (on a Mac). But one interesting glitch, and words with an apostrophe had a font substitution! So, the CloseCurlyQuote character caused trouble. $\endgroup$ Jan 29 at 17:44

If the missing fonts are the problem, one thing you could do is have your recipients download MMA's fonts from the appropriate support page (windows, unix, macintosh). Installing the CDF-player also installs MMA's fonts.

If this is not feasible a robust option is to export as bitmap. You're guaranteed to have no font problems. Obviously that means it doesn't scale, but I found that quite often you don't need that (like in Powerpoint presentations).

On my computer, copying the text from your example to Word2010 and using paste special / picture (metafile enhanced) doesn't give me this problem. But that may be because the fonts are installed on this PC. I'll try to install a virtual machine with Word to see whether it's the same there.

Mathematica graphics


Powerpoint and Word 2010 have the options to embed fonts: Mathematica graphics

Mathematica graphics.

BTW, I tried your example in a virtual machine Win7-64 installation without a trace of Mathematica or its fonts and it does look normal, i.e. the parenthesis close without the extra space. So, your problem may be caused by a pre 2010 version of Word.

  • $\begingroup$ "Install the fonts" would definitely be a part of the answer but (a) I can't rely on the IT staff to get this right and (b) this will fail for PowerPoints shown externally. $\endgroup$
    – Verbeia
    Jan 20, 2012 at 23:01
  • $\begingroup$ @Verbeia AFAIK PowerPoint is able to embed the font into the document (for portability) $\endgroup$
    – Szabolcs
    Jan 20, 2012 at 23:09
  • $\begingroup$ @Szabolcs - if you can construct this as an answer with an example it might be the one I will end up accepting - but I will have to test it next week at work. It's the weekend here and my home machine is a Mac. $\endgroup$
    – Verbeia
    Jan 20, 2012 at 23:13
  • $\begingroup$ @verbeia Please see update. One problem that I see is that the bounding box of the area copied is apparently one pixel too small. It looks like Word slices off the upper part of the letters. $\endgroup$ Jan 22, 2012 at 14:31

I suggest to Magnify the output before exporting it to WMF/EMF or increase the ImageSize because metafiles are sampled at screen resolution fidelity (see examples here). I also advise to use the EMF (Enhanced Metafile Format) format which is much better than the old WMF (Windows Metafile Format) developed originally for Windows 3.11...


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.