Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to programmatically save (and then temporarily change and restore) specific printing options. I get as far as

Options[Notebook, PrintingOptions]

but don't know what to do next to extract specific options, for example PrintingMargins, from the (long) resulting list.

share|improve this question
Doesn't "PrintingMargins" /. (PrintingOptions /. Options[Notebook, PrintingOptions]) work for you? – J. M. Nov 15 '12 at 23:20
@J.M.: That works. There's no API for extracting nested options? – raxacoricofallapatorius Nov 15 '12 at 23:21
API, nothing. What would be the trouble with using ReplaceAll anyway? – J. M. Nov 15 '12 at 23:44
@J.M.: No problem, I just expected something more compact and targeted to options. – raxacoricofallapatorius Nov 15 '12 at 23:54
You kids today don't know how good you've got it! When I were a lad, ReplaceAll was all we had for option handling! We'd make six nested replacements to process our options, with Hold and Release for evaluation control, and Block our only scoping construct. And we were thankful! – Oleksandr R. Nov 16 '12 at 0:15
up vote 3 down vote accepted
 CurrentValue[Notebook, {PrintingOptions, "PrintingMargins"}]
 (* {{54, 54}, {72, 72}} *) 

You can also use $FrontEnd , EvaluationNotebook[] ... as the first argument.

Other examples:

 CurrentValue[$FrontEnd, EvaluatorNames]
     (* {"Local" -> {"AutoStartOnLaunch" -> True}} *)
     CurrentValue[$FrontEnd, {EvaluatorNames, "Local"}]
 (* {"AutoStartOnLaunch" -> True} *)
 CurrentValue[$FrontEnd, {EvaluatorNames, "Local", "AutoStartOnLaunch"}]
 (* True *)

Update: See also this Q/A: Items known by CurrentValue.

share|improve this answer

Your Answer


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.