?? 357-359.html
字號:
<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=357-359//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="354-356.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="359-362.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H4 ALIGN="LEFT"><A NAME="Heading13"></A><FONT COLOR="#000077">Defining a LaTeX Document</FONT></H4>
<P>Every <TT>LaTeX</TT> document begins with the <TT>\documentclass</TT> command. The parameter passed to this command specifies what kind of document you want to write. The basic document classes are described in Table 19.2.</P>
<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 19.2.</B> Document classes.
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TH WIDTH="30%" ALIGN="LEFT">Document Class
<TH WIDTH="70%" ALIGN="LEFT">Description
<TR>
<TD COLSPAN="2"><HR>
<TR>
<TD VALIGN="TOP"><TT>article</TT>
<TD>Used for short reports, reference cards, presentations, scientific journals, and so on.
<TR>
<TD><TT>book</TT>
<TD>Used for complete books.
<TR>
<TD><TT>report</TT>
<TD>Used for reports having several chapters, theses, and so on.
<TR>
<TD COLSPAN="2"><HR>
</TABLE>
<P>To create a very basic <TT>LaTeX</TT> document, simply place some words between the two commands <TT>\begin{document}</TT> and <TT>\end{document}</TT>. The text that precedes the <TT>\begin{document}</TT> command is called the <I>preamble</I>, and the text that comes after is known as the <I>body</I>. So, you can create a very simple document such as the following:</P>
<!-- CODE SNIP //-->
<PRE>
\documentclass{article}
\begin{document}
What a small document this is.
\end{document}
</PRE>
<!-- END CODE SNIP //-->
<P>To process this document (which you will edit in a file called <TT>gloves.tex</TT>), use the following command:</P>
<!-- CODE SNIP //-->
<PRE>
% latex gloves
</PRE>
<!-- END CODE SNIP //-->
<P>This produces a dvi file and a log file in the same manner used by <TT>TeX</TT>. The dvi file can either be converted to PostScript, or viewed directly using <TT>xdvi</TT>.</P>
<P>You can specify options with the type of document in the <TT>\documentclass</TT> command using the following format:</P>
<!-- CODE SNIP //-->
<PRE>
\documentclass[<I>option</I>]{<I>document class</I>}
</PRE>
<!-- END CODE SNIP //-->
<P>These options relate to the physical structure of the document. Some of the more common ones are listed in Table 19.3.
</P>
<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 19.3.</B> <TT>\documentclass</TT> options.
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TH WIDTH="45%" ALIGN="LEFT">Option
<TH WIDTH="55%" ALIGN="LEFT">Description
<TR>
<TD COLSPAN="2"><HR>
<TR>
<TD VALIGN="TOP"><TT>10pt</TT>, <TT>11pt</TT>, <TT>12pt</TT>
<TD>The default font for the document, which is <TT>10pt</TT>if not otherwise stated.
<TR>
<TD VALIGN="TOP"><TT>fleqn</TT>
<TD>Displays formulas as left-justified instead of centered.
<TR>
<TD><TT>leqno</TT>
<TD>Numbers formulas on the left side.
<TR>
<TD VALIGN="TOP"><TT>letterpaper</TT>, <TT>a4 paper</TT>
<TD>The paper size, which is <TT>letterpaper</TT> by default.
<TR>
<TD VALIGN="TOP"><TT>openright</TT>, <TT>openany</TT>
<TD>Starts the first page of a chapter on the right side, or on the next available page.
<TR>
<TD VALIGN="TOP"><TT>titlepage</TT>, <TT>notitlepage</TT>
<TD>Does or does not start a new page after the title.
<TR>
<TD VALIGN="TOP"><TT>twocolumn</TT>
<TD>Splits each page into two columns (useful for newsletters).
<TR>
<TD><TT>twoside</TT>, <TT>oneside</TT>
<TD>Generates double- or single-sided output.
<TR>
<TD COLSPAN="2"><HR>
</TABLE>
<P>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.</P>
<H4 ALIGN="LEFT"><A NAME="Heading14"></A><FONT COLOR="#000077">Packages</FONT></H4>
<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 <I>package</I> of features. The format is as follows:</P>
<!-- CODE SNIP //-->
<PRE>
\usepackage{<I>package name</I>}
</PRE>
<!-- END CODE SNIP //-->
<P><I>package name</I> 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>
<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 19.4.</B> Page styles.
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TH WIDTH="20%" ALIGN="LEFT">Style
<TH WIDTH="80%" ALIGN="LEFT">Description
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TD><TT>empty</TT>
<TD>Sets the header and footers to be empty.
<TR>
<TD VALIGN="TOP"><TT>headings</TT>
<TD>Prints the current chapter heading and page number on each page with an empty footer.
<TR>
<TD><TT>plain</TT>
<TD>Prints the page number centered in the footer (the default page style).
<TR>
<TD COLSPAN="2"><HR>
</TABLE>
<P>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.</P>
<H4 ALIGN="LEFT"><A NAME="Heading15"></A><FONT COLOR="#000077">Using Special Characters</FONT></H4>
<P><TT>LaTeX</TT> supports the use of international characters, such as umlauts (<SUP>..</SUP>) and circumflexes (^). These characters are generated using a command variant on the letter itself. For example, the text</P>
<!-- CODE SNIP //-->
<PRE>
What a na\”\i ve fj\o rd you are!
</PRE>
<!-- END CODE SNIP //-->
<P>produces the following:
</P>
<P>What a naïve fjörd 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.</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="354-356.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="359-362.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -