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

📄 ch17.htm

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTM
📖 第 1 页 / 共 2 页
字号:
switches, not surprisingly, to Roman italics. To return to the normal Roman font,



the command <TT>.ft R</TT> is used, although on most systems, <TT>.ft</TT> by itself



will suffice:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">This is in normal Roman font.



.ft B



This is bold.



.ft I



This is italics.



.ft



This is back to normal Roman font.



</FONT></PRE>



<P>You can switch fonts with a line-embedded command, too, using <TT>\f</TT> followed



by either <TT>I</TT> or <TT>B</TT>, switching back with <TT>R</TT> to the normal



font:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">This is normal, \fBbold\fR and \fIitalics\fR.



</FONT></PRE>



<P>Because underline wasn't supported on most system printers, underlined text was



converted to italics. The underline command <TT>.ux</TT> would italicize the next



x lines of text.</P>



<P>Because we now have many thousands more fonts to work with than Roman, we must



be able to change fonts within <TT>groff</TT>. The command to change fonts is <TT>.fp</TT>



(font physically mounted), which also requires a number to indicate what position



the font was mounted in the phototypesetter (old stuff, isn't it?). For example,



if Helvetica were mounted in font position three and we referred to it by the font



letter <TT>H</TT>, the command<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">.fp 3 H



</FONT></PRE>



<P>would instruct the phototypesetter to switch to Helvetica in font position three.



<TT>groff</TT> still retains these old-style commands.



<H4 ALIGN="CENTER"><A NAME="Heading8<FONT COLOR="#000077">Indenting and Line



Length</FONT></H4>



<P>The line length is set to default to 6.5 inches within <TT>groff</TT>. To override



this value, the <TT>.ll</TT> (line length) command is used with an argument indicating



the units. For example, the command<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">.ll 7i



</FONT></PRE>



<P>switches <TT>groff</TT> to use a seven-inch line length. The maximum length accepted



is usually about 7.5 inches, so to use paper wider than that you have to move the



left margin over to compensate with the <TT>.po</TT> (page offset) command. The value



<TT>.po 0</TT> sets the left margin as far over as is possible.</P>



<P>To indent text, you use the <TT>.in</TT> (indent) command. It takes a number and



an indicator of the units as arguments, as the following example shows:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">This is normal stuff.



.in 0.75I



This is indented three-quarters of an inch.



</FONT></PRE>



<P>To move the right margin to the left so that you can make a distinctive block



of text within a normal chunk, you use the <TT>.ll</TT> (line length) command you



saw earlier:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">This is normal text, and goes on and on.



Even more text that continues the tradition.



.in 1i



.ll -1i



This is now indented one inch to the left, and the



right margin is indented one inch from the normal right



margin.  This makes the text stand out a little.



.in -1i



.ll +1i



And this is back to normal.  The block will stand out nicely



amongst all this normal text.



</FONT></PRE>



<P>You will notice that we used relative movements of plus and minus a value in this



example to make it easier. This way, we don't have to measure the page. You can revert



to original values with the command <TT>.in</TT> and <TT>.ll</TT> with no arguments,



as well.</P>



<P>An indent and line-length change is effective until the next command changes it.



Sometimes you want to affect only a single line, though. If you want to indent only



a single line, use the <TT>.ti</TT> (temporary indent) command:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">This is really fine stuff.  You can tell, `cause I'm



still awake.



.ti 3i



This line is temporarily indented by three inches, but the



next line will be back to normal.



</FONT></PRE>



<P>Tabs are used to set column output. Usually, tabs are used with <TT>groff</TT>



only for unfilled text, which means material you would display in columns. Tab stops



are set, by default, every half inch. To override these values, you use the <TT>.ta</TT>



(tab) command. The command<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">.ta 1i 2i 3i 4i 5i 6i



</FONT></PRE>



<P>sets the tabs at every inch instead. You can think of the setting of tabs within



<TT>groff</TT> much as they are done on a typewriter, from left to right. Tabs are



usually set for columns of numbers or tables, but the <TT>groff</TT> macro <TT>gtbl</TT>



is much better at this. (You get a look at <TT>gtbl</TT> in the next chapter.)



<H4 ALIGN="CENTER"><A NAME="Heading9<FONT COLOR="#000077">Other Character Controls</FONT></H4>



<P>The <TT>groff</TT> system has special instructions for controlling the size of



individual letters, as well as formulas and special characters such as Greek letters.



However, because <TT>groff</TT> is not needed for most purposes these days, we'll



ignore the capabilities. If you want more information on how to provide these special



features, check the <TT>groff</TT> man pages or consult a good <TT>troff</TT> book.



<H3 ALIGN="CENTER"><A NAME="Heading10<FONT COLOR="#000077">Macros</FONT></H3>



<P>A macro is a shorthand notation for a set of commands or strings. Many commands



used to write man pages are macros. To give a practical example of a <TT>groff</TT>



macro, suppose we want every paragraph to start with a blank line and a temporary



indent of half an inch. The <TT>groff</TT> commands to do this are</P>



<PRE><FONT COLOR="#0066FF">.sp



.ti +.5i



</FONT></PRE>



<P>Instead of typing these two lines every paragraph, we can define a macro of one



character (or more) that does it for us.</P>



<P>To define the macro, we use the <TT>.de</TT> (define) command followed by the



name of the macro and the commands. It would look like this, placed somewhere at



the top of the source code:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">.de PP



.sp



.ti +.5I



..



</FONT></PRE>



<P>The last line with two periods indicates the end of the definition. Now, whenever



we use the command <TT>.PP</TT> it will be executed as the lines in the macro.







<DL>



	<DT></DT>



</DL>











<DL>



	<DD>



<HR>



<A NAME="Heading11<FONT COLOR="#000077"><B>WARNING:</B> </FONT>Make sure that



	you don't define a macro with the name of a reserved <TT>groff</TT> command, or the



	macro will not be executed.



<HR>







</DL>







<H3 ALIGN="CENTER"><A NAME="Heading12<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, you 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 and use. We



can look at the most important of them here.



<H4 ALIGN="CENTER"><A NAME="Heading13<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<FONT



COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">.H This is a Heading



</FONT></PRE>



<P>will create a break, output the heading text in bold, and leave 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:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">.H 2 This is a level 2 heading



</FONT></PRE>



<P>The <TT>mm</TT> heading macro will number 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<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">.nr H2 1</FONT></PRE>



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



<H4 ALIGN="CENTER"><A NAME="Heading14<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<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">.LI



thing 1



.LI



thing 2



.LE



thing 3



</FONT></PRE>



<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>



<PRE><FONT COLOR="#0066FF">.AL I



.LI



groff



.AL



.LI



macros



.LI



mm



.LE



.LI



gtbl



.LI



geqn



.LE



</FONT></PRE>



<P>will create output that looks like this:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">I.  groff



      1. macros



      2. mm



II.   gtbl



III.  geqn



</FONT></PRE>



<P>You have 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!



<H4 ALIGN="CENTER"><A NAME="Heading15<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 







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

<!-- begin footer information -->



</body></html>

⌨️ 快捷键说明

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