348-351.html
来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 200 行
HTML
200 行
<HTML>
<HEAD>
<TITLE>Linux Unleashed, Third Edition:TeX and LaTeX</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=19//-->
<!--PAGES=348-351//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="345-348.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="351-354.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P><TT>TeX</TT> has several commands for manipulating paragraphs. The <TT>\par</TT> command starts a new paragraph, which has the same effect as inserting a blank line.</P>
<!-- CODE SNIP //-->
<PRE>
From here \par to there
</PRE>
<!-- END CODE SNIP //-->
<P>The preceding line is formatted as follows:
</P>
<!-- CODE SNIP //-->
<PRE>
From here
to there
</PRE>
<!-- END CODE SNIP //-->
<P>The <TT>\noindent</TT> command tells <TT>TeX</TT> not to indent the paragraph:</P>
<!-- CODE SNIP //-->
<PRE>
I grew up on Newcastle Street.
\noindent That was close to Hazlehurst.
</PRE>
<!-- END CODE SNIP //-->
<P>This is output as follows:
</P>
<!-- CODE SNIP //-->
<PRE>
I grew up on Newcastle Street.
That was close to Hazlehurst.
</PRE>
<!-- END CODE SNIP //-->
<P>You can also use the escape character before a space in order to force the insertion of an extra space:
</P>
<!-- CODE SNIP //-->
<PRE>
I think that I need an extra\ \ \ space or two.
I’m sure of it.
</PRE>
<!-- END CODE SNIP //-->
<P>This becomes
</P>
<!-- CODE SNIP //-->
<PRE>
I think that I need an extra space or two.
I’m sure of it.
</PRE>
<!-- END CODE SNIP //-->
<H4 ALIGN="LEFT"><A NAME="Heading5"></A><FONT COLOR="#000077">Fonts</FONT></H4>
<P>Fonts are representations of characters that share similar size and style. The default font that <TT>TeX</TT> uses is roman. You can override this by using the internal names that <TT>TeX</TT> associates with fonts that are externally loaded. You can also add new font definitions. The definitions that <TT>TeX</TT> knows about by default are: <TT>\rm</TT> (roman), <TT>\tt</TT> (typewriter), <TT>\bf</TT> (bold), <TT>\sl</TT> (slanted), and <TT>\it</TT> (italic). <TT>TeX</TT> continues using whatever font was last specified (including the default) until it is instructed to do otherwise. Therefore, the text</P>
<!-- CODE SNIP //-->
<PRE>
This is roman, but I think I will switch to \tt typewriter for a while;
then again, maybe \it italic would be nice. Now back to \rm roman.
</PRE>
<!-- END CODE SNIP //-->
<P>appears as follows:
</P>
<P>This is roman, <TT>but I think I will switch to typewriter for a while;</TT> <I>then again, maybe italic would be nice.</I> Now back to roman.</P>
<P>You can add a font and change its size using a command like this:</P>
<!-- CODE SNIP //-->
<PRE>
\font \<I>fontname</I>=<I>auxiliary font</I>
</PRE>
<!-- END CODE SNIP //-->
<P>To use a 12-point roman font, redefine the <TT>\rm</TT> definition to use the <TT>cmr12</TT> auxiliary font, like this:</P>
<!-- CODE SNIP //-->
<PRE>
\font\rm=cmr12
We are changing from this font \rm to that font.
</PRE>
<!-- END CODE SNIP //-->
<P>This formats as follows:
</P>
<P><TT>We are changing from this font</TT> to that font.</P>
<P>Fonts have up to 256 different symbols including the standard numeric, uppercase, and lowercase character symbols that you use most frequently. Symbols that are not represented on a standard keyboard can be accessed using the <TT>\char</TT> command. This command uses the integer that follows it as a character code index into a font’s character table. For example, the text</P>
<!-- CODE SNIP //-->
<PRE>
TeX would interpret \char 37 as a comment symbol
but it would not
care about a \char 43 sign.
</PRE>
<!-- END CODE SNIP //-->
<P>is processed by <TT>TeX</TT> as follows:</P>
<!-- CODE SNIP //-->
<PRE>
TeX would interpret % as a comment symbol but it would not
care about a + sign.
</PRE>
<!-- END CODE SNIP //-->
<H4 ALIGN="LEFT"><A NAME="Heading6"></A><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>
<TABLE WIDTH="90%"><TR>
<TH WIDTH="15%" ALIGN="LEFT">Unit
<TH WIDTH="85%" ALIGN="LEFT">Meaning
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TD VALIGN="TOP">em
<TD>Approximately the width of the character M, depending on the font in use
<TR>
<TD>in
<TD>Inches
<TR>
<TD>pt
<TD>Points (1 inch equals 72.27 points)
<TR>
<TD>mm
<TD>Millimeters (1 inch equals 25.4 millimeters)
</TABLE>
</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>
<!-- CODE SNIP //-->
<PRE>
\tt From here \hskip 0.5in to there
</PRE>
<!-- END CODE SNIP //-->
<P>This produces the following output:
</P>
<!-- CODE SNIP //-->
<PRE>
From here to there
</PRE>
<!-- END CODE SNIP //-->
<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>
<!-- CODE SNIP //-->
<PRE>
\noindent \hfil Some centered text. \par
</PRE>
<!-- END CODE SNIP //-->
<P>This is output as follows:
</P>
<!-- CODE SNIP //-->
<PRE>
Some centered text.
</PRE>
<!-- END CODE SNIP //-->
<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>
<!-- CODE SNIP //-->
<PRE>
\vskip 40mm
</PRE>
<!-- END CODE SNIP //-->
<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.</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="345-348.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="351-354.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?