|
|
1.1 root 1: % Copyright (c) 1989 Jan-Simon Pendry
2: % Copyright (c) 1989 Imperial College of Science, Technology & Medicine
3: % Copyright (c) 1989 The Regents of the University of California.
4: % All rights reserved.
5: %
6: % This code is derived from software contributed to Berkeley by
7: % Jan-Simon Pendry at Imperial College, London.
8: %
9: % Redistribution and use in source and binary forms are permitted provided
10: % that: (1) source distributions retain this entire copyright notice and
11: % comment, and (2) distributions including binaries display the following
12: % acknowledgement: ``This product includes software developed by the
13: % University of California, Berkeley and its contributors'' in the
14: % documentation or other materials provided with the distribution and in
15: % all advertising materials mentioning features or use of this software.
16: % Neither the name of the University nor the names of its contributors may
17: % be used to endorse or promote products derived from this software without
18: % specific prior written permission.
19: % THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
20: % WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
21: % MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22: %
23: % @(#)nh.doc 5.1 (Berkeley) 7/19/90
24: %
25: % Change page size parameters for A4 paper on LaserWriter,
26: % allowing for headers and footers. Define some new macros for headers
27: % and footers too.
28: %
29: % MJW 7 Jan 1987
30: %
31: % USAGE
32: %
33: % To enable this use \pagestyle{footers}.
34: % This also overrides automatically getting chapter titles in headers, but you
35: % could restore this by using \leftmark and \rightmark
36: % in your own headers and footers. These macros are set by \chaptermark (and
37: % possibly other things too). In one-sided printing all pages are right ones.
38: %
39: % One-Sided Printing
40: %
41: % \setheader{your header}
42: % \setfooter{your footer}
43: % \setchapterhead{header on first page of a chapter}
44: % \setchapterfoot{footer on first page of a chapter}
45: %
46: % Two-sided Printing
47: %
48: % \setbothheaders{the left one (even no. pages}{the right one (odd)}
49: % \setbothfooters{the left one}{the right one}
50: % \setchapterhead{header on first page of a chapter}
51: % \setchapterfoot{footer on first page of a chapter}
52: %
53: % Examples
54: %
55: % To get a page number use \thepage. Use \hfil to get centring etc.
56: % Example \setheader{A\hfil\thepage\hfil B}
57: % produces A at the extreme left of the page, the number in the middle
58: % and B at the extreme right.
59: %
60: % The following produces chapter title at top left, page number top right,
61: % with a line across the page underneath them,
62: % Project 1022(1041) bottom left, Task 19.1 bottom right.
63: % Except on the first page of a chapter when the heading is empty, and
64: % the footer is as before, but with the page number in the middle.
65: % \pagestyle{footers}
66: % \setheader{\vbox{\hbox to\hsize{\rightmark\hfil\thepage}\vskip 2pt\hrule}}
67: % \setfooter{Project 1022(1041)\hfil Task 19.1}
68: % \setchapterfoot{Project 1022(1041)\hfil\thepage \hfil Task 19.1}
69:
70: \oddsidemargin 16pt % MJW actually get 1/2 inch (=32pt) margin because
71: % of printer offset. was 1pt
72: \evensidemargin 16pt % was 1pt
73: \marginparwidth 30pt % these gain 53pt width
74: \topmargin 5pt % gains 26pt height (MJW was 16pt)
75: \headheight 14pt % gains 11pt height (MJW was 1pt)
76: \headsep 25pt % gains 24pt height (MJW was 1pt)
77: %\footheight 12 pt % cannot be changed as number must fit
78: \footskip 24pt % gains 6pt height
79: \textheight % 528 + 26 + 11 + 24 + 6 + 55 for luck -16 +32 (heads: -10 -15)
80: % 650pt
81: % 666pt
82: 641pt
83: \textwidth % 360 + 53 + 47 for luck -15 +8
84: 453pt
85: %\pagestyle{myheadings}
86: %\markboth{LEFT}{RIGHT}
87: %left = even, right = odd for two-sided
88: % everything is right for one-sided
89: \def\evenheadline{}\def\oddheadline{}
90: \def\evenfootline{}\def\oddfootline{}
91:
92: % Use these to set headers and footers for two-sided printing.
93: \def\setbothheaders#1#2{\def\evenheadline{#1}\def\oddheadline{#2}}
94: \def\setbothfooters#1#2{\def\evenfootline{#1}\def\oddfootline{#2}}
95:
96: % Use these for one-sided printing.
97: \def\setheader#1{\def\oddheadline{#1}}\def\setfooter#1{\def\oddfootline{#1}}
98:
99: % To set footer on first page of a chapter
100: \def\setchapterfoot#1{\def\chapterfoot{#1}}
101: \def\setchapterhead#1{\def\chapterhead{#1}}
102:
103: % Initialise footers to the page number.
104: \setbothfooters{\hfil\thepage\hfil}{\hfil\thepage\hfil}
105:
106: % Initialise chapter footer to page number, header empty.
107: \setchapterfoot{\hfil\thepage \hfil}
108: \setchapterhead{}
109:
110: % My version of \chapter
111: \def\chapter{\clearpage % Starts new page.
112: % \if@twoside \cleardoublepage
113: % \else\clearpage\fi % Starts new page.
114: \thispagestyle{chapterpage} % Page style of chapter page is 'chapterpage'
115: \global\@topnum\z@ % Prevents figures from going at top of page.
116: \@afterindentfalse % Suppresses indent in first paragraph. Change
117: \secdef\@chapter\@schapter} % to \@afterindenttrue to have indent.
118:
119: % Style for first page of a chapter
120: \def\ps@chapterpage{\let\@mkboth\markboth
121: \def\@evenhead{\chapterhead}\def\@oddhead{\chapterhead}
122: \def\@evenfoot{\chapterfoot}\def\@oddfoot{\chapterfoot}}
123:
124: % Style for headers AND footers.
125: \if@twoside % If two-sided printing.
126: \def\ps@footers{\let\@mkboth\markboth
127: \def\@evenhead{\evenheadline}\def\@oddhead{\oddheadline}
128: \def\@evenfoot{\evenfootline}\def\@oddfoot{\oddfootline}
129: % Chapter stuff
130: \def\chaptermark##1{\markboth{\uppercase{\ifnum \c@secnumdepth >\m@ne
131: \@chapapp\ \thechapter. \ \fi ##1}}{}}
132: \def\sectionmark##1{\markright{\uppercase{\ifnum \c@secnumdepth >\z@
133: \thesection. \ \fi ##1}}}
134: }
135: \else % If one-sided printing.
136: \def\ps@footers{\let\@mkboth\markboth
137: \def\@evenhead{\evenheadline}\def\@oddhead{\oddheadline}
138: \def\@evenfoot{\evenfootline}\def\@oddfoot{\oddfootline}
139: % Chapter stuff
140: \def\chaptermark##1{\markright{\uppercase{\ifnum \c@secnumdepth >\m@ne
141: \@chapapp\ \thechapter. \ \fi ##1}}}
142: }
143: \fi
144:
145: % Debugging stuff.
146: %\let\markbothorig\markboth
147: %\def\markboth#1#2{\typeout{---Markboth: \#1=#1, \#2=#2\newline}
148: % \markbothorig {#1} {#2}}
149: %
150: %\let\markrightorig\markright
151: %\def\markright#1{\typeout{---Markright: \#1=#1\newline}
152: % \markrightorig {#1}}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.