<> <> <> <> <> <> <> <> <> <<>> BeginStyle <> (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 <> (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 pageWidth the leftMargin .sub the rightMargin .sub the rightIndent .sub }.cvx .def <> (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 .cvi .cvs .textbox 1 .hbox }.cvx .def (IncrPage) { (PageCount) PageCount 1 .add .def }.cvx .def (IsOddPage) { < right (recto) page, even => left (verso) page>> PageCount .dup 2 .idiv 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 <<>> <<>> <> < pages are numbered; set to .false if pages are NOT to be numbered>> <> < pages have same headers and footers on each page; set to .false if alternating even/odd headers and footers are desired>> <> <> <> <> <> <> <> <> <> <> <>