12

Can I set global preferences that are accessible via "Edit"->"Preferences" programmatically from within a notebook?

As learned from this question, turning off anti-aliasing can make a huge difference in the maximum allowable ImageSize. This can be done via menu:

Mathematica graphics

The slider is setting the value of HardwareAntialiasingQuality that can be found with the option inspector:

Mathematica graphics

Question: Is there a way to set/reset the value of HardwareAntialiasing (and others) programmatically? I´d like to set this with a line only in those notebooks that benefit from this setting and have proper antialiasing for the rest.

Footnote: this answer does help with setting the rendering method directly within a Graphics3D expression, and as @Sjoerd's answer shows this also works in more global way.

Yves Klett
  • 15,383
  • 5
  • 57
  • 124
  • 1
    I'm also curious about how to set it back to the default value programatically (what that little green X does in your screenshot). – Szabolcs Feb 11 '13 at 18:52

2 Answers2

15

Instead of SetOptions, it is also possible to use CurrentValue. In this particular case the syntax is

CurrentValue[$FrontEnd, {RenderingOptions, "HardwareAntialiasingQuality"}] = 1.0

CurrentValue is easier to use than SetOptions in the situation when a single option has multiple sub options. If we have an option of the form opt -> {a -> 1, b -> 2}, then SetOptions[..., opt -> {a -> 1}] would remove the sub-option b. (This is not the case with RenderingOptions, but it is with others, e.g. "PalettesMenuSettings" or TaggingRules, which can have completely arbitrary sub options.) The simplest solution in this situation is CurrentValue[object, {opt, a}] = .... This will not touch the suboption b.

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
13

I believe the following should work:

SetOptions[$FrontEnd, RenderingOptions -> {"HardwareAntialiasingQuality" -> 1}]

for a permanent global setting,

SetOptions[$FrontEndSession, RenderingOptions -> {"HardwareAntialiasingQuality" -> 1}]

for a temporary (session duration) global setting, and

SetOptions[EvaluationNotebook[], RenderingOptions -> {"HardwareAntialiasingQuality" -> 1}]

in each notebook for which you want an individualized setting.

Sjoerd C. de Vries
  • 65,815
  • 14
  • 188
  • 323