3
$\begingroup$

I know it is possible to check the box "Include headers on first page" in the "Headers and Footers" dialog box of the Print Settings menu item, but is it also possible to check this using commands in the Notebook itself? It would be for the current notebook.

Thanks for all help, as always!

$\endgroup$

2 Answers 2

2
$\begingroup$
SetOptions[EvaluationNotebook[], PrintingOptions -> {"FirstPageHeader" -> True}]

You can open $InstallationDirectory/SystemFiles/FrontEnd/SystemResources/HeadersFootersDialog.nb as text file and find all possible options. For completeness I want add that with

SetOptions[EvaluationNotebook[], PageHeaders -> {{"a1", "a2", "a3"}, {"a4", "a5", "a6"}}]

you can set headers. See also: PageHeaders, PageFooters, PageHeaderLines, PageFooterLines.

$\endgroup$
7
  • $\begingroup$ sorry, I didn't mean to copy your answer, my browser didn't refresh (a.k.a. I didn't pay attention) :) $\endgroup$ Sep 12, 2013 at 19:55
  • $\begingroup$ @PinguinDirk Don't worry. Firstly I didn't read question carefully and post only the second part of my answer. When I realized my mistake I delete answer. Then I find true options and undelete it in the same time as you :) $\endgroup$
    – ybeltukov
    Sep 12, 2013 at 20:02
  • $\begingroup$ ah that's why it appeared out of the sudden with 28mins on the timer. Advanced cheating :) I am glad my brain didn't play any tricks on me then $\endgroup$ Sep 12, 2013 at 20:08
  • $\begingroup$ @ybeltukov: Why is it necessary to add the curly braces around the "PrintingOptions->..." and doesn't this command work SetOptions[EvaluationNotebook[], PrintingOptions -> {"FirstPageHeader" -> True}] without the "extra" curly braces? Thanks! $\endgroup$
    – Gabriel
    Sep 12, 2013 at 20:18
  • $\begingroup$ @Gabriel Yes, they aren't necessary, I deleted them. $\endgroup$
    – ybeltukov
    Sep 12, 2013 at 20:23
2
$\begingroup$

As per @ybeltukov below is what I have in my stylesheet, implemented here as SetOptions

SetOptions[EvaluationNotebook[],
  PrintingStartingPageNumber -> 1,
  PageHeaders -> {
    {Cell[TextData[{CounterBox["Page"]}], "PageNumber"], None, None},
    {None, None, 
     Cell[TextData[{CounterBox["Page"]}], "PageNumber"]}},
  PageFooters -> {{None, None, None}, {None, None, None}},
  PrintingOptions -> {
    "PrintingMargins" -> {{90, 90}, {60, 90}},
    "PaperSize" -> {596, 794},
    "PageSize" -> {596, 794},
    "PageHeaderMargins" -> {60, 60},
    "PageFooterMargins" -> {30, 30},
    "FirstPageFace" -> Right,
    "FirstPageHeader" -> False,
    "FirstPageFooter" -> False}
    ]

I'd recommend having a look at the printing options settings in the options inspector and figure out what you want your base case to be, and then include those settings in a stylesheet within the "Notebook" style data.

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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