📄 ch19.htm
字号:
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>twoside</TT>, <TT>oneside</TT></TD>
<TD ALIGN="LEFT">Generates double- or single-sided output.</TD>
</TR>
</TABLE>
</P>
</CENTER>
<P><BR>
Some of the differences between document classes are encapsulated by the defaults
that they use for the options mentioned. For instance, articles and reports are single-sided
by default, whereas books are not. Articles do not use the options for title pages
and starting right-sided chapters because they do not understand what a chapter is.
Thus, the document classes in <TT>LaTeX</TT> are smart enough to do the kind of layout
that you expect for the type of document you need.
<CENTER>
<H4><A NAME="Heading17<FONT COLOR="#000077">Packages</FONT></H4>
</CENTER>
<P><TT>LaTeX</TT> also has the <TT>\usepackage</TT> command, which enables you to
extend the capabilities of <TT>LaTeX</TT> even further by using an external package
of features. The format is as follows:</P>
<PRE><FONT COLOR="#0066FF">\usepackage{package name}
</FONT></PRE>
<P>package name can be any of several available packages. For instance, the <TT>doc</TT>
package is used for the documentation of <TT>LaTeX</TT> programs, and the <TT>makeidx</TT>
package provides support for the production of indexes.</P>
<P>You can also control what page styles <TT>LaTeX</TT> applies to your document
by using the <TT>\pagestyle</TT> command. Table 19.4 describes the basic page styles
available. </P>
<CENTER>
<P><FONT SIZE="4"><B>Table 19.4. Page styles. </B></FONT>
<TABLE BORDER="0">
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><I>Style</I></TD>
<TD WIDTH="304" ALIGN="LEFT"><I>Description</I></TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>empty</TT></TD>
<TD WIDTH="304" ALIGN="LEFT">Sets the header and footers to be empty.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>headings</TT></TD>
<TD WIDTH="304" ALIGN="LEFT">Prints the current chapter heading and page number on each page with an empty footer.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>plain</TT></TD>
<TD WIDTH="304" ALIGN="LEFT">Prints the page number centered in the footer (the default page style).</TD>
</TR>
</TABLE>
</P>
</CENTER>
<P><BR>
You can also vary page styles in your document using the <TT>\thispagestyle</TT>
command. This applies the supplied page style to the current page only.
<CENTER>
<H4><A NAME="Heading18<FONT COLOR="#000077">Using Special Characters</FONT></H4>
</CENTER>
<P><TT>LaTeX</TT> supports the use of international characters, such as umlauts ([dieresis])
and circumflexes (^). These characters are generated using a command variant on the
letter itself. For example, the text</P>
<PRE><FONT COLOR="#0066FF">What a na\"\i ve ma^itre d' you are!
</FONT></PRE>
<P>produces the following:</P>
<P>What a naïve ma^itre d' you are!</P>
<P>International spacing can also be applied using the <TT>\frenchspacing</TT> command.
This command tells <TT>LaTeX</TT> not to insert the usual extra space after a period.
<CENTER>
<H4><A NAME="Heading19<FONT COLOR="#000077">Putting Structure into a LaTeX
Document</FONT></H4>
</CENTER>
<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 <TT>\section</TT>, <TT>\subsection</TT>, <TT>\subsubsection</TT>,
<TT>\paragraph</TT>, <TT>\subparagraph</TT>, and <TT>\appendix</TT>. 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>
<PRE><FONT COLOR="#0066FF">\section*{I don't want to know about it}
</FONT></PRE>
<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>
<PRE><FONT COLOR="#0066FF">...
\title{Confessions of a LaTeX Enthusiast}
\author{Me}
\date
\begin{document}
\maketitle
...
</FONT></PRE>
<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.
<CENTER>
<H4><A NAME="Heading20<FONT COLOR="#000077">Adding Other Structural Elements</FONT></H4>
</CENTER>
<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>Structure is also 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>
<PRE><FONT COLOR="#0066FF">\begin{hostileenvironment}
Looks like we're surrounded, said Custer.
\end{hostileenvironment}
</FONT></PRE>
<P><TT>LaTeX</TT> has many predefined environments for practical applications, as
described in Table 19.5. </P>
<CENTER>
<P><FONT SIZE="4"><B>Table 19.5. Predefined environments. </B></FONT>
<TABLE BORDER="0" WIDTH="320">
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><I>Environment</I></TD>
<TD ALIGN="LEFT"><I>Description</I></TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>center</TT></TD>
<TD ALIGN="LEFT">Centers text.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>description</TT></TD>
<TD ALIGN="LEFT">Used to present descriptive paragraphs.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>enumerate</TT></TD>
<TD ALIGN="LEFT">Used for numbered or bulleted lists.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>flushleft</TT></TD>
<TD ALIGN="LEFT">Paragraphs are left-aligned.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>flushright</TT></TD>
<TD ALIGN="LEFT">Paragraphs are right-aligned.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>itemize</TT></TD>
<TD ALIGN="LEFT">Used for simple lists.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>quote</TT></TD>
<TD ALIGN="LEFT">Used to quote single paragraphs.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>quotation</TT></TD>
<TD ALIGN="LEFT">Used for longer quotes that span several paragraphs.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>tabular</TT></TD>
<TD ALIGN="LEFT">Typesets tables with optional row and column separators.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>verbatim</TT></TD>
<TD ALIGN="LEFT">Produces typed text. Useful for representing programming code, for example.</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD ALIGN="LEFT"><TT>verse</TT></TD>
<TD ALIGN="LEFT">Used to control the linebreaks in poems.</TD>
</TR>
</TABLE>
</CENTER>
<CENTER>
<H4><A NAME="Heading21<FONT COLOR="#000077">Working with Figures and Tables</FONT></H4>
</CENTER>
<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>
<PRE><FONT COLOR="#0066FF">
\begin{figure}[!hbp]
\makebox[\textwidth]{\framebox[2in]{\rule{Opt}{2in}}}
\end{figure}
</FONT></PRE>
<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.
<CENTER>
<H3><A NAME="Heading22<FONT COLOR="#000077">VirTeX and IniTeX</FONT></H3>
</CENTER>
<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>
<PRE><FONT COLOR="#0066FF">$ virtex \&myformat sometexfile
</FONT></PRE>
<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.
<CENTER>
<H3><A NAME="Heading23<FONT COLOR="#000077">Summary</FONT></H3>
</CENTER>
<P><TT>TeX</TT> is a document-formatting system for Linux that enables authors to
produce their own high-quality publications. It produces documents that are portable
among output devices such as printers or displays. <TT>TeX</TT> supports many typographical
features and is particularly well suited to the formatting of correct mathematical
notation. It has macros that can be used to enhance the power of its basic command
set. <TT>LaTeX</TT>, one of the most popular extensions to <TT>TeX</TT>, uses sophisticated
macros to help you organize and typeset your documents based on its contents.
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -