Re: Date in header
- To: mathgroup at smc.vnet.net
- Subject: [mg17410] Re: Date in header
- From: paulh (P.J. Hinton)
- Date: Thu, 6 May 1999 02:44:20 -0400
- Organization: Wolfram Research, Inc.
- References: <7gfto6$6is@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <7gfto6$6is at smc.vnet.net>, "William B. Marks" <bmarks at helix.nih.gov> writes:
> How to make a global change so the date is always in header on print?
The key is to realize that the settings for headers and footers
in printing are set by default within the style sheet notebook
Default.nb. If you want the headers to include the date, you
must edit the Notebook cell prototype for Default.nb.
To do this, first locate your notebook style sheet directory by
evaluating this expression into a notebook cell and evaluate it.
LinkWrite[
$ParentLink,
FrontEnd`ToFileName[
FrontEnd`FileName[{$TopDirectory, "SystemFiles", "FrontEnd",
"StyleSheets"}]]
];
LinkRead[$ParentLink]
Inside of the directory you just determined, there should be
a notebook file named Default.nb.
If you are working on a Unix system, and cannot alter files in
the core Mathematica installation, make a directory with this
path:
LinkWrite[
$ParentLink,
FrontEnd`ToFileName[
FrontEnd`FileName[{$PreferencesDirectory, "FrontEnd", "StyleSheets"}]]
];
LinkRead[$ParentLink]
and copy Default.nb to this directory. This is the copy you will
modify.
If you are working under Windows or Macintosh, make a backup copy of
Default.nb.
Open Default.nb as if it were any other notebook. Double-click on the cell
bracket for the section titled "Notebook Options". Locate the cell that is
labeled:
Prototype for style: "Notebook":
and select its cell bracket.
Click on the front end menu command sequence:
Format -> Option Inspector
On the resulting dialog box, set the scope indicator to "selection" rather
than "global", "notebook", or "selection's style". Set the view indicator
to be "text" intead of "category"
This should expose the options of the prototype cell in a text edit window.
The option value should be:
PageHeaders-> {
{
Cell[TextData[{CounterBox["Page"]}], "PageNumber"], (* left page, left corner *)
None, (* left page, middle *)
Cell[TextData[{ValueBox["FileName"]}], "Header"] (* left page, right corner *)
},
{
Cell[TextData[{ValueBox["FileName"]}], "Header"], (* right page, left corner *)
None, (* right page, middle *)
Cell[TextData[{CounterBox["Page"]}], "PageNumber"] (* right page, right corner *)
}
}
If you need to change one of the values to a date, you can use the following
ValueBox[] objects.
ValueBox["Date"] -> 5/3/99
ValueBox["DateLong"] -> Monday, May 3, 1999
ValueBox["Month"] -> 5
ValueBox["MonthName"] -> May
ValueBox["ShortMonthName"] -> May (three-letter abbreviation)
ValueBox["Day"] -> 3
ValueBox["Year"] -> 1999
ValueBox["ShortYear"] -> 99
Once you've got this edited to your liking, you can then hit the Apply button
and close the Option Inspector dialog. Now save your changes and close the
notebook.
If you are a Unix user who had to copy the Default.nb file to your
preferences directory, you will need to evaluate this expression to point
the front end to your private copy.
SetOptions[
$FrontEnd,
DefaultStyleDefinitions ->
FrontEnd`FileName[
{$PreferencesDirectory,"FrontEnd","StyleSheets"},
"Default.nb"
]
]
--
P.J. Hinton
Mathematica Programming Group paulh at wolfram.com
Wolfram Research, Inc. http://www.wolfram.com/~paulh/
Disclaimer: Opinions expressed herein are those of the author alone.