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
|
<!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>troff and nroff Modes (The GNU Troff Manual)</title>
<meta name="description" content="troff and nroff Modes (The GNU Troff Manual)">
<meta name="keywords" content="troff and nroff Modes (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="GNU-troff-Reference.html" rel="up" title="GNU troff Reference">
<link href="Line-Layout.html" rel="next" title="Line Layout">
<link href="Character-Translations.html" rel="prev" title="Character Translations">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
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="section-level-extent" id="troff-and-nroff-Modes">
<div class="nav-panel">
<p>
Next: <a href="Line-Layout.html" accesskey="n" rel="next">Line Layout</a>, Previous: <a href="Character-Translations.html" accesskey="p" rel="prev">Character Translations</a>, Up: <a href="GNU-troff-Reference.html" accesskey="u" rel="up">GNU <code class="code">troff</code> Reference</a> [<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>
<h3 class="section" id="troff-and-nroff-Modes-1">5.14 <code class="code">troff</code> and <code class="code">nroff</code> Modes</h3>
<a class="index-entry-id" id="index-troff-mode"></a>
<a class="index-entry-id" id="index-mode_002c-troff"></a>
<a class="index-entry-id" id="index-nroff-mode"></a>
<a class="index-entry-id" id="index-mode_002c-nroff"></a>
<p>Historically, <code class="code">nroff</code> and <code class="code">troff</code> were two separate programs;
the former for terminal output, the latter for typesetters. GNU
<code class="code">troff</code> merges both functions into one executable<a class="footnote" id="DOCF68" href="groff.html_fot.html#FOOT68"><sup>68</sup></a> that sends its output to a
device driver (<code class="code">grotty</code> for terminal devices, <code class="code">grops</code> for
PostScript, and so on) which interprets this intermediate output format.
When discussing <abbr class="acronym">AT&T</abbr> <code class="code">troff</code>, it makes sense to talk
about <em class="dfn"><code class="code">nroff</code> mode</em> and <em class="dfn"><code class="code">troff</code> mode</em> since the
differences are hard-coded. GNU <code class="code">troff</code> takes information from
device and font description files without handling requests specially if
a terminal output device is used, so such a strong distinction is
unnecessary.
</p>
<p>Usually, a macro package can be used with all output devices.
Nevertheless, it is sometimes necessary to make a distinction between
terminal and non-terminal devices: GNU <code class="code">troff</code> provides two
built-in conditions ‘<samp class="samp">n</samp>’ and ‘<samp class="samp">t</samp>’ for the <code class="code">if</code>, <code class="code">ie</code>,
and <code class="code">while</code> requests to decide whether GNU <code class="code">troff</code> shall
behave like <code class="code">nroff</code> or like <code class="code">troff</code>.
</p>
<dl class="first-deffn">
<dt class="deffn" id="index-_002etroff"><span class="category-def">Request: </span><span><strong class="def-name"><code class="t">.troff</code></strong><a class="copiable-link" href='#index-_002etroff'> ¶</a></span></dt>
<dd><a class="index-entry-id" id="index-troff"></a>
<a class="index-entry-id" id="index-troffrc-4"></a>
<a class="index-entry-id" id="index-troffrc_002dend-2"></a>
<p>Make the ‘<samp class="samp">t</samp>’ built-in condition true (and the ‘<samp class="samp">n</samp>’ built-in
condition false) for <code class="code">if</code>, <code class="code">ie</code>, and <code class="code">while</code> conditional
requests. This is the default if GNU <code class="code">troff</code> (<em class="emph">not</em>
<code class="code">groff</code>) is started with the <samp class="option">-R</samp> switch to avoid loading of
the startup files <samp class="file">troffrc</samp> and <samp class="file">troffrc-end</samp>. Without
<samp class="option">-R</samp>, GNU <code class="code">troff</code> stays in <code class="code">troff</code> mode if the output
device is not a terminal (e.g., ‘ps’).
</p></dd></dl>
<dl class="first-deffn">
<dt class="deffn" id="index-_002enroff"><span class="category-def">Request: </span><span><strong class="def-name"><code class="t">.nroff</code></strong><a class="copiable-link" href='#index-_002enroff'> ¶</a></span></dt>
<dd><a class="index-entry-id" id="index-nroff"></a>
<a class="index-entry-id" id="index-tty_002etmac"></a>
<p>Make the ‘<samp class="samp">n</samp>’ built-in condition true (and the ‘<samp class="samp">t</samp>’ built-in
condition false) for <code class="code">if</code>, <code class="code">ie</code>, and <code class="code">while</code> conditional
requests. This is the default if GNU <code class="code">troff</code> uses a terminal
output device; the code for switching to <code class="code">nroff</code> mode is in the
file <samp class="file">tty.tmac</samp>, which is loaded by the startup file
<code class="code">troffrc</code>.
</p></dd></dl>
<p>See <a class="xref" href="Conditionals-and-Loops.html">Conditionals and Loops</a>, for more details on built-in conditions.
</p>
</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Line-Layout.html">Line Layout</a>, Previous: <a href="Character-Translations.html">Character Translations</a>, Up: <a href="GNU-troff-Reference.html">GNU <code class="code">troff</code> Reference</a> [<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>
|