📄 ch19.htm
字号:
care about a \char 43 sign.
</FONT></PRE>
<P>is processed by <TT>TeX</TT> as follows:</P>
<PRE><FONT COLOR="#0066FF">TeX would interpret % as a comment symbol but it would not
care about a + sign.
</FONT></PRE>
<H4 ALIGN="CENTER"><A NAME="Heading8<FONT COLOR="#000077">Controlling Spacing</FONT></H4>
<P>You've seen how you can insert individual extra spaces in <TT>TeX</TT> files.
Now, let's examine how you can have more control over the spacing of larger portions
of text. <TT>TeX</TT> has a series of commands that recognize the following units
of measurement:</P>
<CENTER>
<P><BR>
<TABLE BORDER="0" WIDTH="298">
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="79" ALIGN="LEFT" VALIGN="TOP"><I>Unit</I></TD>
<TD ALIGN="LEFT" VALIGN="TOP"><I>Meaning</I></TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="79" ALIGN="LEFT" VALIGN="TOP">em</TD>
<TD ALIGN="LEFT" VALIGN="TOP">Approximately the width of the character M, depending on the font in use</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="79" ALIGN="LEFT" VALIGN="TOP">in</TD>
<TD ALIGN="LEFT" VALIGN="TOP">Inches</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="79" ALIGN="LEFT" VALIGN="TOP">pt</TD>
<TD ALIGN="LEFT" VALIGN="TOP">Points (1 inch equals 72.27 points)</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="79" ALIGN="LEFT" VALIGN="TOP">mm</TD>
<TD ALIGN="LEFT" VALIGN="TOP">Millimeters (1 inch equals 25.4 millimeters)</TD>
</TR>
</TABLE>
</P>
</CENTER>
<P>These units are used with decimal numbers to specify the amount of spacing that
you need. The <TT>\hskip</TT> command can insert a horizontal space on a line, like
this:</P>
<PRE><FONT COLOR="#0066FF">\tt From here \hskip 0.5in to there
</FONT></PRE>
<P>This produces the following output:</P>
<PRE><FONT COLOR="#0066FF">From here to there
</FONT></PRE>
<P>You can also supply a negative number, which moves the text following the <TT>\hskip</TT>
command to the left (the negative direction). The<TT> \hfil</TT> command distributes
horizontal space in a paragraph when space is available. The interesting thing about
the <TT>\hfil</TT> command is the fact that <TT>TeX</TT> inserts one implicitly for
each paragraph. Bearing this detail in mind, you can use this command to flush text
left or right, or center it on a line, like this:</P>
<PRE><FONT COLOR="#0066FF">
\noindent \hfil Some centered text. \par
</FONT></PRE>
<P>This is output as follows:</P>
<CENTER>
<PRE><FONT COLOR="#0066FF">Some centered text.
</FONT></PRE>
</CENTER>
<P>The <TT>\vskip</TT> command can insert a vertical space between paragraphs using
a given unit of measurement (much like <TT>\hskip</TT>). The command</P>
<PRE><FONT COLOR="#0066FF">\vskip 40mm
</FONT></PRE>
<P>places a vertical space of 40 millimeters between its preceding and succeeding
paragraphs. <TT>TeX</TT> also provides vertical skipping commands in convenient units:
<TT>\smallskip</TT>, <TT>\medskip</TT>, and <TT>\bigskip</TT>.</P>
<P>The vertical equivalent of <TT>\hfil</TT> is the <TT>\vfill</TT> command, which
can distribute vertical spaces between paragraphs when extra space (nontext) is available.
<TT>TeX</TT> assumes an implicit <TT>\vfill</TT> command at the end of a document.</P>
<P>You can also explicitly add line breaks and page breaks to your document with
the <TT>\break</TT> command. If this command appears within a paragraph, <TT>TeX</TT>
inserts a line break. If it appears between paragraphs, a page break is inserted.
Conversely, you can specify points in your document where you want the text to be
kept together and not broken across lines or pages. This is done by using the <TT>\nobreak</TT>
command.
<CENTER>
<H4><A NAME="Heading9<FONT COLOR="#000077">Page Layout</FONT></H4>
</CENTER>
<P>A page is composed of a header, footer, and body. The header and footer contain
information such as chapter title, section heading, and page number. The body is
where the main information in your document appears. By changing how this information
is ordered in your <TT>TeX</TT> document, you are actually designing the look of
the finished product.</P>
<P>The <TT>\headline</TT> and <TT>\footline</TT> commands both take arguments that
specify their content. The format of these commands is as follows:</P>
<PRE><FONT COLOR="#0066FF">\headline={parameters}
</FONT></PRE>
<P>The parameters could be a list of things such as a page number command and an
<TT>\hfil</TT> command:</P>
<PRE><FONT COLOR="#0066FF">\headline={\hfil \the\pageno}
\footline={\hfil}
</FONT></PRE>
<P>This pair of commands creates a right-justified page number and a blank footer
on each page.</P>
<P>You can change the size of the text box that <TT>TeX</TT> uses for paragraphs
by using the <TT>\hsize</TT> command. For instance, the text</P>
<PRE><FONT COLOR="#0066FF">\hsize=2in
This text is 2 inches wide but we could choose to make it wider or thinner.
</FONT></PRE>
<P>produces the following:</P>
<PRE><FONT COLOR="#0066FF">This text is 2 inches wide but we could choose to make it wider or thinner.
</FONT></PRE>
<P>Margins can be adjusted inward or outward using the <TT>\leftskip</TT> and <TT>\rightskip</TT>
commands, respectively. By providing positive values to these commands, they move
the margin inward, depending on which side you specify (left or right). As you may
expect, negative values have the opposite effect: They move the margins outward.
Indentation is controlled similarly using the <TT>\parindent</TT> command.</P>
<P>The<TT> \baselineskip</TT> and <TT>\parskip</TT> commands control the regular
vertical spacing between lines and paragraphs, as in the following:</P>
<PRE><FONT COLOR="#0066FF">\baselineskip=0.15in
\parskip=0.3in
</FONT></PRE>
<P>Baseline refers to the distance between the bottoms of characters (such as an
i) on consecutive lines.
<CENTER>
<H4><A NAME="Heading10<FONT COLOR="#000077">Using Groups</FONT></H4>
</CENTER>
<P>Normally, <TT>TeX</TT> continues using such things as fonts and text styles until
you explicitly change the format. The grouping features of <TT>TeX</TT> enable you
to define changes that are local to particular sections of text. The formatting originally
specified is then restored after the group has been processed.</P>
<P>There are two ways to specify how text is grouped. One is to use the <TT>\begingroup</TT>
and <TT>\endgroup</TT> command pair. The other is to use the braces <TT>{</TT> and
<TT>}</TT>. Although both of these perform grouping roles, braces are also used to
specify parameters to commands and, as such, must be used with care.</P>
<P>As an illustration of the use of groups in <TT>TeX</TT>, the text</P>
<PRE><FONT COLOR="#0066FF">Let's see \begingroup \it how {\bf this grouping stuff} really
works \endgroup, shall we?
</FONT></PRE>
<P>produces the following:</P>
<PRE><FONT COLOR="#0066FF">Let's see how this grouping stuff really
</FONT></PRE>
<PRE><FONT COLOR="#0066FF">works, shall we?
</FONT></PRE>
<P>You may have noted from the example that, in fact, groups can contain other groups.
<CENTER>
<H4><A NAME="Heading11<FONT COLOR="#000077">Mathematical Symbols</FONT></H4>
</CENTER>
<P>One of the most powerful features of <TT>TeX</TT> is its capability to generate
correct mathematical notation for formulas with convenient commands. This is one
of the key reasons behind <TT>TeX</TT>'s popularity among engineers and scientists.</P>
<P><TT>TeX</TT> distinguishes between formulas that must appear within regular text
(inline formulas) and those that must appear on their own line (displayed formulas).
You must use the <TT>$</TT> symbol to denote inline formulas, as in</P>
<PRE><FONT COLOR="#0066FF">The equation $2+3=x$ must evaluate to $x=5$.
</FONT></PRE>
<P>which is generated as the following:</P>
<PRE><FONT COLOR="#0066FF">The equation 2+3=x must evaluate to x=5.
</FONT></PRE>
<P>However, displayed formulas are denoted using two consecutive <TT>$</TT> symbols,
as in</P>
<PRE><FONT COLOR="#0066FF">The equation $$2+3=x$$ must evaluate to $$x=5$$.
</FONT></PRE>
<P>which produces the following:</P>
<PRE><FONT COLOR="#0066FF"> The equation
2+3=x
must evaluate to
x=5.
</FONT></PRE>
<P>Table 19.1 shows some of the math symbols that <TT>TeX</TT> can generate, their
associated commands, and their meaning.</P>
<CENTER>
<P><FONT SIZE="4"><B>Table 19.1. Some of the math symbols that TeX can generate.
</B></FONT>
<TABLE BORDER="0">
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><I>Symbol</I></TD>
<TD ALIGN="LEFT"><I><TT>TeX</TT> Command</I></TD>
<TD ALIGN="LEFT"><I>Meaning</I></TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT">[Pi]</TD>
<TD ALIGN="LEFT"><TT>\pi</TT></TD>
<TD ALIGN="LEFT">Pi</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT">[Sigma]</TD>
<TD ALIGN="LEFT"><TT>\sum</TT></TD>
<TD ALIGN="LEFT">Sum</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT">{</TD>
<TD ALIGN="LEFT"><TT>\{</TT></TD>
<TD ALIGN="LEFT">Open bracket</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT">}</TD>
<TD ALIGN="LEFT"><TT>\}</TT></TD>
<TD ALIGN="LEFT">Close bracket</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT">[florin]</TD>
<TD ALIGN="LEFT"><TT>\int</TT></TD>
<TD ALIGN="LEFT">Integral</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><=</TD>
<TD ALIGN="LEFT"><TT>\leq</TT></TD>
<TD ALIGN="LEFT">Less than or equal to</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT">>=</TD>
<TD ALIGN="LEFT"><TT>\geq</TT></TD>
<TD ALIGN="LEFT">Greater than or equal to</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT">!=</TD>
<TD ALIGN="LEFT"><TT>\neq</TT></TD>
<TD ALIGN="LEFT">Not equal to</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><BR>
*</TD>
<TD ALIGN="LEFT"><TT>\bullet</TT></TD>
<TD ALIGN="LEFT">Bullet</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT">...</TD>
<TD ALIGN="LEFT"><TT>\ldots</TT></TD>
<TD ALIGN="LEFT">Horizontal ellipses</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT">D</TD>
<TD ALIGN="LEFT"><TT>\diamond</TT></TD>
<TD ALIGN="LEFT">Diamond</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT">[Delta]</TD>
<TD ALIGN="LEFT"><TT>\Delta</TT></TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -