14

I have learned recently that Export in Mathematica uses by default the "Printout" screen style environment rather than "Working" when exporting to PDF. It sometimes results in FontSize fluctuations in the resulting PDF which are very annoying.

Try for example:

Show[First@ImportString[ExportString[Style[T, 100], "PDF"], "PDF"], 
 Prolog -> Inset[Style[T, 100], FormatType -> StandardForm]]
Show[First@ImportString[ExportString[Style[T, 100], "PDF"], "PDF"], 
 Prolog -> 
  Inset[Style[T, 100, Magnification -> .8], 
   FormatType -> StandardForm]]

screenshot

You can see that the exported "T" has 80% of the size of "T" that appears in the notebook. This is how the "Printout" environment is tuned on by default.

Is there a way to force Export use the default "Working" environment?

P.S. For some reason setting a private stylesheet with Magnification->1 for the "Printout" environment does not affect Export.

Alexey Popkov
  • 9,355
  • 4
  • 42
  • 93
  • I cannot remember, what version are you using? I had to change `Prolog` to `Epilog` for your example to work in version 7. – Mr.Wizard May 23 '11 at 06:40
  • @Mr.Wizard I use v.7.0.1 under Windows 2000. On my machine `Prolog` and `Epilog` give visually identical results in this case as they should. – Alexey Popkov May 23 '11 at 09:36
  • Strange, when using `Prolog` I see only one T; the `Inset` does not appear at all, as though it is occluded by an opaque layer. – Mr.Wizard May 23 '11 at 14:26
  • @Alexey, It's worth mentioning that this does not seem to affect `Graphics`. Try e.g. `Show[First@ ImportString[ ExportString[ Graphics[Inset[Style[T, 100]], FormatType -> StandardForm], "PDF"], "PDF"], Epilog -> Inset[Style[T, 100], FormatType -> StandardForm]]` – Szabolcs Jun 02 '11 at 08:57
  • @Alexey, It DOES however affect graphics when exporting is done from the UI (right click the graphics, and choose Save Graphic As ... PDF). In this case the size reduction is greater than 80% though. I got ~72% in one test. – Szabolcs Jun 02 '11 at 08:59
  • @Szabolcs With your example `Export` gives a file with page size 4.17x4.17 inches, but saving to PDF gives a file with page size 3.33x3.33 inches (*Mathematica* 7.0.1 for Windows). 3.33/4.17=80%. In both cases the size of "T" relative to the page size is the same. – Alexey Popkov Jun 02 '11 at 09:50
  • @Szabolcs After evaluating `SetOptions[$FrontEnd, PrintingStyleEnvironment -> "Working"]` and restarting the FrontEnd `Export` and Save Graphic As ... PDF give identically looking files with page size 5x5 inches. In both cases the size of "T" relative to the page size is the same but is less than by default (with `PrintingStyleEnvironment -> "Printout"`). – Alexey Popkov Jun 02 '11 at 09:58
  • @Alexey, exactly. So it seems that the size is reduced if we export either 1. part of a notebook that is not a Graphics[] 2. use save as rather than the export command. Is this correct? – Szabolcs Jun 02 '11 at 13:21
  • @Szabolcs At the moment it is - what we can say with certainty. But the real problem lies not in changing the scale, but in an inconsistent change the size of different fonts when exporting. I have repeatedly experienced this in real life situations, and this is a serious obstacle. Now, unfortunately, I have no opportunity to investigate this dark area closely. I just recently learned that the [export to PDF uses a different set of styles than the default](http://groups.google.com/group/comp.soft-sys.math.mathematica/msg/7f5cb9e2d4677855)... – Alexey Popkov Jun 02 '11 at 18:42

1 Answers1

12

The solution appears to be:

SetOptions[$FrontEnd, PrintingStyleEnvironment -> "Working"]
Mr.Wizard
  • 24,179
  • 5
  • 44
  • 125
  • 2
    Thanks, It seems working. An alternative is to set this option for `$FrontEndSession`: `SetOptions[$FrontEndSession, PrintingStyleEnvironment -> "Working"]`. Interestingly, in this case this setting affects printing and saving to PDF only newly created notebooks but not the current notebook (but `Export` to PDF work as expected). – Alexey Popkov May 23 '11 at 09:42
  • @Alexey, thanks for the check mark, and the interesting observation. – Mr.Wizard May 23 '11 at 09:58