Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I've set up my plot to look exactly how I like it. At least it does so on screen. Upon export though, only the bitmap formats look the same. For PDF and EPS, the FontSize seems to get ignored and the lines aren't outlined so when downscaling the whole plot the lines get thicker in relation.

Isn't there a simple way to just render the whole thing as a proper PDF with everything (including fonts) outlined and at correct size?!

EDIT: So there were two different problems I ran into: First was Adobe Illustrator somehow couldn't display all the text that Mathematica output into the PDF. Therefore the option to outline from within Mathematica is very convenient.

Second was my (newbish) mistake to specify the font size with Scaled[0.02] wich was clearly not what I wanted. I now changed it to fixed point sizes.

share|improve this question
10  
I think posting a self-contained minimal code example will be highly beneficial. –  Ajasja Jul 17 '12 at 13:54
3  
Mathematica uses different coordinates for plot items and fonts. Plot items follow the plot coordinate system which scaled with the graphic. Fonts are given in absolute physical size (points, centimetres) and don't scale by default. These help achieve consistent font sizes across the document. You probably scaled the graphic before exporting, but it's impossible to tell unless you give a working example that demonstrates the problem. Also, please choose a proper and informative title (don't assume that it's broken just because it didn't work according to your expectations). –  Szabolcs Jul 17 '12 at 16:17
add comment

3 Answers 3

up vote 7 down vote accepted

Not knowing in what other external application you plan to process the exported PDF, I'm focusing mainly on the last paragraph of the question which asks for a way to outline fonts. To do this, you can simply define the function

outlinedExport[name_, gr_, opts : OptionsPattern[]] := 
 Export[name, 
  First@ImportString[ExportString[gr, "PDF"], "PDF", 
    "TextOutlines" -> True], FilterRules[{opts}, Options[Export]]]

Assuming your graphics object is g, you would do something like this:

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

This also works for other file formats, and accepts options such as ImageSize.

Edit

One additional caveat to watch out for: if your plot has a frame or axes that turn out to look too thin in the exported vector graphics, try adding options to your plot that explicitly fix the thickness, such as

AxesStyle->Thickness[.002]

or (if you have set Frame -> True:

FrameStyle -> Thickness[.002]
share|improve this answer
add comment

Mathematica uses two differen sets of styles for displaying graphics on screen and for exporting: ScreenStyleEnvironment for displaying and exporting in raster formats and PrintingStyleEnvironment for printing and exporting to EPS and PDF formats (see here for more details). One way to achieve consistent export to PostScript is to set PrintingStyleEnvironment the same as ScreenStyleEnvironment:

SetOptions[$FrontEnd, PrintingStyleEnvironment -> "Working"]
share|improve this answer
add comment

I've arrived at something that works for my scenario, though it's a bit hacky.

  1. install the Mathematica Fonts on your system.

    On OS X they're in Mathematica.app/SystemFiles/Fonts/TrueType/MathematicaFonts.dfont
    copy this file to ~/Library/Fonts

    (To get inside the Mathematica.app bundle: right-click -> show package contents,
    to get to your Library, use "Go -> Go to Folder" in the Finder)
  2. export plot as SVG
  3. do a search & replace in the SVG (SVG is text after all), replacing 'Times' and 'SVGTimes' with 'Mathematica1'.
  4. (optional) outline all strokes in your vector graphics application
share|improve this answer
6  
This text replacement approach seems a little clunky - in particular if there are other fonts in the graphic that may cause problems. It would also be good to include an actual code example, and mention a specific PDF viewer application in which you observe the font size problem. –  Jens Jul 17 '12 at 14:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.