rhl18.htm
来自「linux的初学电子书」· HTM 代码 · 共 1,395 行 · 第 1/3 页
HTM
1,395 行
<BR>
<P>You can use sqrt quite easily. For example, the command
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">sqrt a+c - 1 over sqrt {alpha + beta}</FONT></PRE>
<P>has the first square root sign over a+c, and the second over the part in braces.
<BR>
<BR>
<A NAME="E69E247"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Summations, Set Theory, and Integrals</B></FONT></CENTER></H4>
<BR>
<P>To produce a summation, use the keyword sum and the keywords from and to to show the upper and lower parts of the command. For example, use the command
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">sum from x=1 to x=100 x sup 2</FONT></PRE>
<P>to create the formula for summing x squared over the range 1 to 100. If you want to use a special word, use braces:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">sum from x=1 to {x= inf} x sup 2</FONT></PRE>
<P>This is the same command, except summing from 1 to infinity. The braces ensure that the to component is properly interpreted. If no from or to component is specified, they are not printed.
<BR>
<P>To use integrals, the keyword int is used, and can again take a from argument:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">lim from n=1 xy sup 3 = 9</FONT></PRE>
<P>Other reserved words for geqn are used with set theory. You can use the keywords union and inter for the union and intersect of sets.
<BR>
<BR>
<A NAME="E69E248"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Brackets, Bars, and Piles</B></FONT></CENTER></H4>
<BR>
<P>As equations get more complicated, you need to use more brackets and braces. You can generate brackets ([]), braces ({}), and parentheses (()) as needed using the left and right commands:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">left { b over d+1} = left ( alpha over {beta + gamma} )</FONT></PRE>
<P>This produces large braces, and parentheses are required to surround the terms. You can nest these, of course, with geqn adjusting the sizes properly. Braces are usually bigger than brackets and parentheses.
<BR>
<P>For floor and ceiling characters, use the left floor, right floor, left ceiling, and right ceiling commands. For example:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">left ceiling x over alpha right ceiling > left floor beta over 2 right floor</FONT></PRE>
<P>draws the equation with the proper vertical bars and ceiling and floor markers.
<BR>
<P>To create a pile of elements, use the reserved word pile. The following example shows the usage best:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">X = left [ pile { a above b above c } right ]</FONT></PRE>
<P>This produces output with the three elements a, b, and c stacked vertically within big braces.
<BR>
<BR>
<A NAME="E69E249"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Matrices</B></FONT></CENTER></H4>
<BR>
<P>To make a matrix requires a little more work. You could probably make a matrix using the pile command, but if the elements are not of equal height, they will not line up. For that reason, use the keyword matrix. The general format is
<BR>
<PRE>
<FONT COLOR="#000080">matrix {
ccol { elements }
ccol { elements }</FONT></PRE>
<P>in which ccol produces centered columns. For left-adjusted columns, use lcol; rcol produces right-adjusted columns. The elements are specified individually. For example, the command
<BR>
<PRE>
<FONT COLOR="#000080">matrix {
ccol { x sub 1 above y sub 1 }
ccol { x sub 2 above y sub 2 }</FONT></PRE>
<P>produces the matrix
<BR>
<PRE>
<FONT COLOR="#000080">x1 x2
y1 y2</FONT></PRE>
<P>All matrices must have the same number of elements in each column or geqn can't process the matrix properly.
<BR>
<BR>
<A NAME="E69E250"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Quoted Text</B></FONT></CENTER></H4>
<BR>
<P>Any characters placed within quotation marks are not interpreted by geqn. This is useful for text strings that may contain reserved words, such as the following:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">italics "beta" = beta + gamma</FONT></PRE>
<P>Here, the word beta will appear in italic without being converted to the beta character.
<BR>
<BR>
<A NAME="E69E251"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Character Changes</B></FONT></CENTER></H4>
<BR>
<P>You can change font and point size with geqn in much the same way as with groff. The default setting is usually Roman 10 point. If you want to set bold characters, use the keyword bold; italic sets italic font.
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">x=y bold alpha</FONT></PRE>
<P>You can also use the keyword fat, which widens the character (useful for things such as grad characters). These reserved words affect only what immediately follows, so you must use braces if the area to be changed is more than a single block of
characters.
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">x=y*2 bold {alpha + gamma}</FONT></PRE>
<P>To change the size of characters, use the size keyword:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">size 16 {alpha + beta}</FONT></PRE>
<P>This sets the enclosed text in 16-point size. Incremental changes are acceptable.
<BR>
<P>To affect the entire equation, you can use the gsize (global size) and gfont (global font) commands at the start of the geqn block:
<BR>
<PRE>
<FONT COLOR="#000080">.EQ
gsize 14
gfont H
....</FONT></PRE>
<P>This makes it easy to format the equations however you wish.
<BR>
<BR>
<A NAME="E69E252"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Using </B><B>geqn</B></FONT></CENTER></H4>
<BR>
<P>As you have seen, geqn is quite friendly and easy to use, especially if you are used to writing out equations longhand. You should play around with the system and learn the different features. There are more commands available within geqn, but the main
ones have been shown to you. For more information, check the man pages or a good troff book that includes eqn.
<BR>
<BR>
<A NAME="E68E125"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>gtbl</B></FONT></CENTER></H3>
<BR>
<P>The gtbl routine is designed to help in the preparation of charts, multicolumn lists, and any other material presented in a tabular format. The gtbl commands are not difficult to work with, but can be awkward to learn, so studying examples is the best
method.
<BR>
<P>To use gtbl, two special commands are used to indicate to groff that the area between the two commands is to be processed as gtbl instructions. These two key commands are .TS (table start) and .TE (table end). Commands between these two are processed by
gtbl first, which converts the gtbl commands to groff commands; then, the source is passed to groff.
<BR>
<P>Tables are independent of each other with gtbl, meaning that each must contain all the information for formatting the data within the table and can't rely on a previous format. Tables contain three types of information: text for the table itself,
options that control the behavior of gtbl, and formatting commands to lay out the table itself. The general format of a gtbl source code section is as follows:
<BR>
<PRE>
<FONT COLOR="#000080">.TS
options;
format.
data
.TE</FONT></PRE>
<P>Let's look at the important parts of the gtbl layout first, and then see how they are combined to produce finished tables.
<BR>
<BR>
<A NAME="E69E253"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Executing </B><B>gtbl</B></FONT></CENTER></H4>
<BR>
<P>Because gtbl is a preprocessor, it is invoked on the source file, and then the results are passed to groff. The simplest way to do this is with the command
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">gtbl filename | groff</FONT></PRE>
<P>in which the gtbl preprocessor runs against the source in filename and then sends the output to groff. If you are processing more than one file at a time, or you need to send the output of gtbl to another preprocessor, such as geqn, you use piping
slightly differently. The command
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">gtbl filename | geqn | groff</FONT></PRE>
<P>sends the output to geqn and then to groff.
<BR>
<BR>
<A NAME="E69E254"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Options</B></FONT></CENTER></H4>
<BR>
<P>There can be a single line of options after a .TS command that affects the entire table. Any options must follow the .TS command. If more than one option is specified, they must be separated by spaces, commas, or tabs, and terminate in a semicolon. gtbl
accepts the following options:
<BR>
<TABLE BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 WIDTH="100%" CELLPADDING=2 >
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
center
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Centers the table (default is left-justified).</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
expand
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Makes tables as wide as current line length.</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
box
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Encloses the table in a box.</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
allbox
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Encloses each element of the table in a box.</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
doublebox
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Encloses the table in two boxes.</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
tab (n)
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Uses n instead of a tab to separate data.</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
linesize (n)
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Uses point size n for lines or rules.</FONT>
<TR>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?