2
$\begingroup$

I would like to push a common header(file name and page number) across multiple notebooks using one Stylesheet.

I know I can use the header/footer dialog on each notebook individually but this is not efficient. A Stylesheet seems like the way to go. I'm comfortable working with Stylesheets and applying them to notebooks.

However, I can't seem to save any changes to my header into a Stylesheet. Is this even possible? If so, how can this be done?

$\endgroup$
2
  • 1
    $\begingroup$ Your aim is not quite clear. Indeed, in the working environment form there is no division of a notebook into pages. Should your question be understood as the numeration and the file name to appear in a pdf or a printed version? $\endgroup$ – Alexei Boulbitch Dec 16 '15 at 8:10
  • $\begingroup$ I apologize for the confusion. And Yes. Exactly. $\endgroup$ – Michael McCain Dec 16 '15 at 8:28
2
$\begingroup$

Oh, ok, so it seems that by default PrintingOptions -> "FirstPageHeader" is False ref

So now you can use what I've stated in comments, just add something like:

Cell[StyleData["Notebook", "Printout"],
 PageHeaders -> {{"a1", "a2", "a3"}, {"a1", "a2", "a3"}},
 PageFooters -> {{"a4", "a5", "a6"}, {"a4", "a5", "a6"}},
 PrintingOptions -> {"FirstPageHeader" -> True}
]

in your stylesheet. A minimal example:

CreateDocument[{x + y},
 StyleDefinitions -> Notebook[{
    Cell[StyleData[StyleDefinitions -> "Default.nb"]],
    Cell[StyleData["Notebook", "Printout"],
     PageHeaders -> {{"a1", "a2", "a3"}, {"a1", "a2", "a3"}},
     PageFooters -> {{"a4", "a5", "a6"}, {"a4", "a5", "a6"}},
     PrintingOptions -> {"FirstPageHeader" -> True}
     ]
    }]
 ]
$\endgroup$
4
  • $\begingroup$ That was the issue. Easy fix! $\endgroup$ – Michael McCain Dec 16 '15 at 8:52
  • $\begingroup$ Unfortunately it didn't work for me. If evaluate the second example it works. But if I incorparate the first given lines in a Stylesheet an then try to print a notebook, where this StyleSheet is set as StyleSheet the headers and footers do not appear in the printout. What am I doing wrong? Many thanks. $\endgroup$ – Darwin1871 Feb 4 '16 at 13:35
  • $\begingroup$ @Darwin1871 Could you elaborate? $\endgroup$ – Kuba Feb 4 '16 at 13:37
  • $\begingroup$ Thank you for your fast reply. There was an error in the formating statement. I copied it from a working Header-Definition. And after the copying process apostrophes where missing!! Also the priorities of all the options you can set in different places is miraculous for me. $\endgroup$ – Darwin1871 Feb 4 '16 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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