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$ Commented Dec 16, 2015 at 8:10
  • $\begingroup$ I apologize for the confusion. And Yes. Exactly. $\endgroup$
    – B flat
    Commented Dec 16, 2015 at 8:28

1 Answer 1

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$
    – B flat
    Commented Dec 16, 2015 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
    Commented Feb 4, 2016 at 13:35
  • $\begingroup$ @Darwin1871 Could you elaborate? $\endgroup$
    – Kuba
    Commented Feb 4, 2016 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
    Commented Feb 4, 2016 at 15:01

Your Answer

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

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