rhl19.htm

来自「linux的初学电子书」· HTM 代码 · 共 2,061 行 · 第 1/4 页

HTM
2,061
字号
<HTML>

<HEAD>

<TITLE>Red Hat Linux Unleashed rhl19.htm </TITLE>

<LINK REL="ToC" HREF="index-1.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/index.htm">

<LINK REL="Index" HREF="htindex.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/htindex.htm">

<LINK REL="Next" HREF="tppmsgs/msgs0.htm#21" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl20.htm">

<LINK REL="Previous" HREF="rhl18.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl18.htm"></HEAD>

<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">

<A NAME="I0"></A>

<H2>Red Hat Linux Unleashed rhl19.htm</H2>

<P ALIGN=LEFT>

<A HREF="rhl18.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl18.htm" TARGET="_self"><IMG SRC="purprev.gif" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/purprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A>

<A HREF="index-1.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/index.htm" TARGET="_self"><IMG SRC="purtoc.gif" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/purtoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A>

<A HREF="tppmsgs/msgs0.htm#21" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl20.htm" TARGET="_self"><IMG SRC="purnext.gif" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/purnext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A>


<HR ALIGN=CENTER>

<P>

<UL>

<UL>

<UL>

<LI>

<A HREF="#E68E127" >What Is TeX?</A>

<LI>

<A HREF="#E68E128" >Typesetting Versus Writing</A>

<LI>

<A HREF="#E68E129" >TeX</A>

<UL>

<LI>

<A HREF="#E69E258" >Simple Text Formatting</A>

<LI>

<A HREF="#E69E259" >Fonts</A>

<LI>

<A HREF="#E69E260" >Controlling Spacing</A>

<LI>

<A HREF="#E69E261" >Page Layout</A>

<LI>

<A HREF="#E69E262" >Using Groups</A>

<LI>

<A HREF="#E69E263" >Mathematical Symbols</A>

<LI>

<A HREF="#E69E264" >Using Figures in Your Document</A>

<LI>

<A HREF="#E69E265" >Macros</A></UL>

<LI>

<A HREF="#E68E130" >LaTeX An Enhancement of TeX</A>

<UL>

<LI>

<A HREF="#E69E266" >Defining a LaTeX Document</A>

<LI>

<A HREF="#E69E267" >Packages</A>

<LI>

<A HREF="#E69E268" >Using Special Characters</A>

<LI>

<A HREF="#E69E269" >Putting Structure into a LaTeX Document</A>

<LI>

<A HREF="#E69E270" >Adding Other Structural Elements</A>

<LI>

<A HREF="#E69E271" >Working with Figures and Tables</A></UL>

<LI>

<A HREF="#E68E131" >VirTeX and IniTeX</A>

<LI>

<A HREF="#E68E132" >Summary</A></UL></UL></UL>

<HR ALIGN=CENTER>

<A NAME="E66E19"></A>

<H1 ALIGN=CENTER>

<CENTER>

<FONT SIZE=6 COLOR="#FF0000"><B>19</B></FONT></CENTER></H1>

<BR>

<A NAME="E67E19"></A>

<H2 ALIGN=CENTER>

<CENTER>

<FONT SIZE=6 COLOR="#FF0000"><B>TeX</B></FONT></CENTER></H2>

<BR>

<P>This chapter looks at the following topics:

<BR>

<UL>

<LI>What TeX is and why you would want to use it

<BR>

<BR>

<LI>The differences between typesetting and writing

<BR>

<BR>

<LI>The enhanced version of TeX called LaTeX

<BR>

<BR>

<LI>What VirTeX and IniTeX are

<BR>

<BR>

</UL>

<BR>

<A NAME="E68E127"></A>

<H3 ALIGN=CENTER>

<CENTER>

<FONT SIZE=5 COLOR="#FF0000"><B>What Is </B><B>TeX?</B></FONT></CENTER></H3>

<BR>

<P>TeX (pronounced tech) is a text formatting system invented by Donald Knuth. It lets you produce professionally typeset documents by embedding TeX commands within a normal ASCII text file. This text file can then be converted to what is known as a DVI 
(device-independent file), which can be either previewed on-screen using an X Window program called xdvi or converted to a printer-specific file format, such as PostScript, HP LaserJet, or for other popular printers.

<BR>

<P>TeX is a powerful program in that it enables you to define specific typesetting commands (such as font size, page size, or space between lines). It also works as a programming language that enables you to create macros for defining more abstract units 
of text such as documents, headings, and paragraphs. The benefit of these high-level macros is that they enable you to concentrate on the authoring of a document, not the typesetting. The key appeal of TeX for engineers and scientists is that it supports 
the typesetting of complex mathematical formulas.

<BR>

<BR>

<A NAME="E68E128"></A>

<H3 ALIGN=CENTER>

<CENTER>

<FONT SIZE=5 COLOR="#FF0000"><B>Typesetting Versus Writing</B></FONT></CENTER></H3>

<BR>

<P>The usefulness of a document can be limited by its appearance. Consider two documents: one that is well-organized with clearly defined units of text such as chapters, headings, and paragraphs, and another that has no paragraph breaks and no space 
between lines. The first document is much more appealing to the reader, whereas the second document is downright painful to read. So, despite the best efforts of an author to create a magnum opus, or even a recipe for strawberry jam, the meaning behind the 
words may get lost in a typographical abyss.

<BR>

<P>In book publishing, authors aren't usually responsible for anything beyond the genius of their words. They usually leave the design and crafting of the book to a book designer. This person then hands the design template to page layout technicians. TeX 
performs this book design and typesetting role for you, enabling you, the author, to be your own publisher. It gives you control over the publication of your own material while still permitting you to concentrate on what you're supposed to be writing 
about!

<BR>

<BR>

<A NAME="E68E129"></A>

<H3 ALIGN=CENTER>

<CENTER>

<FONT SIZE=5 COLOR="#FF0000"><B>TeX</B></FONT></CENTER></H3>

<BR>

<P>A TeX file can be created with any Linux text editor such as vi or Emacs. You can enter text into a file called arkana.tex like this:

<BR>

<PRE>

<FONT COLOR="#000080">Do you suppose that Alfred Hitchcock would have had as successful a directing

career if he did not have the considerable talents of actors Cary Grant and

James Stewart in his most popular films? That's a tough one to answer... \bye</FONT></PRE>

<P>After you have saved your file, use the TeX program to convert it to a DVI file using this command:

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">$ tex arkana</FONT></PRE>

<P>The resulting arkana.dvi file that is created contains your text. This file can be used by different output devices (hence the name) for viewing or printing. For example, if you want to print your DVI file to a PostScript printer, convert it to a ps 
format, and print it using the dvi2ps utility:

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">$ dvi2ps arkana.ps | lp</FONT></PRE>

<P>This assumes that the default printer is PostScript-capable. If you want to just preview how the text looks, use the X application xdvi:

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">$ xdvi arkana.dvi &amp;</FONT></PRE>

<P>The TeX command also produces a log file entitled arkana.log, containing any error and warning messages, and other information such as the number of pages of output. The beauty of all this indirect representation of TeX output is that the TeX source 
file and its resulting DVI are very portable, particularly from Linux to its ancestor UNIX.

<BR>

<BR>

<A NAME="E69E258"></A>

<H4 ALIGN=CENTER>

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>Simple Text Formatting</B></FONT></CENTER></H4>

<BR>

<P>Most of the work in creating a TeX document is putting in the words that discuss whatever you're writing about. As shown earlier, it is fairly simple to create an unadorned TeX file: The only special command you used was \bye. This command tells the TeX 
program that it has reached the end of the document. The \bye command uses one of several characters that TeX treats with special interest, specifically the backslash or escape character. Here is the set of special characters that TeX recognizes: \, {, }, 
~, #, $, %, ^, &amp;, and the space character. The meaning behind these characters will be discussed as you progress.

<BR>

<P>One of the main conveniences of TeX is the intelligent way it deals with text. Words are any sequence of characters separated by whitespace characters. The number of whitespace characters between words is immaterial because TeX treats them as one 
character. Sentences are recognized by the last word preceding a ., ?, !, or :. Paragraphs are distinguished by a blank line following a sentence. Much like the spaces between words, TeX treats excess blank lines as redundant and ignores them. Thus, the 
text

<BR>

<PRE>

<FONT COLOR="#000080">How do you compare

these two terrific leading men? James Stewart had that good-natured,

All-American charm mixed

with a surprising element of vulnerability, uncommon

among other major Hollywood actors.

Cary Grant, on the other

hand, was versatile enough to play the villain as well as the suave hero in many films.</FONT></PRE>

<P>is formatted by TeX as follows:

<BR>

<PRE>

<FONT COLOR="#000080">How do you compare these two terrific leading men? James Stewart had that good-natured, All-American charm mixed with a surprising element of vulnerability, uncommon among other major Hollywood actors.

Cary Grant, on the other hand, was versatile enough to play the villain as well as the suave hero in many films.</FONT></PRE>

<P>You can also insert comments into your TeX file using the % character. Text following a % character is treated as a comment and not made part of the TeX output. The text

<BR>

<PRE>

<FONT COLOR="#000080">From her% Nothing to do with Hitchcock

% ...nothing at all

e to there</FONT></PRE>

<P>is formatted as

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">From here to there</FONT></PRE>

<P>TeX has several commands for manipulating paragraphs. The \par command starts a new paragraph, which has the same effect as inserting a blank line.

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">From here \par to there</FONT></PRE>

<P>The preceding line is formatted as follows:

<BR>

<PRE>

<FONT COLOR="#000080">From here

to there</FONT></PRE>

<P>The \noindent command tells TeX not to indent the paragraph:

<BR>

<PRE>

<FONT COLOR="#000080">I grew up on Newcastle Street.

\noindent That was close to Hazlehurst.</FONT></PRE>

<P>This is output as follows:

<BR>

<PRE>

<FONT COLOR="#000080">I grew up on Newcastle Street.

That was close to Hazlehurst.</FONT></PRE>

<P>You can also use the escape character before a space in order to force the insertion of an extra space:

<BR>

<PRE>

<FONT COLOR="#000080">I think that I need an extra\ \ \ space or two.

I'm sure of it.</FONT></PRE>

<P>This becomes

<BR>

<PRE>

<FONT COLOR="#000080">I think that I need an extra space or two.

I'm sure of it.</FONT></PRE>

<BR>

<A NAME="E69E259"></A>

<H4 ALIGN=CENTER>

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>Fonts</B></FONT></CENTER></H4>

<BR>

<P>Fonts are representations of characters that share similar size and style. The default font that TeX uses is Roman. You can override this by using the internal names that TeX associates with fonts that are externally loaded. You can also add new font 
definitions. The definitions that TeX knows about by default are: \rm (Roman), \tt (typewriter), \bf (bold), \sl (slanted), and \it (italic). TeX continues using whatever font was last specified (including the default) until it is instructed to do 
otherwise. Therefore, the text

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">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.</FONT></PRE>

<P>appears as follows:

<BR>

<P>This is roman, but I think I will switch to typewriter for a while; then again, maybe italic would be nice. Now back to Roman.

<BR>

<P>You can add a font and change its size using a command like this:

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">\font \fontname=auxiliary font</FONT></PRE>

<P>To use a 12-point roman font, redefine the \rm definition to use the cmr12 auxiliary font, like this:

<BR>

<PRE>

<FONT COLOR="#000080">\font\rm=cmr12

We are changing from this font \rm to that font.</FONT></PRE>

<P>This formats as follows:

<BR>

<P>We are changing from this font to that font.

<BR>

<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 \char command. This command 
uses the integer that follows it as a character code index into a font's character table. For example, the text

<BR>

<PRE>

<FONT COLOR="#000080">TeX would interpret \char 37 as a comment symbol

but it would not

care about a \char 43 sign.</FONT></PRE>

<P>is processed by TeX as follows:

<BR>

<PRE>

<FONT COLOR="#000080">TeX would interpret % as a comment symbol but it would not

care about a + sign.</FONT></PRE>

<BR>

<A NAME="E69E260"></A>

<H4 ALIGN=CENTER>

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>Controlling Spacing</B></FONT></CENTER></H4>

<BR>

<P>You've seen how you can insert individual extra spaces in TeX files. Now, let's examine how you can have more control over the spacing of larger portions of text. TeX has a series of commands that recognize the following units of measurement:

<BR>

<UL>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?