summaryrefslogtreecommitdiffstats
path: root/doc/groff.html.node/Headings-in-ms.html
blob: a5d0cc74b1f1dc6e50da280ab9cdf1933e6d2ec0 (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
<!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>Headings in ms (The GNU Troff Manual)</title>

<meta name="description" content="Headings in ms (The GNU Troff Manual)">
<meta name="keywords" content="Headings in ms (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-Body-Text.html" rel="up" title="ms Body Text">
<link href="Typeface-and-decoration.html" rel="next" title="Typeface and decoration">
<link href="Paragraphs-in-ms.html" rel="prev" title="Paragraphs in ms">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
div.example {margin-left: 3.2em}
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="Headings-in-ms">
<div class="nav-panel">
<p>
Next: <a href="Typeface-and-decoration.html" accesskey="n" rel="next">Typeface and decoration</a>, Previous: <a href="Paragraphs-in-ms.html" accesskey="p" rel="prev">Paragraphs</a>, Up: <a href="ms-Body-Text.html" accesskey="u" rel="up">Body Text</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="Headings">4.6.5.4 Headings</h4>
<a class="index-entry-id" id="index-ms-macros_002c-headings"></a>

<p>Use headings to create a sequential or hierarchical structure for your
document.  The <samp class="file">ms</samp> macros print headings in <strong class="strong">bold</strong> using
the same font family and, by default, type size as the body text.
Headings are available with and without automatic numbering.  Text on
input lines following the macro call becomes the heading&rsquo;s title.  Call
a paragraphing macro to end the heading text and start the section&rsquo;s
content.
</p>
<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-_002eNH"><span class="category-def">Macro: </span><span><strong class="def-name"><code class="t">.NH</code></strong> <var class="def-var-arguments">[<span class="r"><i class="slanted">depth</i></span>]</var><a class="copiable-link" href='#index-_002eNH'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-NH-_005bms_005d"></a>
</dd><dt class="deffnx defmacx-alias-deffnx def-cmd-deffn" id="index-_002eNH-1"><span class="category-def">Macro: </span><span><strong class="def-name"><code class="t">.NH</code></strong> <var class="def-var-arguments"><code class="t">S</code> <span class="r"><i class="slanted">heading-depth-index</i></span> &hellip;</var><a class="copiable-link" href='#index-_002eNH-1'> &para;</a></span></dt>
<dd><p>Set an automatically numbered heading.
</p>
<p><samp class="file">ms</samp> produces a numbered heading the form <var class="var">a.b.c&hellip;</var>, to
any depth desired, with the numbering of each depth increasing
automatically and being reset to zero when a more significant level is
increased.  &ldquo;1&rdquo;&nbsp;is the most significant or coarsest division of
the document.  Only non-zero values are output.  If <var class="var">depth</var> is
omitted, it is taken to be &lsquo;<samp class="samp">1</samp>&rsquo;.
</p>
<p>If you specify <var class="var">depth</var> such that an ascending gap occurs relative to
the previous <code class="code">NH</code> call&mdash;that is, you &ldquo;skip a depth&rdquo;, as by
&lsquo;<samp class="samp">.NH 1</samp>&rsquo; and then &lsquo;<samp class="samp">.NH 3</samp>&rsquo;&mdash;<code class="code">groff</code> <samp class="file">ms</samp> emits a
warning on the standard error stream.
</p>
<p>Alternatively, you can give <code class="code">NH</code> a first argument of&nbsp;<code class="code">S</code>,
followed by integers to number the heading depths explicitly.  Further
automatic numbering, if used, resumes using the specified indices as
their predecessors.
This feature is a Berkeley extension.
</p></dd></dl>

<p>An example may be illustrative.
</p>
<table class="cartouche" border="1"><tr><td>
<div class="example">
<pre class="example-preformatted">.NH 1
Animalia
.NH 2
Arthropoda
.NH 3
Crustacea
.NH 2
Chordata
.NH S 6 6 6
Daimonia
.NH 1
Plantae
</pre></div>
</td></tr></table>

<p>The above results in numbering as follows; the vertical space that
normally precedes each heading is omitted.
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">1.  Animalia
1.1.  Arthropoda
1.1.1.  Crustacea
1.2.  Chordata
6.6.6.  Daimonia
7.  Plantae
</pre></div></div>

<dl class="first-deffn">
<dt class="deffn" id="index-_005c_002a_005bSN_002dSTYLE_005d-1"><span class="category-def">String: </span><span><strong class="def-name"><code class="t">\*[SN-STYLE]</code></strong><a class="copiable-link" href='#index-_005c_002a_005bSN_002dSTYLE_005d-1'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-SN_002dSTYLE-_005bms_005d-1"></a>
</dd><dt class="deffnx def-cmd-deffn" id="index-_005c_002a_005bSN_002dDOT_005d"><span class="category-def">String: </span><span><strong class="def-name"><code class="t">\*[SN-DOT]</code></strong><a class="copiable-link" href='#index-_005c_002a_005bSN_002dDOT_005d'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-SN_002dDOT-_005bms_005d"></a>
</dd><dt class="deffnx def-cmd-deffn" id="index-_005c_002a_005bSN_002dNO_002dDOT_005d"><span class="category-def">String: </span><span><strong class="def-name"><code class="t">\*[SN-NO-DOT]</code></strong><a class="copiable-link" href='#index-_005c_002a_005bSN_002dNO_002dDOT_005d'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-SN_002dNO_002dDOT-_005bms_005d"></a>
</dd><dt class="deffnx def-cmd-deffn" id="index-_005c_002a_005bSN_005d"><span class="category-def">String: </span><span><strong class="def-name"><code class="t">\*[SN]</code></strong><a class="copiable-link" href='#index-_005c_002a_005bSN_005d'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-SN-_005bms_005d"></a>
<p>After <code class="code">NH</code> is called, the assigned number is made available in the
strings <code class="code">SN-DOT</code> (as it appears in a printed heading with default
formatting, followed by a terminating period) and <code class="code">SN-NO-DOT</code> (with
the terminating period omitted).  These are GNU extensions.
</p>
<p>You can control the style used to print numbered headings by defining an
appropriate alias for the string <code class="code">SN-STYLE</code>.  By default,
<code class="code">SN-STYLE</code> is aliased to <code class="code">SN-DOT</code>.  If you prefer to omit the
terminating period from numbers appearing in numbered headings, you may
define the alias as follows.
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">.als SN-STYLE SN-NO-DOT
</pre></div></div>

<p>Any such change in numbering style becomes effective from the next use
of <code class="code">NH</code> following redefinition of the alias for <code class="code">SN-STYLE</code>.
The formatted number of the current heading is available in the
<code class="code">SN</code> string (a feature first documented by Berkeley), which
facilitates its inclusion in, for example, table captions, equation
labels, and <code class="code">XS</code>/<code class="code">XA</code>/<code class="code">XE</code> table of contents entries.
</p></dd></dl>

<dl class="first-deffn first-defmac-alias-first-deffn">
<dt class="deffn defmac-alias-deffn" id="index-_002eSH"><span class="category-def">Macro: </span><span><strong class="def-name"><code class="t">.SH</code></strong> <var class="def-var-arguments">[<span class="r"><i class="slanted">depth</i></span>]</var><a class="copiable-link" href='#index-_002eSH'> &para;</a></span></dt>
<dd><a class="index-entry-id" id="index-SH-_005bms_005d"></a>
<p>Set an unnumbered heading.
</p>
<p>The optional <var class="var">depth</var> argument is a GNU extension indicating the
heading depth corresponding to the <var class="var">depth</var> argument of <code class="code">NH</code>.
It matches the type size at which the heading is set to that of a
numbered heading at the same depth when the <code class="code">GROWPS</code> and
<code class="code">PSINCR</code> heading size adjustment mechanism is in effect.
</p></dd></dl>

<p>If the <code class="code">GROWPS</code> register is set to a value greater than the
<var class="var">level</var> argument to <code class="code">NH</code> or <code class="code">SH</code>, the type size of a
heading produced by these macros increases by <code class="code">PSINCR</code> units over
the size specified by <code class="code">PS</code> multiplied by the difference of
<code class="code">GROWPS</code> and <var class="var">level</var>.  The value stored in <code class="code">PSINCR</code> is
interpreted in <code class="code">groff</code> basic units; the <code class="code">p</code> scaling unit
should be employed when assigning a value specified in points.  For
example, the sequence
</p>
<table class="cartouche" border="1"><tr><td>
<div class="example">
<pre class="example-preformatted">.nr PS 10
.nr GROWPS 3
.nr PSINCR 1.5p
.NH 1
Carnivora
.NH 2
Felinae
.NH 3
Felis catus
.SH 2
Machairodontinae
</pre></div>
</td></tr></table>

<p>will cause &ldquo;1. Carnivora&rdquo; to be printed in 13-point text, followed by
&ldquo;1.1. Felinae&rdquo; in 11.5-point text, while &ldquo;1.1.1. Felis catus&rdquo; and
all more deeply nested heading levels will remain in the 10-point text
specified by the <code class="code">PS</code> register.  &ldquo;Machairodontinae&rdquo; is printed at
11.5 points, since it corresponds to heading level&nbsp;2.
</p>
<p>The <code class="code">HORPHANS</code> register operates in conjunction with the <code class="code">NH</code>
and <code class="code">SH</code> macros to inhibit the printing of isolated headings at the
bottom of a page; it specifies the minimum number of lines of an
immediately subsequent paragraph that must be kept on the same page as
the heading.  If insufficient space remains on the current page to
accommodate the heading and this number of lines of paragraph text, a
page break is forced before the heading is printed.  Any display macro
call or <code class="code">tbl</code>, <code class="code">pic</code>, or <code class="code">eqn</code> region between the heading
and the subsequent paragraph suppresses this grouping.  See <a class="xref" href="ms-keeps-and-displays.html">Keeps, boxed keeps, and displays</a> and <a class="ref" href="ms-Insertions.html">Tables, figures, equations, and references</a>.
</p>

</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Typeface-and-decoration.html">Typeface and decoration</a>, Previous: <a href="Paragraphs-in-ms.html">Paragraphs</a>, Up: <a href="ms-Body-Text.html">Body Text</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>