9
$\begingroup$

Please consider the following, version 10.0.1, OS X Mavericks:

SetOptions[$FrontEndSession, PrivateFontOptions -> {"OperatorSubstitution" -> False}] fakedata = FoldList[0.98 #1 + #2 &, 2., RandomVariate[NormalDistribution[0, 1], 11]] (*{2., 2.39063, 2.58035, 1.30193, 0.758044, 1.47053, 2.81647, \ 2.30642, 1.12738, -1.07766, -2.03465, -1.38781} *) test0 = BarChart[fakedata, PlotTheme -> "None"] 

enter image description here

Now export test0 as a PDF, and open in Adobe Reader to check the fonts.

enter image description here

Clearly, the special Mathematica fonts are being used still. It is clearly visible in the minus signs in the original graphic in the notebook.

I want to turn OperatorSubstitution off in EMF export on Windows, because it causes issues when embedding the EMF graphics in Word or PowerPoint. I did this test in PDF format on Mac OS X (my home machine, work is yet to upgrade) but have reason to believe that the font-export behaviour is the same.

  • Can anyone confirm that the behaviour is the same on Windows, either for PDF or EMF export?
  • If so, can anyone suggest a way to enforce the version-9 behaviour of respecting the setting for PrivateFontOptions? The documentation says:

This function has not been fully integrated into the long-term Wolfram Language, and is subject to change.

Am I out of luck in the new version? I was hoping to use version 10 given its improved PDF export, but I can't expect outside organisations to have installed the Mathematica fonts just so we can show a couple of simple charts in a PowerPoint. This sort of thing can be a showstopper for a large organisation.

$\endgroup$
11
  • 1
    $\begingroup$ Doesn't work with Linux and 10.0.1 either. The output of "pdffonts" shows MathematicaSans whenever there are negative values on the y-axis. $\endgroup$ Commented Oct 13, 2014 at 11:50
  • 1
    $\begingroup$ Windows 7 and Mathematica 10.0.1: Same result $\endgroup$ Commented Oct 13, 2014 at 12:02
  • $\begingroup$ The best what I can recommend is to save the charts from Acrobat to PNG with sufficient resolution and then insert them in PowerPoint. Actually Mathematica's PDF export in v.10.0.1 is still broken in many ways as compared to v.8. And I still cannot see in what sense it is "improved". $\endgroup$ Commented Oct 13, 2014 at 12:27
  • $\begingroup$ @AlexeyPopkov - this is not a sufficient solution, unfortunately, because non-vector graphics look rubbish when we resize them, which is necessary for including them in Word. For what it's worth, I do regard the v10 PDF export as improved over version 9 because at least embedded fonts are being correctly subsetted now. $\endgroup$ Commented Oct 13, 2014 at 21:52
  • $\begingroup$ @Thomas - would you mind checking how EMF format exported plots work in Word/PowerPoint on a computer without the Mathematica fonts installed? $\endgroup$ Commented Oct 13, 2014 at 22:00

3 Answers 3

4
$\begingroup$

Since this appears to still be broken under Mathematica 10.3 on Windows, consider the following workaround based on the solution provided by Verbeia:

nb = EvaluationNotebook[]; SetOptions[ nb, StyleDefinitions -> Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], Cell[StyleData["TraditionalForm"], PrivateFontOptions -> {"OperatorSubstitution" -> False}]}] ] 

For some weird reason the above code snippet does not work when EvaluationNotebook[] is used directly in SetOptions[].

$\endgroup$
1
  • $\begingroup$ This works, thanks! If I can only work out how to make it work in my hopelessly convoluted packages that then talk to .Net.... sigh $\endgroup$ Commented Feb 11, 2016 at 22:22
6
$\begingroup$

I contacted Wolfram Support, who replied:

Thanks for your email. We actually changed the implementation of the option "OperatorSubstitution" in Mathematica 10, and now it's a global option. What happens is that the default FormatType used in graphics is "TraditionalForm", and this style has the default setting of "OperatorSubstitution" to True. To workaround this issue, we can edit the stylesheet or change the option of this style.

SetOptions[$FrontEndSession, StyleDefinitions -> Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], Cell[StyleData["TraditionalForm"], PrivateFontOptions -> {"OperatorSubstitution" -> False}]}]] 

According to my testing, this works on Mac OS, but now that I also have a Windows version (10.0.2), I cannot make the same thing work there.

$\endgroup$
2
  • 2
    $\begingroup$ (+1) It is interesting that Options[$FrontEndSession, StyleDefinitions] returns an error Options::optnf: StyleDefinitions is not a known option for $FrontEndSession. even after evaluating the suggested code. CurrentValue[$FrontEndSession, StyleDefinitions] returns $Failed. $\endgroup$ Commented Oct 25, 2014 at 7:35
  • $\begingroup$ The error message is right. You shouldn't be setting StyleDefinitions at the global scope. If it happens to do something, assume that behavior could change in the future (probably to do nothing, as it really should do). $\endgroup$ Commented Sep 3, 2024 at 14:59
3
$\begingroup$

Since this is coming from the TraditionalForm style, one way to deal with this is to simply ensure that TraditionalForm is never being used as a format type. Graphics-generating functions take the option FormatType. If you don't need typeset math in your labels (and, if you're seeking to disable operator substitution, you probably don't), then you can specify FormatType->TextForm, and then specify the operator substitution as part of the graphic's BaseStyle, so you don't have to change a global setting.

Compare:

(* "OperatorSubstitution" setting is not effective *) Graphics[ Text["!@#$*", BaseStyle -> {PrivateFontOptions -> {"OperatorSubstitution" -> False}}]] (* "OperatorSubstitution" setting is effective *) Graphics[ Text["!@#$*", BaseStyle -> {PrivateFontOptions -> {"OperatorSubstitution" -> False}}], FormatType->TextForm] 
$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.