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 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This document is an unofficial reference manual for LaTeX, a
document preparation system, version of October 2018.
This manual was originally translated from LATEX.HLP v1.0a in the
VMS Help Library. The pre-translation version was written by
George D. Greenwade of Sam Houston State University. The
LaTeX 2.09 version was written by Stephen Gilmore. The
LaTeX2e version was adapted from this by Torsten Martinsen. Karl
Berry made further updates and additions, and gratefully acknowledges
using Hypertext Help with LaTeX, by Sheldon Green, and
LaTeX Command Summary (for LaTeX 2.09) by
L. Botway and C. Biemesderfer (published by the TeX Users
Group as TeXniques number 10), as reference material. We also
gratefully acknowledge additional material appearing in
latex2e-reference by Martin Herbert Dietze. (From these references no
text was directly copied.)
Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013,
2014, 2015, 2016, 2017, 2018 Karl Berry.
Copyright 1988, 1994, 2007 Stephen Gilmore.
Copyright 1994, 1995, 1996 Torsten Martinsen.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions. -->
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Page styles (LaTeX2e unofficial reference manual (October 2018))</title>
<meta name="description" content="Page styles (LaTeX2e unofficial reference manual (October 2018))">
<meta name="keywords" content="Page styles (LaTeX2e unofficial reference manual (October 2018))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="latex2e_0.html#Top" rel="start" title="Top">
<link href="latex2e_30.html#Index" rel="index" title="Index">
<link href="latex2e_0.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="latex2e_0.html#Top" rel="up" title="Top">
<link href="latex2e_19.html#Spaces" rel="next" title="Spaces">
<link href="latex2e_17.html#g_t_005censuremath" rel="prev" title="\ensuremath">
<style type="text/css">
<!--
body {margin: 1em; margin-top: 0px; padding-top: 1px}
a.anchor {float: right}
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body id="top" lang="en">
<a name="Page-styles" class="anchor"></a>
<a name="Page-styles-1" class="anchor"></a>
<h2 class="chapter">Page styles</h2>
<a name="index-styles_002c-page" class="anchor"></a>
<a name="index-page-styles" class="anchor"></a>
<p>The style of a page determines where LaTeX places the components of
that page, such as headers and footers, and the text body. This
includes pages in the main part of the document but also includes
special pages such as the title page of a book, a page from an index, or
the first page of an article.
</p>
<a name="index-package_002c-fancyhdr" class="anchor"></a>
<a name="index-fancyhdr-package" class="anchor"></a>
<p>The package <samp>fancyhdr</samp> is very helpful for constructing page
styles. See its documentation on CTAN.
</p>
<hr>
<a name="g_t_005cmaketitle" class="anchor"></a>
<a name="g_t_005cmaketitle-1" class="anchor"></a>
<h3 class="section"><code>\maketitle</code></h3>
<a name="index-titles_002c-making" class="anchor"></a>
<a name="index-_005cmaketitle" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\maketitle
</pre></div>
<p>Generate a title. In the standard classes the title appears on a
separate page, except in the <code>article</code> class where it is at the top
of the first page. (See <a href="latex2e_3.html#Document-class-options">Document class options</a> for information about
the <code>titlepage</code> document class option.)
</p>
<p>This example shows <code>\maketitle</code> appearing in its usual place,
immediately after <code>\begin{document}</code>.
</p>
<div class="example">
<pre class="example">\documentclass{article}
\title{Constructing a Nuclear Reactor Using Only Coconuts}
\author{Jonas Grumby\thanks{%
With the support of a Ginger Grant from the Roy Hinkley Society.} \\
Skipper, \textit{Minnow}
\and
Willy Gilligan\thanks{%
Thanks to the Mary Ann Summers foundation
and to Thurston and Lovey Howell.} \\
Mate, \textit{Minnow}
}
\date{1964-Sep-26}
\begin{document}
\maketitle
Just sit right back and you'll hear a tale, a tale of a fateful trip.
That started from this tropic port, aboard this tiny ship. The mate was
a mighty sailin' man, the Skipper brave and sure. Five passengers set
sail that day for a three hour tour. A three hour tour.
...
</pre></div>
<p>You tell LaTeX the information used to produce the title by making
the following declarations. These must come before the
<code>\maketitle</code>, either in the preamble or in the document body.
</p>
<dl compact="compact">
<dt><code>\author{<var>name1</var> \and <var>name2</var> \and ...}</code>
<a name="index-_005cauthor_007bname1-_005cand-name2-_005cand-_002e_002e_002e_007d" class="anchor"></a>
</dt>
<dd><a name="index-author_002c-for-titlepage" class="anchor"></a>
<a name="index-_005c_005c-for-_005cauthor" class="anchor"></a>
<a name="index-_005cand-for-_005cauthor" class="anchor"></a>
<p>Required. Declare the document author or authors. The argument is a
list of authors separated by <code>\and</code> commands. To separate lines
within a single author’s entry, for instance to give the author’s
institution or address, use a double backslash, <code>\\</code>. If you omit
the <code>\author</code> declaration then you get ‘<samp>LaTeX Warning: No
\author given</samp>’.
</p>
</dd>
<dt><code>\date{<var>text</var>}</code>
<a name="index-_005cdate_007btext_007d" class="anchor"></a>
</dt>
<dd><a name="index-date_002c-for-titlepage" class="anchor"></a>
<p>Optional. Declare <var>text</var> to be the document’s date. The <var>text</var>
doesn’t need to be in a date format; it can be any text at all. If you
omit <code>\date</code> then LaTeX uses the current date (see <a href="latex2e_23.html#g_t_005ctoday">\today</a>).
To have no date, instead use <code>\date{}</code>.
</p>
</dd>
<dt><code>\thanks{<var>text</var>}</code>
<a name="index-_005cthanks_007btext_007d" class="anchor"></a>
</dt>
<dd><a name="index-thanks_002c-for-titlepage" class="anchor"></a>
<a name="index-credit-footnote" class="anchor"></a>
<p>Optional. Produce a footnote. You can use it in the author information
for acknowledgements as illustrated above, but you can also use it in
the title, or any place a footnote makes sense. It can be any text at
all so you can use it for any purpose, such as to print an email
address.
</p>
</dd>
<dt><code>\title{<var>text</var>}</code>
<a name="index-_005ctitle_007btext_007d" class="anchor"></a>
</dt>
<dd><a name="index-title_002c-for-titlepage" class="anchor"></a>
<a name="index-_005c_005c-for-_005ctitle" class="anchor"></a>
<p>Required. Declare <var>text</var> to be the title of the document. Get line
breaks inside <var>text</var> with a double backslash, <code>\\</code>. If you
omit the <code>\title</code> declaration then you get ‘<samp>LaTeX Error: No
\title given</samp>’.
</p>
</dd>
</dl>
<p>To make your own title page, see <a href="latex2e_8.html#titlepage">titlepage</a>. You can either
create this as a one-off or you can include it as part of a renewed
<code>\maketitle</code> command. (Many publishers will provide a class to use
in place of <code>article</code> that formats the title according to their
house requirements.)
</p>
<hr>
<a name="g_t_005cpagenumbering" class="anchor"></a>
<a name="g_t_005cpagenumbering-1" class="anchor"></a>
<h3 class="section"><code>\pagenumbering</code></h3>
<a name="index-_005cpagenumbering" class="anchor"></a>
<a name="index-page-numbering-style" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\pagenumbering{<var>number-style</var>}
</pre></div>
<p>Specifies the style of page numbers, and resets the page number. The
numbering style is reflected on the page, and also in the table of
contents and other page references. This declaration has global scope
so its effect is not delimited by braces or environments.
</p>
<p>In this example, before the Main section the pages are numbered
‘<samp>a</samp>’, etc. Starting on the page containing that section, the pages
are numbered ‘<samp>1</samp>’, etc.
</p>
<div class="example">
<pre class="example">\begin{document}\pagenumbering{alph}
...
\section{Main}\pagenumbering{arabic}
...
</pre></div>
<p>The argument <var>number-style</var> is one of the following (see
also <a href="latex2e_13.html#g_t_005calph-_005cAlph-_005carabic-_005croman-_005cRoman-_005cfnsymbol">\alph \Alph \arabic \roman \Roman \fnsymbol</a>).
</p>
<dl compact="compact">
<dt><code>arabic</code></dt>
<dd><p>Arabic numerals: 1, 2, …
</p>
</dd>
<dt><code>roman</code></dt>
<dd><p>lowercase Roman numerals: i, ii, …
</p>
</dd>
<dt><code>Roman</code></dt>
<dd><p>uppercase Roman numerals: I, II, …
</p>
</dd>
<dt><code>alph</code></dt>
<dd><p>lowercase letters: a, b, … If you have more than 26 pages then you
get ‘<samp>LaTeX Error: Counter too large</samp>’.
</p>
</dd>
<dt><code>Alph</code></dt>
<dd><p>uppercase letters: A, B, … If you have more than 26 pages then you
get ‘<samp>LaTeX Error: Counter too large</samp>’.
</p>
</dd>
<dt><code>gobble</code></dt>
<dd><a name="index-package_002c-hyperref-2" class="anchor"></a>
<a name="index-hyperref-package-2" class="anchor"></a>
<p>LaTeX does not output a page number, although it
does get reset. References to that page also are blank. (This does not
work with the popular package <samp>hyperref</samp> so to have the page number
not appear you may want to instead use <code>\pagestyle{empty}</code> or
<code>\thispagestyle{empty}</code>.)
</p>
</dd>
</dl>
<p>Traditionally, if a document has front matter—preface, table of
contents, etc.—then it is numbered with lowercase Roman numerals. The
main matter of a document uses arabic. See <a href="latex2e_6.html#g_t_005cfrontmatter-_0026-_005cmainmatter-_0026-_005cbackmatter">\frontmatter & \mainmatter & \backmatter</a>.
</p>
<p>If you want to address where the page number appears on the page,
see <a href="#g_t_005cpagestyle">\pagestyle</a>. If you want to change the value of page
number then you will manipulate the <code>page</code> counter
(see <a href="latex2e_13.html#Counters">Counters</a>).
</p>
<hr>
<a name="g_t_005cpagestyle" class="anchor"></a>
<a name="g_t_005cpagestyle-1" class="anchor"></a>
<h3 class="section"><code>\pagestyle</code></h3>
<a name="index-_005cpagestyle" class="anchor"></a>
<a name="index-header-style" class="anchor"></a>
<a name="index-footer-style" class="anchor"></a>
<a name="index-running-header-and-footer-style" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\pagestyle{<var>style</var>}
</pre></div>
<p>Declaration that specifies how the page headers and footers are typeset,
from the current page onwards.
</p>
<a name="index-package_002c-fancyhdr-1" class="anchor"></a>
<a name="index-fancyhdr-package-1" class="anchor"></a>
<p>A discussion with an example is below. Note first that the package
<samp>fancyhdr</samp> is now the standard way to manipulate headers and
footers. New documents that need to do anything other than one of the
standard options below should use this package. See its documentation
on CTAN.
</p>
<p>Values for <var>style</var>:
</p>
<dl compact="compact">
<dt><code>plain</code></dt>
<dd><p>The header is empty. The footer contains only a page number, centered.
</p>
</dd>
<dt><code>empty</code></dt>
<dd><p>The header and footer is empty.
</p>
</dd>
<dt><code>headings</code></dt>
<dd><p>Put running headers and footers on each page. The document style
specifies what goes in there; see the discussion below.
</p>
</dd>
<dt><code>myheadings</code></dt>
<dd><p>Custom headers, specified via the <code>\markboth</code> or the
<code>\markright</code> commands.
</p>
</dd>
</dl>
<p>Some discussion of the motivation for LaTeX’s mechanism will help you
work with the options <code>headings</code> or <code>myheadings</code>. The
document source below produces an article, two-sided, with the pagestyle
<code>headings</code>. On this document’s left hand pages, LaTeX wants (in
addition to the page number) the title of the current section. On its
right hand pages LaTeX wants the title of the current subsection.
When it makes up a page, LaTeX gets this information from the
commands <code>\leftmark</code> and <code>\rightmark</code>. So it is up to
<code>\section</code> and <code>\subsection</code> to store that information there.
</p>
<div class="example">
<pre class="example">\documentclass[twoside]{article}
\pagestyle{headings}
\begin{document}
... \section{Section 1} ... \subsection{Subsection 1.1} ...
\section{Section 2}
...
\subsection{Subsection 2.1}
...
\subsection{Subsection 2.2}
...
</pre></div>
<p>Suppose that the second section falls on a left page. Although when the
page starts it is in the first section, LaTeX will put
‘<samp>Section 2</samp>’ in the left page header. As to the right header,
if no subsection starts before the end of the right page then LaTeX
blanks the right hand header. If a subsection does appear before the
right page finishes then there are two cases. If at least one
subsection starts on the right hand page then LaTeX will put in the
right header the title of the first subsection starting on that right
page. If at least one of 2.1, 2.2, …, starts on the left page but
none starts on the right then LaTeX puts in the right hand header the
title of the last subsection to start, that is, the one in effect during
the right hand page.
</p>
<p>To accomplish this, in a two-sided article, LaTeX has <code>\section</code>
issue a command <code>\markboth</code>, setting <code>\leftmark</code>
to ‘<samp>Section 2</samp>’ and setting <code>\rightmark</code> to blank.
And, LaTeX has <code>\subsection</code> issue a command <code>\markright</code>,
setting <code>\rightmark</code> to ‘<samp>Subsection 2.1</samp>’, etc.
</p>
<p>Here are the descriptions of <code>\markboth</code> and <code>\markright</code>:
</p>
<dl compact="compact">
<dt><code>\markboth{<var>left-head</var>}{<var>right-head</var>}</code>
<a name="index-_005cmarkboth_007bleft_002dhead_007d_007bright_002dhead_007d" class="anchor"></a>
</dt>
<dd><p>Sets both the right hand and left hand heading information for either a
page style of <code>headings</code> or <code>myheadings</code>. A left hand page
heading <var>left-head</var> is generated by the last <code>\markboth</code>
command before the end of the page. A right hand page heading
<var>right-head</var> is generated by the first <code>\markboth</code> or
<code>\markright</code> that comes on the page if there is one, otherwise by
the last one that came before that page.
</p>
</dd>
<dt><code>\markright{<var>right</var>}</code>
<a name="index-_005cmarkright_007bright_007d" class="anchor"></a>
</dt>
<dd><p>Sets the right hand page heading, leaving the left unchanged.
</p>
</dd>
</dl>
<hr>
<a name="g_t_005cthispagestyle" class="anchor"></a>
<a name="g_t_005cthispagestyle-1" class="anchor"></a>
<h3 class="section"><code>\thispagestyle</code></h3>
<a name="index-_005cthispagestyle" class="anchor"></a>
<a name="index-page-style_002c-this-page" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\thispagestyle{<var>style</var>}
</pre></div>
<p>Works in the same way as the <code>\pagestyle</code> (see <a href="#g_t_005cpagestyle">\pagestyle</a>),
except that it changes to <var>style</var> for the current page only. This
declaration has global scope, so its effect is not delimited by braces
or environments.
</p>
<p>Often the first page of a chapter or section has a different style. For
example, this LaTeX book document has the first page of the first
chapter in <code>plain</code> style, as is the default (see <a href="#Page-styles">Page styles</a>).
</p>
<div class="example">
<pre class="example">\documentclass{book}
\pagestyle{headings}
\begin{document}
\chapter{First chapter}
...
\chapter{Second chapter}\thispagestyle{empty}
...
</pre></div>
<p>The <code>plain</code> style has a page number on it, centered in the footer.
To make the page entirely empty, the command
<code>\thispagestyle{empty}</code> immediately follows the second
<code>\chapter</code>.
</p>
</body>
</html>
|