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}
60 % \section{Page styles and related commands}
63 % \changes{v1.0a}{1994/03/07}{Initial version, split from ltherest.dtx}
64 % \changes{v1.0b}{1994/04/19}{Improve documentation}
65 % \changes{v1.0i}{1996/04/18}{Improve documentation}
68 % \subsection{Page Style Commands}
70 % |\pagestyle|\marg{style} : sets the page style of the
71 % current and succeeding pages to \emph{style}
73 % |\thispagestyle|\marg{style} : sets the page style of the
74 % current page only to \emph{style}.
76 % To define a page style \emph{style}, you must define
77 % |\ps@|\emph{style} to set the page style parameters.
79 % \subsection{How a page style makes running heads and feet}
81 % The |\ps@|\ldots command defines the macros |\@oddhead|, |\@oddfoot|,
82 % |\@evenhead|, and |\@evenfoot| to define the running heads and feet.
83 % (See output routine.) To make headings determined by the sectioning
84 % commands, the page style defines the commands |\chaptermark|,
85 % |\sectionmark|, etc., where |\chaptermark|\marg{text} is called by
86 % |\chapter| to set a mark. The |\...mark| commands and the |\...head|
87 % macros are defined with the help of the following macros.
89 % (All the |\...mark| commands should be initialized to no-ops.)
91 % \subsection{marking conventions}
93 % \LaTeX\ extends \TeX's |\mark| facility by producing two kinds of marks
94 % a `left' and a `right' mark, using the following commands:\\
95 % |\markboth|\marg{left}\marg{right} : Adds both marks.\\
96 % |\markright|\marg{right} : Adds a 'right' mark.\\
98 % Used in the output routine, gets the current `left' mark.
99 % Works like \TeX's |\botmark.|\\
101 % Used in the output routine, gets the current `right' mark.
102 % Works like \TeX's |\firstmark|.
103 % The marking commands work reasonably well for right marks `numbered
104 % within' left marks---e.g., the left mark is changed by a |\chapter|
105 % command and the right mark is changed by a |\section| command.
106 % However, it does produce somewhat anomalous results if 2 |\markboth|'s
107 % occur on the same page.
109 % Commands like |\tableofcontents| that should set the marks in some
110 % page styles use a |\@mkboth| command, which is |\let| by the pagestyle
111 % command (|\ps@...|) to |\markboth| for setting the heading or to
112 % |\@gobbletwo| to do nothing.
120 % \begin{macro}{\pagestyle}
121 % User command to set the page style for this and following pages.
122 % \changes{LaTeX2e}{1994/01/24}
123 % {(DPC) Complain if pagestyle is undefined.}
124 % \changes{LaTeX2e}{1994/02/01}
125 % {(DPC) Modify to get nicer error message}
128 \@ifundefined{ps@#1}%
134 % \begin{macro}{\thispagestyle}
135 % User command to set the page style for this page only.
136 % \changes{LaTeX2e}{1994/02/01}
137 % {(DPC) Modify to get nicer error message}
139 \def\thispagestyle#1{%
140 \@ifundefined{ps@#1}%
142 {\global\@specialpagetrue\gdef\@specialstyle{#1}}}
147 % \begin{macro}{\ps@empty}
148 % The empty page style: No head or foot line.
151 \let\@mkboth\@gobbletwo\let\@oddhead\@empty\let\@oddfoot\@empty
152 \let\@evenhead\@empty\let\@evenfoot\@empty}
156 % \begin{macro}{\ps@plain}
157 % \changes{v1.0g}{1995/05/26}{removed \cs{rmfamily} (PR 1578)}
158 % The plain page style: No head, centred page number in foot.
160 \def\ps@plain{\let\@mkboth\@gobbletwo
161 \let\@oddhead\@empty\def\@oddfoot{\reset@font\hfil\thepage
162 \hfil}\let\@evenhead\@empty\let\@evenfoot\@oddfoot}
166 % \begin{macro}{\@leftmark}
167 % \begin{macro}{\@rightmark}
168 % We implement |\@leftmark| and |\@rightmark| in terms of already
169 % defined commands to save token space. We can't get rid of them
170 % since they are sometimes used in applications.
172 \let\@leftmark\@firstoftwo
173 \let\@rightmark\@secondoftwo
178 % \begin{macro}{\markboth}
179 % \begin{macro}{\markright}
180 % \changes{v1.0d}{1994/05/20}{Changed setting for \cs{protect}.}
181 % \changes{v1.0e}{1994/11/04}{Added \cs{@unexpandable@protect}.
184 % User commands for setting \LaTeX\ marks.
186 % Test for |\@nobreak| added 15 Apr 86 in |\markboth| and |\markright|
187 % letting |\label| and |\index| to |\relax| added 22 Feb 86 so these
188 % commands can appear in sectioning command arguments
189 % RmS 91/06/21 Same for |\glossary|
190 % \changes{v1.0k}{2000/06/02}{Tidied 1.0j reimplementation, CAR}
191 % \changes{v1.0k}{2000/06/02}{Small adjustment to give slightly less
193 % \changes{v1.0j}{2000/05/26}{Reimplementation to fix expansion
198 \let\label\relax \let\index\relax \let\glossary\relax
199 \unrestored@protected@xdef\@themark {{#1}{#2}}%
200 \@temptokena \expandafter{\@themark}%
201 \mark{\the\@temptokena}%
203 \if@nobreak\ifvmode\nobreak\fi\fi}
206 \let\label\relax \let\index\relax \let\glossary\relax
208 % Protection is handled inside |\@markright|.
210 \expandafter\@markright\@themark {#1}%
211 \@temptokena \expandafter{\@themark}%
212 \mark{\the\@temptokena}%
214 \if@nobreak\ifvmode\nobreak\fi\fi}
220 % \begin{macro}{\@markright}
221 % \changes{v1.0j}{2000/05/26}{Reimplementation to fix expansion
223 % \changes{v1.0k}{2000/06/02}{Small adjustment to give slightly less
225 % \begin{macro}{\leftmark}
226 % \changes{v1.0j}{2000/05/26}{Use \cs{@empty} instead of brace group
228 % \begin{macro}{\rightmark}
229 % \changes{LaTeX2e}{1993/12/17}{Stopgap solution to mark \cs{leftmark}
230 % and \cs{rightmark} work without initializing mark until
231 % the problem is solved.}
232 % \changes{v1.0j}{2000/05/26}{Use \cs{@empty} instead of brace group
234 % \task{???}{mark initialisation solved?}
236 \def\@markright#1#2#3{\@temptokena {#1}%
237 \unrestored@protected@xdef\@themark{{\the\@temptokena}{#3}}}
238 \def\leftmark{\expandafter\@leftmark\botmark\@empty\@empty}
239 \def\rightmark{\expandafter\@rightmark\firstmark\@empty\@empty}
246 % \begin{macro}{\@themark}
247 % Initialise \LaTeX's marks without setting a \TeX\ mark \meta{whatsit}.
253 % \begin{macro}{\mark}
254 % Test versions of \LaTeXe\ initialised \TeX's |\mark| system
255 % at this point, but this was removed before the first release.
256 % \changes{LaTeX2e}{1993/12/16}{Init \cs{mark} at begin document}
257 % \changes{LaTeX2e}{1993/12/17}{Removed init \cs{mark} at begin
258 % document, since it doesn't work.}
260 %\AtBeginDocument{\mark{{}{}}}
265 % \begin{macro}{\raggedbottom}
266 % |\raggedbottom| typesets pages with no vertical stretch, so they have
267 % their natural height instead of all being exactly the
268 % same height. (Uses a space of .0001fil to avoid
269 % interfering with the 1fil space of |\newpage|.)
273 \def\@textbottom{\vskip \z@ \@plus.0001fil}\let\@texttop\relax}
277 % \begin{macro}{\flushbottom}
279 % Inverse of |\raggedbottom| --- makes all pages the same height.
282 \let\@textbottom\relax \let\@texttop\relax}
287 % \begin{macro}{\sloppy}
288 % |\sloppy| will never (well, hardly ever) produce overfull boxes, but
289 % may produce underfull ones. (14 June 85)
290 % \changes{LaTeX2e}{1993/12/18}{Added \cs{emergencystretch}}
291 % \changes{v1.0h}{1994/07/20}{Save a few tokens}
295 \emergencystretch 3em%
301 % \begin{environment}{sloppypar}
302 % A sloppypar environment is equivalent to |{\par \sloppy ... \par}|.
304 \def\sloppypar{\par\sloppy}
305 \def\endsloppypar{\par}
309 % \begin{macro}{\fussy}
310 % \changes{v1.0f}{1995/04/24}{reset \cs{emergencystretch} latex/1344}
311 % Resets \TeX's parameters to their normal finicky values.
321 % \begin{macro}{\overfullrule}
322 % \LaTeX\ default is no overfull box rule. Changed by document