1 % \iffalse meta-comment
4 % The LaTeX3 Project and any individual authors listed elsewhere
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 % http://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2005/12/01 or later.
18 % This file has the LPPL maintenance status "maintained".
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
24 % The list of derived (unpacked) files belonging to the distribution
25 % and covered by LPPL is defined by the unpacking scripts (with
26 % extension .ins) which are part of the distribution.
31 %%% From File: ltpage.dtx
35 \ProvidesFile{ltpage.dtx}
36 [2000/06/02 v1.0k LaTeX Kernel (page style setup)]
38 \documentclass{ltxdoc}
39 \GetFileInfo{ltpage.dtx}
52 \MaintainedByLaTeXTeam{latex}
61 % \section{Page styles and related commands}
64 % \changes{v1.0a}{1994/03/07}{Initial version, split from ltherest.dtx}
65 % \changes{v1.0b}{1994/04/19}{Improve documentation}
66 % \changes{v1.0i}{1996/04/18}{Improve documentation}
69 % \subsection{Page Style Commands}
71 % |\pagestyle|\marg{style} : sets the page style of the
72 % current and succeeding pages to \emph{style}
74 % |\thispagestyle|\marg{style} : sets the page style of the
75 % current page only to \emph{style}.
77 % To define a page style \emph{style}, you must define
78 % |\ps@|\emph{style} to set the page style parameters.
80 % \subsection{How a page style makes running heads and feet}
82 % The |\ps@|\ldots command defines the macros |\@oddhead|, |\@oddfoot|,
83 % |\@evenhead|, and |\@evenfoot| to define the running heads and feet.
84 % (See output routine.) To make headings determined by the sectioning
85 % commands, the page style defines the commands |\chaptermark|,
86 % |\sectionmark|, etc., where |\chaptermark|\marg{text} is called by
87 % |\chapter| to set a mark. The |\...mark| commands and the |\...head|
88 % macros are defined with the help of the following macros.
90 % (All the |\...mark| commands should be initialized to no-ops.)
92 % \subsection{marking conventions}
94 % \LaTeX\ extends \TeX's |\mark| facility by producing two kinds of marks
95 % a `left' and a `right' mark, using the following commands:\\
96 % |\markboth|\marg{left}\marg{right} : Adds both marks.\\
97 % |\markright|\marg{right} : Adds a 'right' mark.\\
99 % Used in the output routine, gets the current `left' mark.
100 % Works like \TeX's |\botmark.|\\
102 % Used in the output routine, gets the current `right' mark.
103 % Works like \TeX's |\firstmark|.
104 % The marking commands work reasonably well for right marks `numbered
105 % within' left marks---e.g., the left mark is changed by a |\chapter|
106 % command and the right mark is changed by a |\section| command.
107 % However, it does produce somewhat anomalous results if 2 |\markboth|'s
108 % occur on the same page.
110 % Commands like |\tableofcontents| that should set the marks in some
111 % page styles use a |\@mkboth| command, which is |\let| by the pagestyle
112 % command (|\ps@...|) to |\markboth| for setting the heading or to
113 % |\@gobbletwo| to do nothing.
121 % \begin{macro}{\pagestyle}
122 % User command to set the page style for this and following pages.
123 % \changes{LaTeX2e}{1994/01/24}
124 % {(DPC) Complain if pagestyle is undefined.}
125 % \changes{LaTeX2e}{1994/02/01}
126 % {(DPC) Modify to get nicer error message}
129 \@ifundefined{ps@#1}%
135 % \begin{macro}{\thispagestyle}
136 % User command to set the page style for this page only.
137 % \changes{LaTeX2e}{1994/02/01}
138 % {(DPC) Modify to get nicer error message}
140 \def\thispagestyle#1{%
141 \@ifundefined{ps@#1}%
143 {\global\@specialpagetrue\gdef\@specialstyle{#1}}}
148 % \begin{macro}{\ps@empty}
149 % The empty page style: No head or foot line.
152 \let\@mkboth\@gobbletwo\let\@oddhead\@empty\let\@oddfoot\@empty
153 \let\@evenhead\@empty\let\@evenfoot\@empty}
157 % \begin{macro}{\ps@plain}
158 % \changes{v1.0g}{1995/05/26}{removed \cs{rmfamily} (PR 1578)}
159 % The plain page style: No head, centred page number in foot.
161 \def\ps@plain{\let\@mkboth\@gobbletwo
162 \let\@oddhead\@empty\def\@oddfoot{\reset@font\hfil\thepage
163 \hfil}\let\@evenhead\@empty\let\@evenfoot\@oddfoot}
167 % \begin{macro}{\@leftmark}
168 % \begin{macro}{\@rightmark}
169 % We implement |\@leftmark| and |\@rightmark| in terms of already
170 % defined commands to save token space. We can't get rid of them
171 % since they are sometimes used in applications.
173 \let\@leftmark\@firstoftwo
174 \let\@rightmark\@secondoftwo
179 % \begin{macro}{\markboth}
180 % \begin{macro}{\markright}
181 % \changes{v1.0d}{1994/05/20}{Changed setting for \cs{protect}.}
182 % \changes{v1.0e}{1994/11/04}{Added \cs{@unexpandable@protect}.
185 % User commands for setting \LaTeX\ marks.
187 % Test for |\@nobreak| added 15 Apr 86 in |\markboth| and |\markright|
188 % letting |\label| and |\index| to |\relax| added 22 Feb 86 so these
189 % commands can appear in sectioning command arguments
190 % RmS 91/06/21 Same for |\glossary|
191 % \changes{v1.0k}{2000/06/02}{Tidied 1.0j reimplementation, CAR}
192 % \changes{v1.0k}{2000/06/02}{Small adjustment to give slightly less
194 % \changes{v1.0j}{2000/05/26}{Reimplementation to fix expansion
199 \let\label\relax \let\index\relax \let\glossary\relax
200 \unrestored@protected@xdef\@themark {{#1}{#2}}%
201 \@temptokena \expandafter{\@themark}%
202 \mark{\the\@temptokena}%
204 \if@nobreak\ifvmode\nobreak\fi\fi}
207 \let\label\relax \let\index\relax \let\glossary\relax
209 % Protection is handled inside |\@markright|.
211 \expandafter\@markright\@themark {#1}%
212 \@temptokena \expandafter{\@themark}%
213 \mark{\the\@temptokena}%
215 \if@nobreak\ifvmode\nobreak\fi\fi}
221 % \begin{macro}{\@markright}
222 % \changes{v1.0j}{2000/05/26}{Reimplementation to fix expansion
224 % \changes{v1.0k}{2000/06/02}{Small adjustment to give slightly less
226 % \begin{macro}{\leftmark}
227 % \changes{v1.0j}{2000/05/26}{Use \cs{@empty} instead of brace group
229 % \begin{macro}{\rightmark}
230 % \changes{LaTeX2e}{1993/12/17}{Stopgap solution to mark \cs{leftmark}
231 % and \cs{rightmark} work without initializing mark until
232 % the problem is solved.}
233 % \changes{v1.0j}{2000/05/26}{Use \cs{@empty} instead of brace group
235 % \task{???}{mark initialisation solved?}
237 \def\@markright#1#2#3{\@temptokena {#1}%
238 \unrestored@protected@xdef\@themark{{\the\@temptokena}{#3}}}
239 \def\leftmark{\expandafter\@leftmark\botmark\@empty\@empty}
240 \def\rightmark{\expandafter\@rightmark\firstmark\@empty\@empty}
247 % \begin{macro}{\@themark}
248 % Initialise \LaTeX's marks without setting a \TeX\ mark \meta{whatsit}.
254 % \begin{macro}{\mark}
255 % Test versions of \LaTeXe\ initialised \TeX's |\mark| system
256 % at this point, but this was removed before the first release.
257 % \changes{LaTeX2e}{1993/12/16}{Init \cs{mark} at begin document}
258 % \changes{LaTeX2e}{1993/12/17}{Removed init \cs{mark} at begin
259 % document, since it doesn't work.}
261 %\AtBeginDocument{\mark{{}{}}}
266 % \begin{macro}{\raggedbottom}
267 % |\raggedbottom| typesets pages with no vertical stretch, so they have
268 % their natural height instead of all being exactly the
269 % same height. (Uses a space of .0001fil to avoid
270 % interfering with the 1fil space of |\newpage|.)
274 \def\@textbottom{\vskip \z@ \@plus.0001fil}\let\@texttop\relax}
278 % \begin{macro}{\flushbottom}
280 % Inverse of |\raggedbottom| --- makes all pages the same height.
283 \let\@textbottom\relax \let\@texttop\relax}
288 % \begin{macro}{\sloppy}
289 % |\sloppy| will never (well, hardly ever) produce overfull boxes, but
290 % may produce underfull ones. (14 June 85)
291 % \changes{LaTeX2e}{1993/12/18}{Added \cs{emergencystretch}}
292 % \changes{v1.0h}{1994/07/20}{Save a few tokens}
296 \emergencystretch 3em%
302 % \begin{environment}{sloppypar}
303 % A sloppypar environment is equivalent to |{\par \sloppy ... \par}|.
305 \def\sloppypar{\par\sloppy}
306 \def\endsloppypar{\par}
310 % \begin{macro}{\fussy}
311 % \changes{v1.0f}{1995/04/24}{reset \cs{emergencystretch} latex/1344}
312 % Resets \TeX's parameters to their normal finicky values.
322 % \begin{macro}{\overfullrule}
323 % \LaTeX\ default is no overfull box rule. Changed by document