summaryrefslogtreecommitdiffstats
path: root/doc/groff.html.node/ms-Headers-and-Footers.html
blob: 472f19cf400634dcf90fd53c2a87442906c1f0d6 (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
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.0.3, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- This manual documents GNU troff version 1.23.0.

Copyright � 1994-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
copy of the license is included in the section entitled "GNU Free
Documentation License". -->
<title>ms Headers and Footers (The GNU Troff Manual)</title>

<meta name="description" content="ms Headers and Footers (The GNU Troff Manual)">
<meta name="keywords" content="ms Headers and Footers (The GNU Troff Manual)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Request-Index.html" rel="index" title="Request Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="ms-Page-Layout.html" rel="up" title="ms Page Layout">
<link href="Tab-Stops-in-ms.html" rel="next" title="Tab Stops in ms">
<link href="ms-Page-Layout.html" rel="prev" title="ms Page Layout">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
span.r {font-family: initial; font-weight: normal; font-style: normal}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>


</head>

<body lang="en">
<div class="subsubsection-level-extent" id="ms-Headers-and-Footers">
<div class="nav-panel">
<p>
Next: <a href="Tab-Stops-in-ms.html" accesskey="n" rel="next">Tab stops</a>, Previous: <a href="ms-Page-Layout.html" accesskey="p" rel="prev">Page layout</a>, Up: <a href="ms-Page-Layout.html" accesskey="u" rel="up">Page layout</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Request-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h4 class="subsubsection" id="Headers-and-footers">4.6.6.1 Headers and footers</h4>
<a class="index-entry-id" id="index-ms-macros_002c-headers"></a>
<a class="index-entry-id" id="index-ms-macros_002c-footers"></a>
<a class="index-entry-id" id="index-headers-_005bms_005d"></a>
<a class="index-entry-id" id="index-footers-_005bms_005d"></a>

<p>There are multiple ways to produce headers and footers.  One is to
define the strings <code class="code">LH</code>, <code class="code">CH</code>, and <code class="code">RH</code> to set the left,
center, and right headers, respectively; and <code class="code">LF</code>, <code class="code">CF</code>, and
<code class="code">RF</code> to set the left, center, and right footers.  This approach
suffices for documents that do not distinguish odd- and even-numbered
pages.
</p>
<p>Another method is to call macros that set headers or footers for odd- or
even-numbered pages.  Each such macro takes a delimited argument
separating the left, center, and right header or footer texts from each
other.  You can replace the neutral apostrophes (<code class="code">'</code>) shown below
with any character not appearing in the header or footer text.  These
macros are Berkeley extensions.
</p>
<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-_002eOH"><span class="category-def">Macro: </span><span><strong class="def-name"><code class="t">.OH</code></strong> <var class="def-var-arguments"><code class="code">'</code><span class="r"><i class="slanted">left</i></span><code class="code">'</code><span class="r"><i class="slanted">center</i></span><code class="code">'</code><span class="r"><i class="slanted">right</i></span><code class="code">'</code></var><a class="copiable-link" href='#index-_002eOH'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-OH-_005bms_005d"></a>
</dd><dt class="deffnx defmacx-alias-deffnx def-cmd-deffn" id="index-_002eEH"><span class="category-def">Macro: </span><span><strong class="def-name"><code class="t">.EH</code></strong> <var class="def-var-arguments"><code class="code">'</code><span class="r"><i class="slanted">left</i></span><code class="code">'</code><span class="r"><i class="slanted">center</i></span><code class="code">'</code><span class="r"><i class="slanted">right</i></span><code class="code">'</code></var><a class="copiable-link" href='#index-_002eEH'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-EH-_005bms_005d"></a>
</dd><dt class="deffnx defmacx-alias-deffnx def-cmd-deffn" id="index-_002eOF"><span class="category-def">Macro: </span><span><strong class="def-name"><code class="t">.OF</code></strong> <var class="def-var-arguments"><code class="code">'</code><span class="r"><i class="slanted">left</i></span><code class="code">'</code><span class="r"><i class="slanted">center</i></span><code class="code">'</code><span class="r"><i class="slanted">right</i></span><code class="code">'</code></var><a class="copiable-link" href='#index-_002eOF'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-OF-_005bms_005d"></a>
</dd><dt class="deffnx defmacx-alias-deffnx def-cmd-deffn" id="index-_002eEF"><span class="category-def">Macro: </span><span><strong class="def-name"><code class="t">.EF</code></strong> <var class="def-var-arguments"><code class="code">'</code><span class="r"><i class="slanted">left</i></span><code class="code">'</code><span class="r"><i class="slanted">center</i></span><code class="code">'</code><span class="r"><i class="slanted">right</i></span><code class="code">'</code></var><a class="copiable-link" href='#index-_002eEF'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-EF-_005bms_005d"></a>
<p>The <code class="code">OH</code> and <code class="code">EH</code> macros define headers for odd- (recto)
and even-numbered (verso) pages, respectively; the <code class="code">OF</code> and
<code class="code">EF</code> macros define footers for them.
</p></dd></dl>

<p>With either method, a percent sign <code class="code">%</code> in header or footer text is
replaced by the current page number.  By default, <samp class="file">ms</samp> places no
header on a page numbered &ldquo;1&rdquo; (regardless of its number format).
</p>
<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-_002eP1"><span class="category-def">Macro: </span><span><strong class="def-name"><code class="t">.P1</code></strong><a class="copiable-link" href='#index-_002eP1'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-P1-_005bms_005d"></a>
<p>Typeset the header even on page&nbsp;1.  To be effective, this macro
must be called before the header trap is sprung on any page numbered
&ldquo;1&rdquo;; in practice, unless your page numbering is unusual, this means
that you should call it early, before <code class="code">TL</code> or any heading or
paragraphing macro.  This is a Berkeley extension.
</p></dd></dl>

<p>For even greater flexibility, <samp class="file">ms</samp> is designed to permit the
redefinition of the macros that are called when the <code class="code">groff</code> traps
that ordinarily cause the headers and footers to be output are sprung.
<code class="code">PT</code> (&ldquo;page trap&rdquo;) is called by <samp class="file">ms</samp> when the header is to
be written, and <code class="code">BT</code> (&ldquo;bottom trap&rdquo;) when the footer is to be.
The <code class="code">groff</code> page location trap that <samp class="file">ms</samp> sets up to format the
header also calls the (normally undefined) <code class="code">HD</code> macro after
<code class="code">PT</code>; you can define <code class="code">HD</code> if you need additional processing
after setting the header (for example, to draw a line below it).
The <code class="code">HD</code> hook is a Berkeley extension.  Any such macros you
(re)define must implement any desired specialization for odd-, even-, or
first numbered pages.
</p>

</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Tab-Stops-in-ms.html">Tab stops</a>, Previous: <a href="ms-Page-Layout.html">Page layout</a>, Up: <a href="ms-Page-Layout.html">Page layout</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Request-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>