% BasicPrint.style
% last written by Plass, July 16, 1982 10:12 am
% modified by Beach, May 20, 1983 3:11 pm; added left/right footers
% see comments after EndStyle
BeginStyle
% Syntactic sugar
(bp) "big point" {72.0 .div in} StyleRule
(IF) {}.cvx .def
(THEN) {}.cvx .def
(FI) {.cvx .if}.cvx .def
(ELSE) {.cvx}.cvx .def
(FIELSE) {.cvx .ifelse}.cvx .def
(EXITifTRUE) {{.exit} .cvx .if}.cvx .def
(EXITifFALSE) {.not {.exit} .cvx .if}.cvx .def
(DO) {}.cvx .def
(ENDLOOP) {.cvx .loop}.cvx .def
% Page layout control variables
(pageNumbering)
{.true} .cvx .def
(firstPageNumber)
{1} .cvx .def
(firstHeadersAfterPage)
{1} .cvx .def
(oneSidedFormat) % set false if you wish two-sided headers/footers
{.true} .cvx .def
(GalleyWidth) {
the lineLength the rightIndent .sub
}.cvx .def
% Page layout routines
(PageBuilder) {
StartPageCounter
DO {
.page EXITifFALSE
HeaderBox
.exchbox
FooterBox
3 .vbox .shipout
IncrPage
} ENDLOOP
}.cvx .def
(StartPageCounter) {
(PageCount) (firstPageNumber) .load .def
}.cvx .def
(GetPageCounter) {
(Helvetica) 10 bp .textfont PageCount .cvs .textbox 1 .hbox
}.cvx .def
(IncrPage) {
(PageCount) PageCount 1 .add .def
}.cvx .def
(IsOddPage) {
% determines which page to format: odd => right (recto) page, even => left (verso) page
PageCount .dup 2 .div 2 .mul .sub 1 .eq
}.cvx .def
(HeaderBox) {
IF oneSidedFormat THEN {
GetHeaders
} ELSE {
IF IsOddPage THEN {
GetRectoHeaders
} ELSE {
GetVersoHeaders
} FIELSE
} FIELSE
.fill
2 the headerMargin .vboxto
} .cvx .def
(GetHeaders) {
IF pageNumbering PageCount firstHeadersAfterPage .gt .and THEN {
(insideHeader) .getmark .fill (centerHeader) .getmark .fill GetPageCounter
5 GalleyWidth .hboxto
} ELSE {
.fill 1 GalleyWidth .hboxto
} FIELSE
} .cvx .def
(GetRectoHeaders) {
IF pageNumbering PageCount firstHeadersAfterPage .gt .and THEN {
(insideRectoHeader) .getmark .fill (centerRectoHeader) .getmark .fill GetPageCounter
5 GalleyWidth .hboxto
} ELSE {
.fill 1 GalleyWidth .hboxto
} FIELSE
} .cvx .def
(GetVersoHeaders) {
IF pageNumbering PageCount firstHeadersAfterPage .gt .and THEN {
GetPageCounter .fill (centerVersoHeader) .getmark .fill (insideVersoHeader) .getmark
5 GalleyWidth .hboxto
} ELSE {
(empty) .getmark .fill 2 GalleyWidth .hboxto
} FIELSE
} .cvx .def
(FooterBox) {
.fill
IF oneSidedFormat THEN {
GetFooters
} ELSE {
IF IsOddPage THEN {
GetRectoFooters
} ELSE {
GetVersoFooters
} FIELSE
} FIELSE
2 the footerMargin .vboxto
} .cvx .def
(GetFooters) {
IF pageNumbering PageCount firstHeadersAfterPage .gt .and THEN {
(insideFooter) .getmark .fill (centerFooter) .getmark .fill (outsideFooter) .getmark
5 GalleyWidth .hboxto
} ELSE {
(empty) .getmark .fill 2 GalleyWidth .hboxto
} FIELSE
} .cvx .def
(GetRectoFooters) {
IF pageNumbering PageCount firstHeadersAfterPage .gt .and THEN {
(insideRectoFooter) .getmark .fill (centerRectoFooter) .getmark .fill (outsideRectoFooter) .getmark
5 GalleyWidth .hboxto
} ELSE {
(empty) .getmark .fill 2 GalleyWidth .hboxto
} FIELSE
} .cvx .def
(GetVersoFooters) {
IF pageNumbering PageCount firstHeadersAfterPage .gt .and THEN {
(outsideVersoFooter) .getmark .fill (centerVersoFooter) .getmark .fill (insideVersoFooter) .getmark
5 GalleyWidth .hboxto
} ELSE {
(empty) .getmark .fill 2 GalleyWidth .hboxto
} FIELSE
} .cvx .def
EndStyle
% How to use the various boolean flags:
% pageNumbering: default .true => pages are numbered; set to .false if pages are NOT to be numbered
% firstPageNumber: number of the first page; can be established by setting Postfix property to (firstPageNumber) 0 .def, or in a Style.
% oneSidedFormat: default .true => pages have same headers and footers on each page; set to .false if alternating even/odd headers and footers are desired
% How to use header/footer mark properties:
% create a Tioga text node with header/footer text
% Set property Mark to have a value of the header or footer kind from one of the kinds: insideHeader, centerHeader, outsideHeader, insideRectoHeader, centerRectoHeader, outsideRectoHeader, insideVersoHeader, centerVersoHeader, outsideVersoHeader, insideFooter, centerFooter, outsideFooter, insideRectoFooter, centerRectoFooter, outsideRectoFooter, insideVersoFooter, centerVersoFooter, outsideVersoFooter (although the default style places the page number when outside*Header would go. Other kinds of marks are permissible but unless the layout JaM code is changed to reference them they will disappear into the void (thus spelling errors are not caught).
% Be cautious with long text for header/footers. The TSetter should not wedge or fault of course, but the results WILL NOT be pleasing with a high probability. Await TiogaII for this to go away.
% How to customize the header/footer layout schemes:
% There should be strong evidence of a pattern to the header/footer layout in existence.
% One-sided pages have the page number in the top-right corner (where outsideHeader would go), and all the other 5 parts of running head/feet coming from Mark properties.
% Two-sided pages have the page number in the top-outside corners (where outside*Header would go), and all the other 11 (count'em!) parts of running head/feet coming from Mark properties.
% GetPageCounter arranges to create a box containing the page number. Modify it to include standard text if you wish.
% For example, (Helvetica) 10 bp .textfont "Page " .textbox PageCount .cvs .textbox 2 .hbox
% in which the text "Page " has been added and the number of boxes increased from 1 to 2, will generate folios of the form "Page 1".