summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/pageno/pageno.dtx
blob: 17a34e6d32e6c869d9a36ea56d268c77b02eb30d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
% \iffalse
% File pageno.dtx
% inspired by Axel Sommerfeldt's rplain.sty
% Copyright Rowland McDonnell 1996
% Some code copyright Axel Sommerfeldt
% email: rebecca@astrid.u-net.com
% 
% See the section on copying below for restrictions.
% 
%\fi
%
%\iffalse
%<*driver>
\documentclass[a4paper]{ltxdoc}
\begin{document}
 \DocInput{pageno.dtx}
\end{document}
%</driver>
%\fi
%\iffalse
%<*package>
%\fi
%%
%% \CheckSum{189}
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%
%
%\iffalse
% Some useful bits
%\fi
% \newcommand*{\bs}{\char'134}
% \DeclareRobustCommand*{\packname}[1]{\textsf{#1}}
% \DeclareRobustCommand*{\comname}[1]{{\ttfamily\makeatletter\bs #1\makeatother}}
% \newcommand*{\optname}[1]{{\ttfamily #1}}
% \newcommand*{\filename}[1]{{\ttfamily #1}}
% 
% \title{The \packname{pageno} package}
% \date{Version 1.2, 22nd September 1998}
% \author{ Rowland McDonnell,\\ after Axel Sommerfeldt}
% \maketitle
% \tableofcontents
%
% \section{Introduction}
% 
% The \packname{pageno} package can change the place that page 
% numbers are printed on the page.  By page numbers, I mean `folios': 
% the numbers printed on a page to say which page it is.
% 
% This job is done by re-defining the \texttt{plain} page style; you 
% control where the page numbers are printed by passing options to the 
% \packname{pageno} package. You can have page numbers at the top or 
% bottom of the page; in the inside corner, outside corner, or in the 
% middle.
% 
% The advantage of this way of doing things over the \packname{fancyhdr} 
% package is that you don't have to worry about your new page style 
% being `lost' because some part of \LaTeX{} has switched to the 
% \texttt{plain} page style, and of course there are no new commands to 
% learn.  The disadvantage is that it's a very simple-minded package: 
% any package that re-defines the \texttt{plain} page style is likely 
% to conflict in some way with \packname{pageno}.  In such cases, the 
% \packname{fancyhdr} package might well help.
% 
% If you want more control over headers and footers, or if you don't 
% want to re-define the \texttt{plain} page style, try the 
% \packname{fancyhdr} package.
%
% The \packname{pageno} package was inspired by Axel Sommerfeldt's 
% \packname{rplain} package, which redefines the \texttt{plain} page 
% style to put page numbers in the bottom outside corner.
%
% \section{How to use the package}
% 
% It's all done with options:
% \begin{verbatim}
% \documentclass{article}
% \usepackage[insidefoot]{pageno}
% \begin{document}
% ...
%\end{verbatim}
% will re-define the \texttt{plain} page style so that page numbers will 
% be printed in the bottom inside corner. If you don't give the 
% \packname{pageno} package an option, it won't change the 
% \texttt{plain} page style.  If you give \packname{pageno} more than 
% one option, the last one specified will be the one that's used.
% 
% Whatever else \packname{pageno} does, it will switch to the 
% \texttt{plain} page style when its finished.
% 
% The full list of options is this:
%\DeleteShortVerb{\|}
% \begin{center}
% \begin{tabular}{l|l}
% Option                & Page number position \\ \hline
% \optname{centerfoot}  &  Centre bottom  \\
% \optname{outsidefoot} &  Outside bottom \\
% \optname{insidefoot}  &  Inside bottom  \\
% \optname{centrehead}  &  Centre top     \\
% \optname{outsidehead} &  Outside top    \\
% \optname{insidehead}  &  Inside top     \\
% \end{tabular}
% \end{center}
% \MakeShortVerb{\|}
% You can say \optname{centrefoot} and \optname{centrehead} instead 
% of \optname{centerfoot} and \optname{centerhead} if you like.
% 
% The \optname{centerfoot} option really does re-define the 
% \texttt{plain} pagestyle, but it's redundant because the result is 
% the same as the default definition.
%
% If you use this package, or decide not to, I'd very much appreciate it 
% if you would send me a message saying why. Suggestions for 
% improvements and reports of bugs are of course most welcome. 
% \verb|rebecca@astrid.u-net.com| is my email address.
% 
% \section{A typographical note}
% 
% There is a point to labeling each page in a document with a page 
% number: it's so the reader can refer to it.  In a conventional book, 
% the best place for the page number is on one of the outside edges: 
% that way, a reader can flip through the book and find a page easily.  
% If the page numbers are on an inside edge, it's very difficult to 
% read them without fully opening the book on each page.
%
% \section{Copying and stuff}
%
% If you want to give the \packname{pageno} package to someone, please 
% give them the unchanged files \filename{pageno.dtx} and 
% \filename{pageno.ins}. Anyone may make as many copies of these files 
% as they like and give them to anyone. You're not allowed to charge 
% money for distributing this package, except for a nominal fee to cover 
% costs, although I'm happy for non-profit organizations like the TeX 
% Users' Group to include and sell this on CD-ROMs and the like 
% containing selections of code from CTAN.
%
% If you want to change this package, please make a copy of the package 
% file, and change the name, file identification commands, and comments 
% to identify it as being your responsibility now, not mine.
% 
% \StopEventually
%
%\iffalse
% 1998/09/22 v1.3 Re-wrote some documentation with the aim of 
%     uploading it to CTAN
% 1996/11/01 v1.2 It looks ready now
%\fi
% \section{The code itself}
%
% Who am I, and what do I need?  This package will probably work with 
% any version of \LaTeXe, but I've only tested it with the June 1996 
% release.
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1996/06/01]
\ProvidesPackage{pageno}[1996/11/01 v1.2
	pagenumbers package (RJMM, after AS)]
%    \end{macrocode}
%
% \subsection{Declare and process the options}
%
% There's not much to be said, really.  The \optname{centrefoot} option 
% duplicates the effect of the standard definition of 
% \comname{ps@plain}---this is the macro that is executed to define the 
% \texttt{plain} page style.  The other options are variations on the 
% same theme.  Axel Sommerfeldt did the original re-definition; I copied 
% him.  The original \LaTeX{} code looks like this:
% \begin{verbatim}
% \def\ps@plain{\let\@mkboth\@gobbletwo
%      \let\@oddhead\@empty\def\@oddfoot{\reset@font\hfil\thepage
%      \hfil}\let\@evenhead\@empty\let\@evenfoot\@oddfoot}
%\end{verbatim}
%
% The redefinitions here might be a little less efficient than the 
% standard code, but I doubt that matters.
%
%    \begin{macrocode}
\DeclareOption{centrefoot}{%
	\renewcommand{\ps@plain}{%
	   \renewcommand{\@mkboth}{\@gobbletwo}%
	   \renewcommand{\@oddhead}{}%
	   \renewcommand{\@evenhead}{}%
	   \renewcommand{\@evenfoot}{\reset@font\rmfamily\hfil\thepage\hfil}%
	   \renewcommand{\@oddfoot}{\reset@font\rmfamily\hfil\thepage\hfil}}
	}
	
\DeclareOption{centerfoot}{%
	\renewcommand{\ps@plain}{%
	   \renewcommand{\@mkboth}{\@gobbletwo}%
	   \renewcommand{\@oddhead}{}%
	   \renewcommand{\@evenhead}{}%
	   \renewcommand{\@evenfoot}{\reset@font\rmfamily\hfil\thepage\hfil}%
	   \renewcommand{\@oddfoot}{\reset@font\rmfamily\hfil\thepage\hfil}}
	}

\DeclareOption{outsidefoot}{%
	\renewcommand{\ps@plain}{%
	   \renewcommand{\@mkboth}{\@gobbletwo}%
	   \renewcommand{\@oddhead}{}%
	   \renewcommand{\@evenhead}{}%
	   \renewcommand{\@evenfoot}{\reset@font\rmfamily\thepage\hfil}%
	   \renewcommand{\@oddfoot}{\reset@font\rmfamily\hfil\thepage}}
	}

\DeclareOption{insidefoot}{%
	\renewcommand{\ps@plain}{%
	   \renewcommand{\@mkboth}{\@gobbletwo}%
	   \renewcommand{\@oddhead}{}%
	   \renewcommand{\@evenhead}{}%
	   \renewcommand{\@evenfoot}{\reset@font\rmfamily\hfil\thepage}%
	   \renewcommand{\@oddfoot}{\reset@font\rmfamily\thepage\hfil}}
	}

\DeclareOption{centrehead}{%
	\renewcommand{\ps@plain}{%
	   \renewcommand{\@mkboth}{\@gobbletwo}%
	   \renewcommand{\@evenhead}{\reset@font\rmfamily\hfil\thepage\hfil}%
	   \renewcommand{\@oddhead}{\reset@font\rmfamily\hfil\thepage\hfil}%
	   \renewcommand{\@evenfoot}{}%
	   \renewcommand{\@oddfoot}{}}
	}

\DeclareOption{centerhead}{%
	\renewcommand{\ps@plain}{%
	   \renewcommand{\@mkboth}{\@gobbletwo}%
	   \renewcommand{\@evenhead}{\reset@font\rmfamily\hfil\thepage\hfil}%
	   \renewcommand{\@oddhead}{\reset@font\rmfamily\hfil\thepage\hfil}%
	   \renewcommand{\@evenfoot}{}%
	   \renewcommand{\@oddfoot}{}}
	}

\DeclareOption{outsidehead}{%
	\renewcommand{\ps@plain}{%
	   \renewcommand{\@mkboth}{\@gobbletwo}%
	   \renewcommand{\@evenhead}{\reset@font\rmfamily\thepage\hfil}%
	   \renewcommand{\@oddhead}{\reset@font\rmfamily\hfil\thepage}%
	   \renewcommand{\@evenfoot}{}%
	   \renewcommand{\@oddfoot}{}}
	}

\DeclareOption{insidehead}{%
	\renewcommand{\ps@plain}{%
	   \renewcommand{\@mkboth}{\@gobbletwo}%
	   \renewcommand{\@evenhead}{\reset@font\rmfamily\hfil\thepage}%
	   \renewcommand{\@oddhead}{\reset@font\rmfamily\thepage\hfil}%
	   \renewcommand{\@evenfoot}{}%
	   \renewcommand{\@oddfoot}{}}
	}

\ProcessOptions*
%    \end{macrocode}
%
% \subsection{Select the \texttt{plain} page style and finish}
%
%    \begin{macrocode}
\pagestyle{plain}
\endinput
%    \end{macrocode}
%
% \Finale
%\iffalse
%<*package>
%% 
%% End of file `pageno.dtx'.\fi