summaryrefslogtreecommitdiff
path: root/macros/latex-dev/base/ltpage.dtx
blob: 8c7aac0a7b86f8df7d46325d30e5fc001aba9ce8 (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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
% \iffalse meta-comment
%
% Copyright (C) 1993-2020
% The LaTeX3 Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the LaTeX base system.
% -------------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%    https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
% This file has the LPPL maintenance status "maintained".
%
% The list of all files belonging to the LaTeX base distribution is
% given in the file `manifest.txt'. See also `legal.txt' for additional
% information.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
%
% \fi
%
% \iffalse
%%% From File: ltpage.dtx
%
%<*driver>
% \fi
\ProvidesFile{ltpage.dtx}
             [2020/07/27 v1.0m LaTeX Kernel (page style setup)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltpage.dtx}
\title{\filename}
\date{\filedate}
 \author{%
  Johannes Braams\and
  David Carlisle\and
  Alan Jeffrey\and
  Leslie Lamport\and
  Frank Mittelbach\and
  Chris Rowley\and
  Rainer Sch\"opf}

\begin{document}
 \MaintainedByLaTeXTeam{latex}
 \maketitle
 \DocInput{\filename}
\end{document}
%</driver>
% \fi
%
%
% \section{Page styles and related commands}
%
%
% \changes{v1.0a}{1994/03/07}{Initial version, split from ltherest.dtx}
% \changes{v1.0b}{1994/04/19}{Improve documentation}
% \changes{v1.0i}{1996/04/18}{Improve documentation}
% \changes{v1.0l}{2019/08/27}{Make various commands robust}
%
%
% \subsection{Page Style Commands}
%
%  |\pagestyle|\marg{style} : sets the page style of the
%  current and succeeding  pages to \emph{style}
%
%  |\thispagestyle|\marg{style} : sets the page style of the
%  current page only to \emph{style}.
%
%  To define a page style \emph{style}, you must define
%  |\ps@|\emph{style} to set the page style parameters.
%
% \subsection{How a page style makes running heads and feet}
%
% The |\ps@|\ldots command defines the macros |\@oddhead|, |\@oddfoot|,
% |\@evenhead|, and |\@evenfoot| to define the running heads and feet.
% (See output routine.)  To make headings determined by the sectioning
% commands, the page style defines the commands |\chaptermark|,
% |\sectionmark|, etc., where |\chaptermark|\marg{text} is called by
% |\chapter| to set a mark.  The |\...mark| commands and the |\...head|
% macros are defined  with the help of the following macros.
%
% (All the |\...mark| commands should be initialized to no-ops.)
%
% \subsection{marking conventions}
%
% \LaTeX\ extends \TeX's |\mark| facility by producing two kinds of marks
% a `left' and a `right' mark, using the following commands:\\
%     |\markboth|\marg{left}\marg{right} : Adds both marks.\\
%     |\markright|\marg{right}      : Adds a 'right' mark.\\
%     |\leftmark| :
%        Used in the output routine, gets the current `left'  mark.
%        Works like \TeX's |\botmark.|\\
%     |\rightmark| :
%        Used in the output routine, gets the current `right' mark.
%        Works like \TeX's |\firstmark|.
% The marking commands work reasonably well for right marks `numbered
% within' left marks---e.g., the left mark is changed by a |\chapter|
% command and the right mark is changed by a |\section| command.
% However, it does produce somewhat anomalous results if 2 |\markboth|'s
% occur on the same page.
%
% Commands like |\tableofcontents| that should set the marks in some
% page styles use a |\@mkboth| command, which is |\let| by the pagestyle
% command (|\ps@...|) to |\markboth| for setting the heading or to
% |\@gobbletwo| to do nothing.
%
% \StopEventually{}
%
%    \begin{macrocode}
%<*2ekernel>
%    \end{macrocode}
%
% \begin{macro}{\pagestyle}
% User command to set the page style for this and following pages.
% \changes{LaTeX2e}{1994/01/24}
%         {(DPC) Complain if pagestyle is undefined.}
% \changes{LaTeX2e}{1994/02/01}
%         {(DPC) Modify to get nicer error message}
%    \begin{macrocode}
\def\pagestyle#1{%
  \@ifundefined{ps@#1}%
    \undefinedpagestyle
    {\@nameuse{ps@#1}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\thispagestyle}
% User command to set the page style for this page only.
% \changes{LaTeX2e}{1994/02/01}
%         {(DPC) Modify to get nicer error message}
%    \begin{macrocode}
\def\thispagestyle#1{%
  \@ifundefined{ps@#1}%
    \undefinedpagestyle
    {\global\@specialpagetrue\gdef\@specialstyle{#1}}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ps@empty}
% The empty page style: No head or foot line.
%    \begin{macrocode}
\def\ps@empty{%
  \let\@mkboth\@gobbletwo\let\@oddhead\@empty\let\@oddfoot\@empty
  \let\@evenhead\@empty\let\@evenfoot\@empty}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ps@plain}
% \changes{v1.0g}{1995/05/26}{removed \cs{rmfamily} (PR 1578)}
% The plain page style: No head, centred page number in foot.
%    \begin{macrocode}
\def\ps@plain{\let\@mkboth\@gobbletwo
     \let\@oddhead\@empty\def\@oddfoot{\reset@font\hfil\thepage
     \hfil}\let\@evenhead\@empty\let\@evenfoot\@oddfoot}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@leftmark}
% \begin{macro}{\@rightmark}
%    We implement |\@leftmark| and |\@rightmark| in terms of already
%    defined commands to save token space. We can't get rid of them
%    since they are sometimes used in applications.
%    \begin{macrocode}
\let\@leftmark\@firstoftwo
\let\@rightmark\@secondoftwo
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2019/10/01}%
%<latexrelease>                 {\markboth}{Make commands robust}%
%    \end{macrocode}
%
% \begin{macro}{\markboth}
% \begin{macro}{\markright}
% \changes{v1.0d}{1994/05/20}{Changed setting for \cs{protect}.}
% \changes{v1.0e}{1994/11/04}{Added \cs{@unexpandable@protect}.
%    ASAJ.}
%
% User commands for setting \LaTeX\ marks.
%
% Test for |\@nobreak| added 15 Apr 86 in |\markboth| and |\markright|
% letting |\label| and |\index| to |\relax| added 22 Feb 86 so these
%   commands can appear in sectioning command arguments
% RmS 91/06/21 Same for |\glossary|
% \changes{v1.0k}{2000/06/02}{Tidied 1.0j reimplementation, CAR}
% \changes{v1.0k}{2000/06/02}{Small adjustment to give slightly less
%    expansion, CAR}
% \changes{v1.0j}{2000/05/26}{Reimplementation to fix expansion
%                             error (pr/3203).}
% \changes{v1.0m}{2020/07/27}{Don't make the command \cs{long} (gh/354)}
%    \begin{macrocode}
\DeclareRobustCommand*\markboth[2]{%
  \begingroup
    \let\label\relax \let\index\relax \let\glossary\relax
    \unrestored@protected@xdef\@themark {{#1}{#2}}%
    \@temptokena \expandafter{\@themark}%
    \mark{\the\@temptokena}%
  \endgroup
  \if@nobreak\ifvmode\nobreak\fi\fi}
%    \end{macrocode}
%
% \changes{v1.0m}{2020/07/27}{Don't make the command \cs{long} (gh/354)}
%    \begin{macrocode}
\DeclareRobustCommand*\markright[1]{%
  \begingroup
    \let\label\relax \let\index\relax \let\glossary\relax
%    \end{macrocode}
%    Protection is handled inside |\@markright|.
%    \begin{macrocode}
    \expandafter\@markright\@themark {#1}%
    \@temptokena \expandafter{\@themark}%
    \mark{\the\@temptokena}%
  \endgroup
  \if@nobreak\ifvmode\nobreak\fi\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\markboth}{Make commands robust}%
%<latexrelease>
%<latexrelease>\kernel@make@fragile\markboth
%<latexrelease>\kernel@make@fragile\markright
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%
%
%
%
% \begin{macro}{\@markright}
% \changes{v1.0j}{2000/05/26}{Reimplementation to fix expansion
%                             error (pr/3203).}
% \changes{v1.0k}{2000/06/02}{Small adjustment to give slightly less
%    expansion, CAR}
% \begin{macro}{\leftmark}
% \changes{v1.0j}{2000/05/26}{Use \cs{@empty} instead of brace group
%                             (pr/3203).}
% \begin{macro}{\rightmark}
% \changes{LaTeX2e}{1993/12/17}{Stopgap solution to mark \cs{leftmark}
%      and \cs{rightmark} work without initializing mark until
%      the problem is solved.}
% \changes{v1.0j}{2000/05/26}{Use \cs{@empty} instead of brace group
%                             (pr/3203).}
% \task{???}{mark initialisation solved?}
%    \begin{macrocode}
\def\@markright#1#2#3{\@temptokena {#1}%
  \unrestored@protected@xdef\@themark{{\the\@temptokena}{#3}}}
\def\leftmark{\expandafter\@leftmark\botmark\@empty\@empty}
\def\rightmark{\expandafter\@rightmark\firstmark\@empty\@empty}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\@themark}
% Initialise \LaTeX's marks without setting a \TeX\ mark \meta{whatsit}.
%    \begin{macrocode}
\def\@themark{{}{}}
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\mark}
%   Test versions of \LaTeXe\ initialised \TeX's |\mark| system
%  at this point, but this was removed before the first release.
% \changes{LaTeX2e}{1993/12/16}{Init \cs{mark} at begin document}
% \changes{LaTeX2e}{1993/12/17}{Removed init \cs{mark} at begin
%                   document, since it doesn't work.}
%\begin{verbatim}
%\AtBeginDocument{\mark{{}{}}}
%\end{verbatim}
%  \end{macro}
%
%
% \begin{macro}{\raggedbottom}
%  |\raggedbottom| typesets pages with no vertical stretch, so they have
%                  their natural height instead of all being exactly the
%                  same height.  (Uses a space of .0001fil to avoid
%                  interfering with the 1fil space of |\newpage|.)
%
%    \begin{macrocode}
\DeclareRobustCommand\raggedbottom{%
  \def\@textbottom{\vskip \z@ \@plus.0001fil}\let\@texttop\relax}
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\flushbottom}
% |\flushbottom|:
% Inverse of |\raggedbottom| --- makes all pages the same height.
%    \begin{macrocode}
\DeclareRobustCommand\flushbottom{%
  \let\@textbottom\relax \let\@texttop\relax}
%    \end{macrocode}
%  \end{macro}
%
%
% \begin{macro}{\sloppy}
%  |\sloppy| will never (well, hardly ever) produce overfull boxes, but
%  may produce underfull ones.  (14 June 85)
% \changes{LaTeX2e}{1993/12/18}{Added \cs{emergencystretch}}
% \changes{v1.0h}{1994/07/20}{Save a few tokens}
%    \begin{macrocode}
\DeclareRobustCommand\sloppy{%
  \tolerance 9999%
  \emergencystretch 3em%
  \hfuzz .5\p@
  \vfuzz\hfuzz}
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{sloppypar}
%  A sloppypar environment is equivalent to |{\par \sloppy ... \par}|.
%    \begin{macrocode}
\def\sloppypar{\par\sloppy}
\def\endsloppypar{\par}
%    \end{macrocode}
%  \end{environment}
%
% \begin{macro}{\fussy}
% \changes{v1.0f}{1995/04/24}{reset \cs{emergencystretch} latex/1344}
%  Resets \TeX's parameters to their normal finicky values.
%    \begin{macrocode}
\DeclareRobustCommand\fussy{%
  \emergencystretch\z@
  \tolerance 200%
  \hfuzz .1\p@
  \vfuzz\hfuzz}
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\overfullrule}
% \LaTeX\ default is no overfull box rule.  Changed by document
% class option.
%    \begin{macrocode}
\overfullrule 0pt
%    \end{macrocode}
%  \end{macro}
%
%    \begin{macrocode}
%</2ekernel>
%    \end{macrocode}
%
% \Finale
%