# Adding headers and/or footers to a stylesheet

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?

• 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? – Alexei Boulbitch Dec 16 '15 at 8:10
• I apologize for the confusion. And Yes. Exactly. – Michael McCain Dec 16 '15 at 8:28

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}
]
}]
]

• That was the issue. Easy fix! – Michael McCain Dec 16 '15 at 8:52
• 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. – Darwin1871 Feb 4 '16 at 13:35
• @Darwin1871 Could you elaborate? – Kuba Feb 4 '16 at 13:37
• 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. – Darwin1871 Feb 4 '16 at 15:01