summaryrefslogtreecommitdiffstats
path: root/doc/groff.html.node/Input-Line-Traps.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/groff.html.node/Input-Line-Traps.html')
-rw-r--r--doc/groff.html.node/Input-Line-Traps.html185
1 files changed, 185 insertions, 0 deletions
diff --git a/doc/groff.html.node/Input-Line-Traps.html b/doc/groff.html.node/Input-Line-Traps.html
new file mode 100644
index 0000000..f0d7fef
--- /dev/null
+++ b/doc/groff.html.node/Input-Line-Traps.html
@@ -0,0 +1,185 @@
+<!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>Input Line Traps (The GNU Troff Manual)</title>
+
+<meta name="description" content="Input Line Traps (The GNU Troff Manual)">
+<meta name="keywords" content="Input Line Traps (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="Traps.html" rel="up" title="Traps">
+<link href="Blank-Line-Traps.html" rel="next" title="Blank Line Traps">
+<link href="Diversion-Traps.html" rel="prev" title="Diversion Traps">
+<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="subsection-level-extent" id="Input-Line-Traps">
+<div class="nav-panel">
+<p>
+Next: <a href="Blank-Line-Traps.html" accesskey="n" rel="next">Blank Line Traps</a>, Previous: <a href="Diversion-Traps.html" accesskey="p" rel="prev">Diversion Traps</a>, Up: <a href="Traps.html" accesskey="u" rel="up">Traps</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="subsection" id="Input-Line-Traps-1">5.28.2 Input Line Traps</h4>
+<a class="index-entry-id" id="index-input-line-traps"></a>
+<a class="index-entry-id" id="index-traps_002c-input-line"></a>
+
+<dl class="first-deffn">
+<dt class="deffn" id="index-_002eit"><span class="category-def">Request: </span><span><strong class="def-name"><code class="t">.it</code></strong> <var class="def-var-arguments">[<span class="r"><i class="slanted">n</i></span> <span class="r"><i class="slanted">name</i></span>]</var><a class="copiable-link" href='#index-_002eit'> &para;</a></span></dt>
+<dd><a class="index-entry-id" id="index-it"></a>
+</dd><dt class="deffnx def-cmd-deffn" id="index-_002eitc"><span class="category-def">Request: </span><span><strong class="def-name"><code class="t">.itc</code></strong> <var class="def-var-arguments">[<span class="r"><i class="slanted">n</i></span> <span class="r"><i class="slanted">name</i></span>]</var><a class="copiable-link" href='#index-_002eitc'> &para;</a></span></dt>
+<dd><a class="index-entry-id" id="index-itc"></a>
+<a class="index-entry-id" id="index-setting-input-line-trap-_0028it_002c-itc_0029"></a>
+<a class="index-entry-id" id="index-input-line-trap_002c-setting-_0028it_002c-itc_0029"></a>
+<a class="index-entry-id" id="index-trap_002c-input-line_002c-setting-_0028it_002c-itc_0029"></a>
+<a class="index-entry-id" id="index-clearing-input-line-trap-_0028it_002c-itc_0029"></a>
+<a class="index-entry-id" id="index-input-line-trap_002c-clearing-_0028it_002c-itc_0029"></a>
+<a class="index-entry-id" id="index-trap_002c-input-line_002c-clearing-_0028it_002c-itc_0029"></a>
+<p>Set an input line trap, calling macro <var class="var">name</var> after processing the
+next <var class="var">n</var>&nbsp;productive input lines (recall <a class="ref" href="Manipulating-Filling-and-Adjustment.html">Manipulating Filling and Adjustment</a>). Any existing input line trap in the
+environment is replaced. Without arguments, <code class="code">it</code> and <code class="code">itc</code>
+clear any input line trap that has not yet sprung.
+</p>
+<p>Consider a macro &lsquo;<samp class="samp">.ST <var class="var">s n</var></samp>&rsquo; which sets the next
+<var class="var">n</var>&nbsp;input lines in the font style&nbsp;<var class="var">s</var>.
+</p>
+<div class="example">
+<div class="group"><pre class="example-preformatted">.de ST \&quot; Use style $1 for next $2 text lines.
+. it \\$2 ES
+. ft \\$1
+..
+.de ES \&quot; end ST
+. ft R
+..
+.ST I 1
+oblique
+face
+.ST I 1
+oblique\c
+face
+ &rArr; <i class="i">oblique</i> face <i class="i">oblique</i>face &nbsp;<span class="r">(second &ldquo;face&rdquo; upright)</span>
+</pre></div></div>
+
+<a class="index-entry-id" id="index-input-line-traps-and-interrupted-lines-_0028itc_0029"></a>
+<a class="index-entry-id" id="index-interrupted-lines-and-input-line-traps-_0028itc_0029"></a>
+<a class="index-entry-id" id="index-traps_002c-input-line_002c-and-interrupted-lines-_0028itc_0029"></a>
+<a class="index-entry-id" id="index-lines_002c-interrupted_002c-and-input-line-traps-_0028itc_0029"></a>
+<p>Unlike the <code class="code">ce</code> and <code class="code">rj</code> requests, <code class="code">it</code> counts lines
+interrupted with the <code class="code">\c</code> escape sequence separately (see <a class="pxref" href="Line-Continuation.html">Line Continuation</a>); <code class="code">itc</code> does not. To see the difference, let&rsquo;s
+change the previous example to use <code class="code">itc</code> instead.
+</p>
+<div class="example">
+<div class="group"><pre class="example-preformatted"><span class="r">&hellip;</span>
+. itc \\$2 ES
+<span class="r">&hellip;</span>
+ &rArr; <i class="i">oblique</i> face <i class="i">obliqueface</i> &nbsp;<span class="r">(second &ldquo;face&rdquo; oblique)</span>
+</pre></div></div>
+
+<p>You can think of the <code class="code">ce</code> and <code class="code">rj</code> requests as implicitly
+creating an input line trap with <code class="code">itc</code> that schedules a break when
+the trap is sprung.
+</p>
+<div class="example">
+<div class="group"><pre class="example-preformatted">.de BR
+. br
+. <i class="slanted">internal: disable centering-without-filling</i>
+..
+.
+.de ce
+. if \\n[.br] .br
+. itc \\$1 BR
+. <i class="slanted">internal: enable centering-without-filling</i>
+..
+</pre></div></div>
+
+<p>Let us consider in more detail the sorts of input lines that are or are
+not &ldquo;productive&rdquo;.
+</p>
+<div class="example">
+<div class="group"><pre class="example-preformatted">.de Trap
+TRAP SPRUNG
+..
+.de Mac
+.if r a \l'5n'
+..
+.it 2 Trap
+.
+foo
+.Mac
+bar
+baz
+.it 1 Trap
+.sp \&quot; moves, but does not write or draw
+qux
+.itc 1 Trap
+\h'5n'\c \&quot; moves, but does not write or draw
+jat
+</pre></div></div>
+
+<p>When &lsquo;<samp class="samp">Trap</samp>&rsquo; gets called depends on whether the &lsquo;<samp class="samp">a</samp>&rsquo; register is
+defined; the control line with the <code class="code">if</code> request may or may not
+produce written output. We also see that the spacing request <code class="code">sp</code>,
+while certainly affecting the output, does not spring the input line
+trap. Similarly, the horizontal motion escape sequence <code class="code">\h</code> also
+affected the output, but was not &ldquo;written&rdquo;. Observe that we had to
+follow it with <code class="code">\c</code> and use <code class="code">itc</code> to prevent the newline at
+the end of the text line from causing a word break, which, like an
+ordinary space character, counts as written output.
+</p>
+<div class="example">
+<div class="group"><pre class="example-preformatted">$ groff -Tascii input-trap-example.groff
+ &rArr; foo bar TRAP SPRUNG baz
+ &rArr;
+ &rArr; qux TRAP SPRUNG jat TRAP SPRUNG
+$ groff -Tascii -ra1 input-trap-example.groff
+ &rArr; foo _____ TRAP SPRUNG bar baz
+ &rArr;
+ &rArr; qux TRAP SPRUNG jat TRAP SPRUNG
+</pre></div></div>
+</dd></dl>
+
+<p>Input line traps are associated with the environment
+(see <a class="pxref" href="Environments.html">Environments</a>); switching to another environment suspends the
+current input line trap, and going back resumes it, restoring the count
+of qualifying lines enumerated in that environment.
+</p>
+
+</div>
+<hr>
+<div class="nav-panel">
+<p>
+Next: <a href="Blank-Line-Traps.html">Blank Line Traps</a>, Previous: <a href="Diversion-Traps.html">Diversion Traps</a>, Up: <a href="Traps.html">Traps</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>