2
$\begingroup$

I am trying to work with Mathematica 10's new font and have found a simple way to revert the font family to Times New Roman for all my figure. I enter the following command in the Private Style Definitions, under 'Format' > 'Edit Stylesheet'.

Cell[StyleData["Graphics"],FontFamily->"Times"]

However, if a Graphics is inside a Grid, the font may look like Times in the FrontEnd of Mathematica, but it goes back to the Sans font family once exported.

myFigure=Grid[{{Show[RegionPlot[1<0,{x,0,1},{y,0,1},FrameLabel->{"Text","Text"},ImageSize->400]]}}]
Button["Export Figure",Export["C:\\Figure.pdf",myFigure];]
myFigure2=Show[RegionPlot[1<0,{x,0,1},{y,0,1},FrameLabel->{"Text","Text"},ImageSize->400]]
Button["Export Figure 2",Export["C:\\Figure 2.pdf",myFigure2];]

Any thought why? Any ideas how to get Times in my final output?

$\endgroup$
  • $\begingroup$ Dıd you try GraphıcsGrıd? $\endgroup$ – Rom38 Aug 14 '14 at 15:55
  • $\begingroup$ Can you try t[text_] := First@ImportString@ExportString[Style[text, FontFamily -> "Times"],"PDF"] then FrameLabel -> {t@"text", t@"text"}? Exporting figures with these labels give me twice the same text in PDF. $\endgroup$ – Öskå Aug 14 '14 at 16:34
  • $\begingroup$ It's a good habit to reply comments ;o) Not replying doesn't encourage to answer your questions. $\endgroup$ – Öskå Aug 17 '14 at 14:04
  • $\begingroup$ I'm looking for a fundamental solution, not a cheat which happens to give the same final result. $\endgroup$ – LBogaardt Aug 17 '14 at 18:09
2
+25
$\begingroup$

There may be a problem with the Export function and you might need to specify the FontFamily directly in the plot. The following script may help you solve the problem of getting the exported plot in the way you want, although using a slightly different approach.

{myFigure = 
  Grid[{{Show[
      RegionPlot[1 < 0, {x, 0, 1}, {y, 0, 1}, 
       FrameLabel -> {"Text", "Text"}, ImageSize -> 400], 
      BaseStyle -> {FontFamily -> "Helvetica"}]}}]
 ,
 Button["Export Figure", 
  Export[FileNameJoin[{$HomeDirectory, "Figure.pdf"}], myFigure]]
 }
$\endgroup$
  • $\begingroup$ (+1) This workaround works for me under Win 7 x64. $\endgroup$ – Alexey Popkov Aug 15 '14 at 17:23
  • $\begingroup$ This works for me (Win7 x64, MMA 10.0.0). $\endgroup$ – LBogaardt Aug 16 '14 at 19:33
  • 1
    $\begingroup$ However, it's not a real solution to the problem, only a workaround. As noted, there may simply be a small bug in the new Mathematica. $\endgroup$ – LBogaardt Aug 17 '14 at 22:18

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.