📄 ch18.htm
字号:
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="105" ALIGN="LEFT"><TT>r</TT> </TD>
<TD ALIGN="LEFT">Right-justified entry </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="105" ALIGN="LEFT"><TT>c</TT> </TD>
<TD ALIGN="LEFT">Centered entry </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="105" ALIGN="LEFT"><TT>n</TT> </TD>
<TD ALIGN="LEFT">Numeric entries lined up by units </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="105" ALIGN="LEFT"><TT>a</TT> </TD>
<TD ALIGN="LEFT">Aligned on left so that widest entry is centered </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="105" ALIGN="LEFT"><TT>s<BR>
</TT></TD>
<TD ALIGN="LEFT">Previous column format applies across rest of<BR>
</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="105" ALIGN="LEFT"> <P>
</TD>
<TD ALIGN="LEFT">column<BR>
</TD>
</TR>
</TABLE>
A sample format section consists of a letter for each column, unless the entry is
repeated across the page. A sample format section looks like this:</P>
<PRE><FONT COLOR="#0066FF">c s s
l n n .
</FONT></PRE>
<P>In this sample, the first line of the table is formatted with the first, second,
and third columns centered (the <TT>s</TT> repeats the previous entry). The second
and subsequent lines have the first entry left-justified, and the next two lined
up as numbers. The period ends the format section. If you like, you can put all these
format keyletters on a single line, using a comma to separate the lines:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">c s s, l n n .
</FONT></PRE>
<P>A table formatted by this set of commands looks like this (with random numbers
inserted to show the lineup):</P>
<PRE><FONT COLOR="#0066FF"> Centered_Title
Entry1 12.23 231.23
Entry2 3.23 45.2
Entry3 45 123.2344
Entry4 3.2 2.3
</FONT></PRE>
<P>Numeric data is usually aligned so that the decimal places are in a vertical column.
However, sometimes you want to override this format by forcing a movement. The special
character <TT>\&</TT> is used to move the decimal point. The special characters
disappear when the table is printed. To show the effect of this special character,
the following sample shows normal formatting and entries with the special character
embedded (the first column is the source input, and the second is the generated output):<FONT
COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">14.5 14.5
13 13
1.253 1.253
3\&1.21 31.21
53.2 53.2
6\&2.23 62.23
</FONT></PRE>
<P>You can see that the numbers usually line up with the decimal point in a vertical
row, except where moved over by the <TT>\&</TT> characters. Even if a number
has no decimal point specified (as in the second line of the example), it is lined
up as though one were present after the last digit.</P>
<P>The following are a few additional keyletters that can be used to create special
formats and make the tables more attractive:
<TABLE BORDER="0">
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="102" ALIGN="LEFT"><TT>_</TT> </TD>
<TD ALIGN="LEFT">Horizontal line in place of column entry. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="102" ALIGN="LEFT"><TT>=</TT> </TD>
<TD ALIGN="LEFT">Double horizontal line in place of column entry. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="102" ALIGN="LEFT"><TT>|</TT> </TD>
<TD ALIGN="LEFT">Between column entries, draws a vertical line between columns. Before the first keyletters,
draws a line to the left of the table. After the last keyletters, draws a line to
the right of the table. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="102" ALIGN="LEFT"><TT>||</TT> </TD>
<TD ALIGN="LEFT">Between column entries, draws a double vertical line. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="102" ALIGN="LEFT"><TT>e/E</TT> </TD>
<TD ALIGN="LEFT">Sets equal width columns. All columns that have a keyletter followed by <TT>e</TT>
or <TT>E</TT> are set to the same width. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="102" ALIGN="LEFT"><TT>f/F</TT> </TD>
<TD ALIGN="LEFT">Followed by a font name or number, changes the entry to the font specified. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="102" ALIGN="LEFT"><TT>n</TT> </TD>
<TD ALIGN="LEFT">Any number following a keyletter. Indicates the amount of separation between columns.
</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="102" ALIGN="LEFT"><TT>p/P</TT> </TD>
<TD ALIGN="LEFT">Followed by a number, changes the point size of the entry to the specified number.
Increments acceptable. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="102" ALIGN="LEFT"><TT>t/T</TT> </TD>
<TD ALIGN="LEFT">Vertically spanned items begin at the top line. Normally, vertically spanning items
(more than one line in the table) are centered in the vertical range. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="102" ALIGN="LEFT"><TT>v/V</TT> </TD>
<TD ALIGN="LEFT">Followed by a number, gives vertical line spacing. </TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="102" ALIGN="LEFT"><TT>w/W<BR>
</TT></TD>
<TD ALIGN="LEFT">Followed by a number, sets the width.<BR>
</TD>
</TR>
</TABLE>
The order of these characters on the format line is not important, although the spacing
between each format identifier must still be respected. Multiple letters can be used.
The entry<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">np14w(2.5i)fi
</FONT></PRE>
<P>sets the numeric entry (<TT>n</TT>) in italics (<TT>fi</TT>), with a point size
of 14 (<TT>p14</TT>) and a minimum column width of 2.5 inches (<TT>w(2.5i)</TT>).</P>
<P>You may need to change the format of a table midway through--for example, to present
summaries. If you must change the format, use the <TT>.T&</TT> (table continue)
command.
<CENTER>
<H4><A NAME="Heading19<FONT COLOR="#000077">Data</FONT></H4>
</CENTER>
<P>Data for the table is entered after all the format specifications have been completed.
Data for columns is separated by tabs or any other character indicated in the tabs
option. Each line of data is one line of the table. Long lines of data can be broken
over several lines of source by using the backslash character as the last character
in a line.</P>
<P>Any line starting with a period and followed by anything other than a number is
assumed to be a <TT>groff</TT> command and is ignored by the preprocessor. If a single
line of the data consists of only underscore or equal sign characters (single and
double lines), it is treated as extending the entire width of the table.</P>
<P>You can embed a block of text within a table by using the text commands of <TT>T{</TT>
(start of text) and <TT>}T</TT> (end of text). This lets you enter something that
can't be easily entered as a string separated by tabs.
<CENTER>
<H4><A NAME="Heading20<FONT COLOR="#000077">Examples</FONT></H4>
</CENTER>
<P>The best way to understand how to use <TT>gtbl</TT> is to look at some simple
examples. Here's a basic table command:</P>
<PRE><FONT COLOR="#0066FF">.TS
doublebox;
c c c, l l n.
Name Dept Phone
Joe 8A 7263
Mike 9F 2635
Peter 2R 2152
Yvonne 2B 2524
.TE
</FONT></PRE>
<P>All of the entries in the data section are separated by tabs. This produces a
table with three columns, the first line of which is centered text. The rest of the
table has the first and second column left-justified, and the last column aligned
by decimal point (there are none in this case). The entire table is surrounded by
two boxes.</P>
<P>A slightly more complex example uses a table title, followed by a row of column
headings, and then the data. Separate each element in the table by a box in this
case:<FONT COLOR="#0066FF"></FONT>
<PRE><FONT COLOR="#0066FF">.TS
allbox;
c s s
c c c
n n n .
Division Results
East West North
15 12 14
12 12 18
36 15 24
.TE
</FONT></PRE>
<P>Try typing in these examples, or create your own, to see what effect the different
commands have. When you've started using <TT>gtbl</TT>, it isn't that difficult.
<CENTER>
<H3><A NAME="Heading21<FONT COLOR="#000077">Summary</FONT></H3>
</CENTER>
<P>Although word processors have made utilities such as <TT>geqn</TT> and <TT>gtbl</TT>
less popular than they used to be, some diehard UNIX people still like to use them.
There are times when you might not be able to produce an equation the way you want
with your favorite word processor, so you might have to return to the basics. Also,
because word processors capable of fancy formulas tend to be expensive, utilities
such as <TT>geqn</TT> and <TT>gtbl</TT> are ideal for the occasional user who doesn't
want to spend a lot of money on a seldom-used tool.
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -