⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 326-330.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:
<HTML>

<HEAD>

<TITLE>Linux Unleashed, Third Edition:groff</TITLE>

<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!--ISBN=0672313723//-->

<!--TITLE=Linux Unleashed, Third Edition//-->

<!--AUTHOR=Tim Parker//-->

<!--PUBLISHER=Macmillan Computer Publishing//-->

<!--IMPRINT=Sams//-->

<!--CHAPTER=17//-->

<!--PAGES=326-330//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="323-325.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="../ch18/331-335.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H3><A NAME="Heading9"></A><FONT COLOR="#000077">Using mm</FONT></H3>

<P>The <TT>mm</TT> (memorandum macros) package is not really part of <TT>nroff</TT> or <TT>troff</TT>, although both can use it. The <TT>mm</TT> program reads a source file much as <TT>groff</TT> does and translates it to output. Many of the <TT>mm</TT> macros are used for man pages. Indeed, many users find the <TT>nroff</TT> and <TT>troff</TT> commands too awkward or complicated, whereas <TT>mm</TT> is fully able to meet all their basic formatting needs.</P>

<P>To add <TT>mm</TT> commands, use the period in the first column as with <TT>groff</TT>. The <TT>mm</TT> macros are usually quite simple and easy to work with. Let&#146;s look at the most important of them here.</P>

<H4 ALIGN="LEFT"><A NAME="Heading10"></A><FONT COLOR="#000077">Paragraphs and Headers</FONT></H4>

<P>Like <TT>groff</TT>, <TT>mm</TT> runs text together when reformatting, regardless of line breaks in the source file. To force a new paragraph, use the <TT>.P</TT> command. It forces a line break and adds a blank line to the output. Paragraphs are usually formatted so that they are flush left.</P>

<P>Headings are created with the <TT>.H</TT> command. For example, the command</P>

<!-- CODE SNIP //-->

<PRE>

.H This is a Heading

</PRE>

<!-- END CODE SNIP //-->

<P>creates a break, outputs the heading text in bold, and leaves a bit of a space between the heading and the text that follows it.

</P>

<P>There can be seven levels of headings; 1 is the highest and 7 is the lowest. To specify the heading level, add the number as the first argument after the <TT>.H</TT> command:</P>

<!-- CODE SNIP //-->

<PRE>

.H 2 This is a level 2 heading

</PRE>

<!-- END CODE SNIP //-->

<P>The <TT>mm</TT> heading macro numbers the headings automatically, although you can suppress the numbering with the <TT>.HU</TT> (heading unnumbered) command. To reset the numbering (at a section break, for example), use the <TT>.nr</TT> (number register) command followed by the heading level and the number to use. For example, the command</P>

<!-- CODE SNIP //-->

<PRE>

.nr H2 1

</PRE>

<!-- END CODE SNIP //-->

<P>restarts the numbering of second-level headings at 1.

</P>

<H4 ALIGN="LEFT"><A NAME="Heading11"></A><FONT COLOR="#000077">Lists</FONT></H4>

<P>Lists are easily created in <TT>mm</TT> with the <TT>.LI</TT> (list) command and the <TT>.LE</TT> (list end) command. This creates a bulleted list. For example, the command</P>

<!-- CODE SNIP //-->

<PRE>

.LI

thing 1

.LI

thing 2

.LE

thing 3

</PRE>

<!-- END CODE SNIP //-->

<P>creates a bulleted list of the three bits of text. You can create a list with dashes instead of bullets using the <TT>.DL</TT> (dash list) command. The mark list command, <TT>.ML</TT>, creates a list with the character of your choice.</P>

<P>If you want a numbered list, use the <TT>.AL</TT> (automatic list) command. Lists with no arguments are created with Arabic numbers. To create an alphabetical list (A, B, C, and so on), use the macro command <TT>.AL A</TT>. Roman numerals (i, ii, iii, iv, v, and so on) can be used with the <TT>.AL I</TT> command.</P>

<P>You can nest list types as necessary. For example, the command</P>

<!-- CODE //-->

<PRE>

.AL I

.LI

groff

.AL

.LI

macros

.LI

mm

.LE

.LI

gtbl

.LI

geqn

.LE

</PRE>

<!-- END CODE //-->

<P>creates output that looks like this:

</P>

<!-- CODE SNIP //-->

<PRE>

I. groff

   1. macros

   2. mm

II.  gtbl

III. geqn

</PRE>

<!-- END CODE SNIP //-->

<P>It&#146;s important to be careful when terminating each list with an <TT>.LE</TT> command to ensure that you terminate the proper one. Experimentation and practice help you get the hang of this. You may have noticed that it takes a lot of commands to make a little list!</P>

<H4 ALIGN="LEFT"><A NAME="Heading12"></A><FONT COLOR="#000077">Font Changes</FONT></H4>

<P>Changing fonts with <TT>mm</TT> is quite simple. When working from a period command, the command <TT>.B</TT> (bold) creates bold text until an <TT>.R</TT> (restore) command, while <TT>.I</TT> (italic) does the same until an <TT>.R</TT> command. If you want to bold or italicize only one word, you can do it after the period command, as this example shows:</P>

<!-- CODE //-->

<PRE>

This is normal text

.B

This is bold.

So is this.

.R

This is normal.

This is a single

.Bbold

word, though.

</PRE>

<!-- END CODE //-->

<P>When you change only one word, you don&#146;t need an <TT>.R</TT> command.</P>

<P>Changes can be performed within text in the same manner as with <TT>groff</TT>:</P>

<!-- CODE SNIP //-->

<PRE>

This is an \fIitalics set of words\fR until here.

</PRE>

<!-- END CODE SNIP //-->

<H4 ALIGN="LEFT"><A NAME="Heading13"></A><FONT COLOR="#000077">Footnotes</FONT></H4>

<P>To create a footnote, use the <TT>.FS</TT> (footnote start) and <TT>.FE</TT> (footnote end) commands. Every footnote on a single page will be collected and printed at the bottom. Footnotes are automatically numbered unless you specify another character:</P>

<!-- CODE //-->

<PRE>

This is normal text.

.FS

This is a footnote with its proper number in front of it.

.FE

This is more normal text.

.FS *

But this is a footnote marked with an asterisk.

.FE

This is even more normal text. At the bottom of the page

will be a numbered footnote and an asterisked footnote.

</PRE>

<!-- END CODE //-->

<P>You can use any valid character for the optional footnote mark, including special characters supported by <TT>groff</TT>.</P>

<H3><A NAME="Heading14"></A><FONT COLOR="#000077">Summary</FONT></H3>

<P>As you probably expect, there is a lot to both <TT>groff</TT> and <TT>mm</TT> that we haven&#146;t looked at. Because <TT>groff</TT> is seldom used these days, we covered only the most important aspects. As mentioned earlier, if you want to learn more about <TT>groff</TT> or <TT>mm</TT>, find a good reference book on the subject. From here you can learn more about:</P>

<DL>

<DD><TT>geqn</TT> and <TT>gtbl</TT> for more formatting of text, see Chapter 18, &#147;<TT>geqn</TT> and <TT>gtbl.</TT>&#148;

<DD>TeX and LaTeX, two powerful text formatters, see Chapter 19, &#147;<TT>TeX</TT> and <TT>LaTeX</TT>,&#148; and Chapter 20, &#147;Printing.&#148;

<DD>Setting up multimedia capabilities for your Linux system, see Chapter 21, &#147;Multimedia Linux.&#148;

</DL>

<P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="323-325.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="../ch18/331-335.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>





</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -