?? 359-362.html
字號(hào):
<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=359-362//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="357-359.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="362-362.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H4 ALIGN="LEFT"><A NAME="Heading16"></A><FONT COLOR="#000077">Putting Structure into a LaTeX Document</FONT></H4>
<P><TT>LaTeX</TT> has commands that make it easy to enhance your document structurally, thus making it easier for the reader to digest. For the <TT>article</TT> document class, the commands are as follows:</P>
<DL>
<DD><B>\section</B>
<DD><B>\subsection</B>
<DD><B>\subsubsection</B>
<DD><B>\paragraph</B>
<DD><B>\subparagraph</B>, and
<DD><B>\appendix.</B>
</DL>
<P>These commands, with the exception of <TT>\appendix</TT>, accept titles as arguments, and are declared before the body of text that they represent. <TT>LaTeX</TT> takes care of the rest; it sets the appropriate spacing between sections, section numbering, and title font. The <TT>\appendix</TT> command uses alphabetic increments in order to number succeeding appendix sections.</P>
<P>For the <TT>report</TT> and <TT>book</TT> classes, there are two additional commands: <TT>\part</TT> and <TT>\chapter</TT>. The <TT>\part</TT> command enables you to insert a section without affecting the numbering sequence of the chapters. You can suppress the appearance of a section in the table of contents by inserting a <TT>*</TT> character in the section command, as in the following:</P>
<!-- CODE SNIP //-->
<PRE>
\section*{I don’t want to know about it}
</PRE>
<!-- END CODE SNIP //-->
<P>You probably want to add a title to your document. This is done by specifying the arguments to the title commands and then calling the <TT>\maketitle</TT> command:</P>
<!-- CODE SNIP //-->
<PRE>
...
\title{Confessions of a LaTeX Enthusiast}
\author{Me}
\date
\begin{document}
\maketitle
...
</PRE>
<!-- END CODE SNIP //-->
<P>To insert a table of contents in your document, issue the <TT>\tableofcontents</TT> command (big surprise) at the point where you want the table to appear. When you process your document with <TT>LaTeX</TT>, it needs two passes: one to make note of all the section numbers, and the other to build the table of contents from the information it collected in the first pass.</P>
<H4 ALIGN="LEFT"><A NAME="Heading17"></A><FONT COLOR="#000077">Adding Other Structural Elements</FONT></H4>
<P>You can add cross-references to your document, which tie associated elements such as text, figures, and tables to text in other parts of your document. Use the <TT>\label</TT> command to set a point that you want to refer to, and give it an argument that is any name you choose. This name can then be referred to by the <TT>\ref</TT> and <TT>\pageref</TT> commands to generate a cross-reference containing the section number and page number that the section title appears on.</P>
<P>You can easily add footnotes using the <TT>\footnote</TT> command, which accepts the text of the footnote as an argument.</P>
<P>The structure of a document can be enhanced by controlling the presentation of the text that appears between section titles. This can be easily managed by using <TT>LaTeX</TT> environments. Environments are specified by bounding a portion of text with <TT>\begin</TT> and <TT>\end</TT> commands, and passing an environment name to each command, as in the following:</P>
<!-- CODE SNIP //-->
<PRE>
\begin{hostileenvironment}
Looks like we’re surrounded, said Custer.
\end{hostileenvironment}
</PRE>
<!-- END CODE SNIP //-->
<P><TT>LaTeX</TT> has many predefined environments for practical applications, as described in Table 19.5.</P>
<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 19.5.</B> Predefined environments.
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TH WIDTH="30%" ALIGN="LEFT">Environment
<TH WIDTH="70%" ALIGN="LEFT">Description
<TR>
<TD><TT>center</TT>
<TD>Centers text.
<TR>
<TD><TT>description</TT>
<TD>Used to present descriptive paragraphs.
<TR>
<TD><TT>enumerate</TT>
<TD>Used for numbered or bulleted lists.
<TR>
<TD><TT>flushleft</TT>
<TD>Paragraphs are left-aligned.
<TR>
<TD><TT>flushright</TT>
<TD>Paragraphs are right-aligned.
<TR>
<TD><TT>itemize</TT>
<TD>Used for simple lists.
<TR>
<TD><TT>quote</TT>
<TD>Used to quote single paragraphs.
<TR>
<TD><TT>quotation</TT>
<TD>Used for longer quotes that span several paragraphs.
<TR>
<TD><TT>tabular</TT>
<TD>Typesets tables with optional row and column separators.
<TR>
<TD VALIGN="TOP"><TT>verbatim</TT>
<TD>Produces typed text. Useful for representing programming code, for example.
<TR>
<TD><TT>verse</TT>
<TD>Used to control the linebreaks in poems.
<TR>
<TD COLSPAN="2"><HR>
</TABLE>
<H4 ALIGN="LEFT"><A NAME="Heading18"></A><FONT COLOR="#000077">Working with Figures and Tables</FONT></H4>
<P><TT>LaTeX</TT> also supports the variable placement (or “floating”) of figures and tables in a document using the <TT>table</TT> and <TT>figure</TT> environments. A figure could be specified as follows:</P>
<!-- CODE SNIP //-->
<PRE>
\begin{figure}[!hbp]
\makebox[\textwidth]{\framebox[2in]{\rule{Opt}{2in}}}
\end{figure}
</PRE>
<!-- END CODE SNIP //-->
<P>The options passed to the <TT>\begin{figure}</TT> command are placement specifiers that indicate your preferences for the location of the figure. <TT>LaTeX</TT> has to juggle the placement of floating figures and tables in a document by using these preferences, as well as internal guidelines such as the maximum number of floats allowed per page. In this example, you told <TT>LaTeX</TT> to keep the figure with its adjacent text (<TT>h</TT>), at the bottom of the next applicable page (<TT>b</TT>), or, failing that, on a special page with other floating figures (<TT>p</TT>). The <TT>!</TT> character overrides <TT>LaTeX</TT>’s best intentions for placing the figure, which may not necessarily jibe with what you are saying with the other placement specifiers.</P>
<P>Tables and figures can be labeled using the <TT>\caption</TT> command, which must be issued within the <TT>table</TT> or <TT>figure</TT> environment.</P>
<P>These are just some of the basics for using <TT>LaTeX</TT>, but hopefully they are sufficient to give you a place to start on the road to making your documents more visually appealing. You have probably noticed that <TT>LaTeX</TT> is somewhat easier to work with than <TT>TeX</TT> itself, because it hides much detail from you as an author.</P>
<H3><A NAME="Heading19"></A><FONT COLOR="#000077">VirTeX and IniTeX</FONT></H3>
<P>Two other <TT>TeX</TT>-related programs work together but perform slightly different roles. The <TT>IniTeX</TT> program is used to create a <TT>TeX</TT> format (.fmt) file containing font definitions and macros. The <TT>VirTeX</TT> program can then quickly load this precompiled format file, much more quickly than <TT>TeX</TT> can. The command to use a format file is as follows:</P>
<!-- CODE SNIP //-->
<PRE>
$ virtex \&myformat <I>sometexfile</I>
</PRE>
<!-- END CODE SNIP //-->
<P>The <TT>&</TT> character is necessary for <TT>VirTeX</TT> to recognize that it is loading a format file first; the <TT>&</TT> must be escaped using the <TT>\</TT> character so as not to confuse the shell. The difference between <TT>VirTeX</TT> and <TT>IniTeX</TT> is that <TT>VirTeX</TT> can’t be used to create <TT>TeX</TT> format files, but it executes much faster.</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="357-359.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="362-362.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -