📄 ch12_06.htm
字号:
There is a limit of around 128 total characters for the totallist of <em class="emphasis">words</em>.</p></td></tr><tr><td valign="top"><a name=".hy">.hy</a></td><td><p><tt class="literal">.hy</tt> <em class="replaceable"><tt>n</tt></em></p><p>Turn hyphenation on (<em class="emphasis">n</em> <img src="figs/ge.gif" alt="Figure " /> 1) or off (<em class="emphasis">n</em> = 0).See also <b class="emphasis-bold"><a href="#.nh">.nh</a></b>.</p><h4 class="refsect2">Values for n</h4><table border="1" cellpadding="3"><tr><td><tt class="literal">1</tt></td><td><p>Hyphenate whenever necessary.</p></td></tr><tr><td><tt class="literal">2</tt></td><td><p>Don't hyphenate last word on page.</p></td></tr><tr><td><tt class="literal">4</tt></td><td><p>Don't split off first two characters.</p></td></tr><tr><td><tt class="literal">8</tt></td><td><p>Don't split off last two characters.</p></td></tr><tr><td><tt class="literal">14</tt></td><td><p>Use all three restrictions. </p></td></tr></table><p></td></tr><tr><td valign="top"><a name=".ie">.ie</a></td><td><p><tt class="literal">.ie</tt> [<tt class="literal">!</tt>]<em class="replaceable"><tt>condition anything</em></p><p><tt class="literal">.el</tt> <em class="replaceable">anything</tt></em></p><p>If portion of <em class="emphasis">if-else</em>. If <em class="emphasis">condition</em> istrue, do <em class="emphasis">anything</em>. Otherwise do <em class="emphasis">anything</em>following <tt class="literal">.el</tt> request. <tt class="literal">.ie</tt>/<tt class="literal">.el</tt>pairs can be nested. Syntax for <em class="emphasis">condition</em> is describedunder <b class="emphasis-bold">.if</b>.</p><h4 class="refsect2">Example</h4><p>If first argument isn't 2, columns are 1.8 inches wide; otherwise,columns are 2.5 inches wide:</p><blockquote><pre class="code">.ie !'\\$1'2' .MC 1.8i 0.2i.el .MC 2.5i 0.25i</pre></blockquote></td></tr><tr><td valign="top"><a name=".if">.if</a></td><td><p><tt class="literal">.if</tt> [<tt class="literal">!</tt>]<em class="replaceable"><tt>condition</em> <em class="replaceable">anything</tt></em></p><p>If <em class="emphasis">condition</em> is true, do <em class="emphasis">anything</em>. The presence of an<tt class="literal">!</tt> negates the condition.If <em class="emphasis">anything</em> runs over more than one line, it must be delimited by<tt class="literal">\{</tt> and <tt class="literal">\}</tt>.</p><h4 class="refsect2">Conditions</h4><table border="1" cellpadding="3"><tr><td><tt class="literal">o</tt></td><td><p>True if the page number is odd.</p></td></tr><tr><td><tt class="literal">e</tt></td><td><p>True if the page number is even.</p></td></tr><tr><td><tt class="literal">n</tt></td><td><p>True if the processor is <tt class="literal">nroff</tt>.</p></td></tr><tr><td><tt class="literal">t</tt></td><td><p>True if the processor is <tt class="literal">troff</tt>.</p></td></tr><tr><td><tt class="literal">"</tt><em class="replaceable"><tt>str1</em><tt class="literal">"</tt><em class="replaceable">str2</em><tt class="literal">"</tt></td><td><p>True if <em class="emphasis">str1</em> is identical to <em class="emphasis">str2</tt></em>. Often used to test the value of arguments passed to a macro.</p></td></tr><tr><td><em class="replaceable"><tt>expr</em></td><td><p>True if the value of expression <em class="emphasis">expr</tt></em> is greaterthan zero. </p></td></tr></table><p><h4 class="refsect2">Expressions</h4><p>Expressions typically contain number register interpolationsand can use any of the following operators:</p><table border="1" cellpadding="3"><tr><td><tt class="literal">+ -</tt></td><td><p>Addition, subtraction</p></td></tr><tr><td><tt class="literal">/ *</tt></td><td><p>Multiplication, division</p></td></tr><tr><td><tt class="literal">%</tt></td><td><p>Modulo</p></td></tr><tr><td><tt class="literal">< ></tt></td><td><p>Less than, greater than</p></td></tr><tr><td><tt class="literal"><= >=</tt></td><td><p>Less than or equal, greater than or equal</p></td></tr><tr><td><tt class="literal">= ==</tt></td><td><p>Equal</p></td></tr><tr><td><tt class="literal">!</tt></td><td><p>Logical negation</p></td></tr><tr><td><tt class="literal">&</tt></td><td><p>Logical AND</p></td></tr><tr><td><tt class="literal">:</tt></td><td><p>Logical OR</p></td></tr></table><p><p>Note: expressions are evaluated left to right;there is no operator precedence.Parentheses may be supplied to force a particular evaluation order.</p><h4 class="refsect2">Example</h4><p>Inside a macro definition,set the spacing and print the second argument.(The extra backslashes are necessary in <tt class="literal">\\$2</tt>.One backslash is stripped off when the macro is first read,so the second one is needed for it to be evaluated correctly when themacro is executed.)</p><blockquote><pre class="code">.if t .nr PD 0.5v \" Set spacing between ms paragraphs.if !"\\$2"" \{ \" If arg 2 is non null, print it in bold\fB\\$2\fP\}</pre></blockquote></td></tr><tr><td valign="top"><a name=".ig">.ig</a></td><td><p><tt class="literal">.ig</tt> [<em class="replaceable"><tt>yy</tt></em>]</p><p>Ignore following text, up to line beginning with <tt class="literal">.</tt><em class="emphasis">yy</em>(default is <tt class="literal">..</tt>, as with <tt class="literal">.de</tt>). Useful forcommenting out large blocks of text or macro definitions.</p></td></tr><tr><td valign="top"><a name=".in">.in</a></td><td><p><tt class="literal">.in</tt> [[<tt class="literal">±</tt>]<em class="replaceable"><tt>n</tt></em>]</p><p>Set indent to <em class="emphasis">n</em> or increment indent by ±<em class="emphasis">n</em>. If noargument, restore previous indent. Current indent is stored inregister <tt class="literal">.i</tt>. Default scale is ems.</p></td></tr><tr><td valign="top"><a name=".it">.it</a></td><td><p><tt class="literal">.it</tt> <em class="replaceable"><tt>n xx</tt></em></p><p>Set trap for input-line count, so as to invoke macro <em class="emphasis">xx</em> after <em class="emphasis">n</em> lines of input text have been read.</p></td></tr><tr><td valign="top"><a name=".lc">.lc</a></td><td><p><tt class="literal">.lc</tt> <em class="replaceable"><tt>c</tt></em></p><p>Set leader repetition character(value for <tt class="literal">\a</tt>)to <em class="emphasis">c</em> instead of <tt class="literal">.</tt> (dot). </p></td></tr><tr><td valign="top"><a name=".lf">.lf</a></td><td><p><tt class="literal">.lf</tt> <em class="replaceable"><tt>n filename</tt></em></p><p>Set the line number and filename for subsequent error messages to<em class="emphasis">n</em> and <em class="emphasis">filename</em>(recent versions of <tt class="literal">ditroff</tt> only).Modifies registers <tt class="literal">.c</tt> and <tt class="literal">.F</tt>.</p></td></tr><tr><td valign="top"><a name=".lg">.lg</a></td><td><p><tt class="literal">.lg</tt> <em class="replaceable"><tt>n</tt></em></p><p>Turn ligature mode on if <em class="emphasis">n</em> is absent or nonzero.</p></td></tr><tr><td valign="top"><a name=".ll">.ll</a></td><td><p><tt class="literal">.ll</tt> [[<tt class="literal">±</tt>]<em class="replaceable"><tt>n</tt></em>]</p><p>Set line length to <em class="emphasis">n</em> or increment line length by ±<em class="emphasis">n</em>.If no argument, restore previous line length. Current line length is stored in register <tt class="literal">.l</tt>. Default valueis 6.5 inches.</p></td></tr><tr><td valign="top"><a name=".ls">.ls</a></td><td><p><tt class="literal">.ls</tt> [<em class="replaceable"><tt>n</tt></em>]</p><p>Set line spacing to <em class="emphasis">n</em>.If no argument, restore previous line spacing. Initial value is 1.</p><h4 class="refsect2">Example</h4><blockquote><pre class="code">.ls 2 <i class="lineannotation">Produce double-spaced output</i></pre></blockquote></td></tr><tr><td valign="top"><a name=".lt">.lt</a></td><td><p><tt class="literal">.lt</tt> [<em class="replaceable"><tt>n</tt></em>]</p><p>Set title length to <em class="emphasis">n</em> (default scale is ems).If no argument, restore previous value.</p></td></tr><tr><td valign="top"><a name=".mc">.mc</a></td><td><p><tt class="literal">.mc</tt> [<em class="replaceable"><tt>c</em>] [<em class="replaceable">n</tt></em>]</p><p>Set margin character to <em class="emphasis">c</em>and place it <em class="emphasis">n</em> spaces to the right of margin.If <em class="emphasis">c</em> is missing, turn margin character off.If <em class="emphasis">n</em> is missing,use previous value. Initial value for <em class="emphasis">n</em>is .2 inches in <tt class="literal">nroff</tt> and 1 em in <tt class="literal">troff</tt>.</p><p>This command is usually used for producing “change bars”in documents.See <b class="emphasis-bold"><a href="ch02_01.htm#diffmk">diffmk</a></b> in <a href="ch02_01.htm">Chapter 2</a>.</p></td></tr><tr><td valign="top"><a name=".mk">.mk</a></td><td><p><tt class="literal">.mk</tt> [<em class="replaceable"><tt>r</tt></em>]</p><p>Mark current vertical place in register <em class="emphasis">r</em>. Return to mark with <tt class="literal">.rt</tt> or <tt class="literal">.sp|\n</tt><em class="replaceable"><tt>r</tt></em>.</p></td></tr><tr><td valign="top"><a name=".na">.na</a></td><td><p><tt class="literal">.na</tt></p><p>Do not adjust margins.Current adjustment mode is stored in register <tt class="literal">.j</tt>.See also <b class="emphasis-bold"><a href="#.ad">.ad</b>.</p></td></tr><tr><td valign="top"><a name=".ne">.ne</a></td><td><p><tt class="literal">.ne</tt> <em class="replaceable"><tt>n</tt></em></p><p>If <em class="emphasis">n</em> lines do not remain on this page, start a new page.</p></td></tr><tr><td valign="top"><a name=".nf">.nf</a></td><td><p><tt class="literal">.nf</tt></p><p>Do not fill or adjust output lines. See also <b class="emphasis-bold"><a href="#.ad">.ad</a></b> and <b class="emphasis-bold"><a href="#.fi">.fi</b>.</p> </td></tr><tr><td valign="top"><a name=".nh">.nh</a></td><td><p><tt class="literal">.nh</tt></p><p>Turn hyphenation off. See also <b class="emphasis-bold"><a href="#.hy">.hy</b>.</p></td></tr><tr><td valign="top"><a name=".nm">.nm</a></td><td><p><tt class="literal">.nm</tt> [<em class="replaceable"><tt>n m s i</tt></em>]</p><p>Number output lines (if <em class="emphasis">n</em> <img src="figs/ge.gif" alt="Figure " /> 0), or turn numbering off (if <em class="emphasis">n</em> = 0). ±<em class="emphasis">n</em> sets initial line number; <em class="emphasis">m</em> sets numbering interval;<em class="emphasis">s</em> sets separation of numbers and text; <em class="emphasis">i</em> sets indent of text.Useful for code segments, poetry, etc. See also <b class="emphasis-bold"><a href="#.nn">.nn</b>.</p></td></tr><tr><td valign="top"><a name=".nn">.nn</a></td><td><p><tt class="literal">.nn</tt> <em class="replaceable"><tt>n</tt></em></p><p>Do not number next <em class="emphasis">n</em> lines, but keep track of numbering sequence,which can be resumed with <tt class="literal">.nm +0</tt>. See also <b class="emphasis-bold"><a href="#.nm">.nm</b>.</p></td></tr><tr><td valign="top"><a name=".nr">.nr</a></td><td><p><tt class="literal">.nr</tt> <em class="replaceable"><tt>r n </em>[<em class="replaceable">m</tt></em>]</p><p>Assign value <em class="emphasis">n</em> to number register <em class="emphasis">r</em>and optionally set auto-increment to <em class="emphasis">m</em>.</p><h4 class="refsect2">Examples</h4><p>Set the “box width” register to line length minus indent:</p><blockquote><pre class="code">.nr BW \n(.l-\n(.i</pre></blockquote><p>Set page layout values for <em class="emphasis">ms</em> macros:</p><blockquote><pre class="code">.nr LL 6i <i class="lineannotation">Line length</i>.nr PO ((8.25i-\n(LLu)/2u) <i class="lineannotation">Page offset</i>.nr VS \n(PS+2 <i class="lineannotation">Vertical spacing</i></pre></blockquote><p>In <tt class="literal">groff</tt>, auto-increment a footnote-counter register:</p><blockquote><pre class="code">.nr footcount 0 1 <i class="lineannotation"> Reset to zero on each page</i></pre></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -