The teTeX HOWTO: Linux-teTeX 部份指导 <author>Robert Kiesling <date>v3.7, 9 November 1998 <abstract> 这份文件,主要涵盖在英文 Linux 套件中的teTeX , TeX , LaTeX 的基本安装和用法和其他的辅助程式集,例如 Ghostscript 。 teTeX HOWTO的内容: Linux-teTeX 部份指导的版权,属於Robert A. Kiesling 1997 , 1998 ,确实内容,在简介和附录中,注册的商标,分别属於拥有者。任何抱怨,提议,错误和其他任何的事,请寄给 <htmlurl url="mailto:kiesling@ix.netcom.com" name = "kiesling@ix.netcom.com"> ,使得这文件尽量能够保持完整并且跟得上最新的发展。 </abstract> <toc> <sect>介绍 <P> <sect1>版权. <P> teTeX-HOWTO 是属於 Robert Kiesling (C) 1997 , 1998 的版权。在保有版权通告和许可通告下,允许制造并且散布这本手册,在附有原先 " Distribution " 和 " GNU General Public License " 下,允许复制并且散布修改过的手册,并和前者一样,允许让人散布修改过的手册。同时和修改手册的原则一样,允许复制并且散布翻译成它种语言的手册,除了要附上 Free Software Foundation 认可的 " Distribution " 和 " GNU General Public License " 的翻译本,请参考 <ref id="copyright" name="散布与版权"> <sect1>在这份文件中描述的软体 <P> TeX 只处理格式文件的部份。从TeX 产生输出,就像把来源码编成目的码,还需要连结。准备一个用文字编辑程式输入一个档案 ---- 即大多数人所谓的 `` 文书处理 '' --- 再用 TeX ,把它编译成一个与设备无关的输出档案,叫作<tt>dvi</tt>档。你也需要一或二个程式,翻译 TeX 的 <tt>dvi</tt>档,由你的监视器或印表机输出,这些程式被通称为 " dviware " ,举例来说, TeX 只发出使用字型要求,不管是由监视器或印表机输出,都是<tt>dvi</tt>翻译器提供真实的字型,以供输出。这个额外的步骤,好像很复杂,但是它只要稍微更改或甚至不用改变,就可以在不同的装置上,显示相同的结果。 <sect2>teTeX. <P> TeX可以被世界上每一个重要的电脑系统 --- 和相当多的 " 非重要的电脑系统 " --- 所使用,因此一方面,基於teTeX's 本身的复杂性,另外考虑到安装 TeX 的复杂性,必须提供安装这些系统的工具,以便於使用。除非你已经熟悉 TeX系统,否则安装这系统是一件艰钜的工作,很容易在执行一大堆程式,及安装 TeX 档案,文件和字型中迷失掉。 幸运地, teTeX 是一个 GNU/Linux 套件,很容易利用 GNU/Linux 的安装工具,就能装好这程式集。你可能已经在你的系统上装好了teTeX ,如果是这样,你可跳过<ref id="sec-using" name="使用 teTeX">这一节。无论如何,安装一个能用的 teTeX ,所需的档案,都在网路上的 CTAN 资料库找得到,在<ref id="ctan-list"name="CTAN 网址表">有这些位址的目录。 CTAN 是广泛的 TeX Archive 网路,即一系列可使用匿名的FTP 网站,其中包含TeX 程式巨集,字型,和文件。在使用 TeX 中,你至少会熟悉一个 CTAN 位址,在这文件中,一个路径像<tt>˜CTAN/contrib/pstricks</tt> 名称,代表到最靠近你的 CTAN 网站,找寻像<tt>contrib/pstricks</tt>的目录。 在<ref id="ctan-install" name="安装 CTAN teTeX 套件">一节中,著重於在Intel 版的 Linux 中,安装一般的teTeX 套件。想在其他的硬体上安装teTeX ,只要在安装程序里,更换适当的可执行档就可以了。除了可执行档之外,这套件括所有的 TeX 和 LaTeX 的程式集,<tt>metafont</tt> 和来源码,<tt>bibtex , makeindex</tt> 和 <em> 所有</em> 的文件 ... 全部超过 4百万个位元数。 这份说明文件,涵盖了,在安装开始之前,你必须知道的每件事,所以,你应该安装所有的说明文件。不仅你以後会参考到他们,同时这些文件,本身也提供许多TeX 和 LaTeX 例子的来源码。 TeX 由 Stanford 大学的 Donald Knuth 教授所写的。它是让像 LaTeX 那样的高阶程式集,用来排版的低阶语言,实际上, LaTeX 是一个提供使用者,更方便,并预先定义文件格式的 TeX 巨集。如果你喜欢使用 LaTeX 提供的格式,你就不需要学习原始的 TeX 程式语言。二种语法之间的差异,就像组合语言和C 语言之间的差异。你可选择 TeX 的速度和弹性,或者 LaTeX 的方便性。顺便一提 " TeX " 是希腊的字母, tau-epsilon-chi ,它不是代表兄弟会,而是一个希腊字,<em>techne</em>,代表艺术及[或]科学。 " TeX " 的发音不像 " Texas " ,<em>chi</em>,也没有类似的英文发音,依Knuth 所写TeX 重要的参考书<em>The TeXBook</em>所言,它像 "yecch" 的发音,当我们提到 " TeX " 时,通常就用大写,或者在排版时,用<tt>\TeX{}</tt> 巨集。 <sect2>文字编辑器 <P> 任何一个在 Linux之下工作的编辑器---<tt>jed , joe , jove , vi , vim , stevie ,</tt> Emacs 和 microemacs --- 都可以用来编辑一个 TeX 输入档案,只要编辑器能够读写一般 ASCII 本文就可以了。我自己偏爱使用 GNU Emacs ,这有几个理由: <itemize> <item>你能用 Emacs 的 TeX 和 LaTeX 模式,来格式,预览和列印文件。 <item> Emacs会自动地帮你插入 TeX 形式的引号,胜於一般 &dquot;ASCII-vanilla&dquot 。 <item> Emacs 已经整合并支援 Texinfo,一种超媒体文件系统。 <item> Emacs 广泛地被支援。举例来说,英文Linux 套件,包含19.34 版或较新的版本, GNU最新的版本是 20.3。 <item>除了在吐司上加上奶油以外,Emacs 能做每件事物。 <item>Emacs 是免费的。 </itemize> <sect2><tt>dvips</tt>. <P> Tomas Rokicki 的<tt>dvips</tt> ,能从<tt>dvi</tt> 档案产生 Postscript 档案。除此之外,如果有需要,它会执行Metafont ,制造输出时,所需要的点映射字型或 Postscript 字型。它也能分割,放大缩小每页版面大小,来放置由 TeX 或 LaTeX 指令所产生的图形的结果。 <tt>dvips</tt> 程式是 teTeX 套件的一部份在, <ref id="dvips" name="用 <tt>dvips</tt>混合文与图">这一节中有完整的讨论。 <sect2>字型 <P> 大部份 TeX,的复杂性,是由如何使用不同的字型系统,及指定字型的方式,所引起的,因此 LaTeX 也一样复杂。 LaTeX 2e 比前身还要好的一个主要改进,就是采用了使用者指定字型的方法,New Font Selection Scheme,在<ref id="characters" name="字元与内文型态">,<ref id="tex-font-commands" name="字型命令">, <ref id="postscript-fonts" name="使用Postscript 字型">等小节中有讨论。 teTeX 配置了许多标准字型,足够你使用,也提供描述字型大小等资料的 <tt>tfm</tt> ,(TeX font metric) , 档。为了要产生其他需要的字型,只要安装 <tt>metafont</tt> 就够了, teTeX 的<tt>dvi</tt> 公用程式,会呼叫 <tt>metafont</tt> ,自动产生所须的 Computer Modern 字型。 <sect>使用 teTeX.<label id="sec-using"> <P> 理论上,到目前为何,每个过程都已经正确地被安装好,而且可以使用了。 teTeX 是一个非常大的软体程式集,和使用其他复杂的软体程式集一样,不要被其复杂性吓到,而是要藉由慢慢地学习 teTeX 来开始。同时,我们要软体做些有用的东西,因此不需看 TeX 排版,像 <verb> ``Hello, World!'' </verb> 这样的文件,而如同Knuth 教授提议一样,我们自己将会为了测试它,而产生一些 teTeX's 的文件。 <sect1>列印文件<label id="print-documentation"> <P> 装好teTeX 之後,头几次要以 <tt>root</tt> 的身份,执行程式,否则 Metafont 就不会产生放字型必需的目录。<tt>texconfig</tt>内有包括一个选项,使那些字型目录,能够让所有人使用,但是如果你在一个多人使用的系统使用的话,由於安全考虑,可能使这选项,变成不实用或不受欢迎。如果你没有适当的那些字型储存目录的写入许可, Metafont 将会一直反应,它无法制造这些目录,因此你会有一长串零长度字型的字,所以你将看不见任何的输出。这不是问题,只要签出,再以<tt>root</tt>的身份,重复刚刚的操作,就可以了。 teTeX 最棒的事,就是你用坏了,也不会有实质上的伤害,不像翻译器,如果弄掉了一个指标,有可能毁了root 的分割区。什麽,你还没有读过 teTeX 使用手册 ? 当然你还没有读过,它仍然以来源码状态,存在套件□,等待输出。因此你不要再耽搁,要读一下 teTeX 手册,它位於下列目录中: <verb> /usr/lib/teTeX/texmf/doc/tetex. </verb> LaTeX 手册来源,被叫做<tt>TETEXDOC.tex</tt> ( TeX 和 LaTeX 档案的副档名,都为<tt>tex</tt> ,某些像Emacs 的编辑器,能分辨出它们之间的不同 )。 也有一个档案 <tt>TETEXDOC.dvi</tt> 附在套件□,如果稍後你要测试你的 <tt>.dvi</tt>驱动程式,可以把它保存在一个安全的地方 --- 例如,另外的一个目录。接著执行: <verb> latex TETEXDOC.tex </verb> LaTeX 会出现一些警告,首先出现: <verb> LaTeX Warning: Label(s) may have changed. Rerun to get the cross-references right. </verb> 这是正常的,一般须要藉由两次 LaTeX 来编译文件,建立文件内容表,所以忽略警告,重复命令。他们只是通知你,在文件中的一些 FTP 路径太宽,以至於放不进去所分配到空间□。 在 <ref id="para-dimen" name="段落形态与尺寸大小"> 和<ref id="tolerances" name="容忍度">小节□,会更详细地描述水平的空间间隔。 teTeX 将会从 <tt>TETEXDOC.tex.</tt>产生几个档案,令我们感到有兴趣的是<tt>TETEXDOC.dvi.</tt>那一个档案,它是一个与设备无关的输出档,你能将它输出到监视器观看,也可以由印表机输出。如果你是在 X 视窗系统之下,使用 teTeX ,就可用 <tt>xdvi</tt>预览文件。 暂时, 让我们假定你有一台 HP LaserJet 2 印表机,你下命令 <verb> dvilj2 TETEXDOC.dvi </verb> 可以印出一个从 <tt>TETEXDOC.dvi</tt> 输出的 PCL 档案,其中包括将会被下载到 LaserJet的字型。这<em>不</em> 是 TeX 或 LaTeX 的一个特徵,而是<tt>dvilj2</tt>提供的特徵。其他的 <tt>.dvi</tt>驱动程式,也会提供与他们支援的装置有关的特徵。<tt>dvilj2</tt>,会试著填上最接近原先在系统中 LaTeX 文件所要的字型。在一个像 <tt>TETEXDOC.tex</tt>简单的本文,一点也不难做到这样。如果所有被<tt>TETEXDOC.tex</tt>请求的字型不存在的话,都会自动地被 <tt>dvilj2</tt>呼叫<tt>metafont</tt>产生。 ( 如果你第一次执行<tt>dvilj2</tt>,这程式可能需要产生所有的字型 )。有几个选项,可让<tt>dvilj2</tt>用来控制产生字型,在手册中有概略说明。在这□,你不用直接地操作 <tt>metafont</tt> 。如果你要这样做,除了安装外,还要做一些事情。全部<tt>.dvi</tt>的驱动程式,都会直接地经由 kpathsea 寻找路径的程式库,呼叫<tt>metafont</tt> --- 这已超出这份文件讨论的□围 --- 而且,目前你暂时不用理会<tt>metafont</tt> --- 也有提供制造 Computer Modern font 的 <tt>metafont</tt>程式库,全部的来源码。 你能用下列命令,列印 <tt>TETEXDOC.lj</tt> : <verb> lpr TETEXDOC.lj </verb> 你也可能需要安装一个了解 PCL的印表机过滤器。 这九页的<em>teTeX Guide</em> ,提供你一些想要进一步设定系统,有用的讯息,有一些我已经提到,还有很多不涵盖在这份文件的东西。下一节里的有一些讯息,我还没有测试,因为我使用连接到电脑平行埠的非 Postscript HP Deskjet 400彩色喷墨印表机,然而没有一部Postscript 印表机,一点也不影响到列印文件内文和图形,在最大多数的 Linux 套件,都配有Ghostscript ,而且它可能已经安装在你的系统上了。 <sect> TeX 命令 <P> 准备 TeX 可以排版的文件是很容易的,只要确定本文档案的段落之间,都有一空白列,然後执行: <verb> tex your_text_file </verb> 结果将会产生一个相同档案名字,但副档案为 <tt>.dvi</tt> 档案。 TeX 内定用 10 点的 Computer Modern Roman 字型,单行行距的方式,格式化文件,并自动调整左边和右边的边缘。如果你收到像 $ 一样的错误信息,就在它的前面加一个反斜线 <tt>\</tt>,再一次执行TeX 。你应该能够用前面选择的 <tt>.dvi</tt> 翻译器,列印产生的档案。TeX 输入的一个特质是,双引号与单引号的前面和後面,分为开始和结束,两种不同的符号,如果你使用 Emacs 的 TeX 模态输入,它会自动帮你做这些: <verb> "These are ASCII-type quotes." ``These are `TeX-style' quotes.'' </verb> <sect1> 指令概论 <P> TeX 中用一个反斜线 (``\'') ,当作命令的开始,举例来说,改变列距的命令为: <verb> \baselineskip=24pt </verb> 基线是一条不含重音的字元底部的线,两条基线之间的距离,就是 <tt>\baselineskip</tt>的量,这□指定为 24 点。TeX 里的测量或尺寸,常用下列的单位: <verb> pt % 点 : 1/72 in. pc % 铅字体 : 12 pt. in % □ : 72.27 pt. cm % 公分 : 2.54 cm = 1 in. mm % 公□ : 10 mm = 1 cm. </verb> 一些命令不指定尺寸的单位,举例来说: <verb> \smallskip % 大约 3 pt. \medskip % 两个 \smallskips. \bigskip % 两个 \medskips. </verb> 一个 <tt>\smallskip</tt> 在垂直的空间插入 3 pt 的距离,因为 TeX 会调整每一页中断位置,每一节标题和其他垂直的空间的单位尺寸,所以那些量都是大概量,这对水平的间隔也是相同的。 <verb> \hsize=6.5in </verb> 这个命令,设定列宽为 6.5□, TeX 藉由调整字距,装满每一列,如果在容忍度内, TeX 不能够装满一列,它会产生一个警告讯息,而且尽可能调整好水平的间隔,格式的容忍度设定,参考 <ref id="tolerances" name="容忍度"> 一节。 有许多指定水平,垂直和容忍度的命令,普遍使用的命令,在下面会被提及。 <sect1>字型命令 <label id="tex-font-commands"> <P>  在 TeX中,内定的字型是 10 pt 的 Computer Modern Roman 字型,可使用下列的命令,指定字形为斜体,粗体或打字机体: <verb> \rm % 罗马体  ( 内定 ). \it % 意大利斜体字 \bf % 粗体字 \tt % 打字机体 \sl % 斜体字 </verb> 这个命令,会在他们出现的位置,开始改变文中的字形,就像: <verb> This text is Roman, \it and this text is italic. \bf This text is bold, and \rm this text is in Roman again. </verb> 为了要在你的文件指定字型,可使用 <tt>\font</tt> 命令: <verb> \font\romantwelve=cmr12 </verb> 这创造了字型命令 <tt>\romantwelve</tt>,将字型换成12 点 Computer Modern Roman 字型。 <verb> \romantwelve This is the Computer Modern Roman font at 12 points. </verb> 字型的资料可以看 teTeX 套件中的档案: <verb> /usr/lib/teTeX/texmf/doc/fonts/fontname/fontname.dvi </verb> 如果你要列印一个字型的例子, TeX 下列档案: <verb> /usr/lib/teTeX/texmf/tex/plain/base/fontchart.tex </verb> 而且在你要在提示号中,填上要列印的字型名字。 你也能由改变字型的大小,得到不同的效果,字型是依指数函数,由字型规格命令之後的 <tt>scaled \magstep</tt> 命令,来改变大小。 <verb> \font\sfmedium=cmss12 scaled \magstep 1 </verb> 这个命令将会使用1.2 倍的 12 点 sans serif 字型。字型从 0 到 5 ,分为五种倍率,可供放大缩小,每种倍率都以1.2 倍的大小增加。 <sect1>段落型态和尺寸大小 <label id="para-dimen"> <P> 上面提到, TeX 内定以10 点 Computer Modern Roman 的字型排版,行距,<tt>\hsize</tt> 内定为 6.5 □,如果你要改变 <tt>\hsize</tt> 为 5.5 □,举例来说,使用这个命令: <verb> \hsize=5.5in </verb> 在 TeX 中,调整水平或垂直的单位,就是这个量, <em>dimension</em> ,能随改变它的定义,而被增加或减少,跟尺寸大小有关的,是 <em>skip</em> ,它被放在 TeX 内在的暂存器, skip 与 <tt>\newskip</tt> 命令一起被定义, <tt>\smallskip</tt>在 TeX 定义是: <verb> \newskip\smallskipamount \smallskipamount=3pt plus 1pt minus 1pt </verb> 更简洁的 <tt>\smallskip</tt> 命令为: <verb> \vskip\smallskipamount </verb> 有许多的控制输出页的尺寸大小,这些都收集在 <ref id="tex-page" name=" 页面设计 "> 那一节。 TeX 格式段落时,会自动调整内文与左边和右边边缘的距离,如果你只要调整左边的边缘的距离,使用这命令: <verb> \raggedright </verb> 如果只要调整右边的边缘的距离,则使用 <tt>\rightline</tt>命令: <verb> \rightline{This is the line to be typeset.} </verb> 这 <tt>\line</tt> 命令,会尽量以填满每一列的方法来排版: <verb> \line{This text will be spaced to fit the entire line.} </verb> <tt>\hfil</tt> 命令,会把它所在的那一列,都填满,举例来说, <tt>\rightline</tt> 命令等於: equivalent to: <verb> \line{\hfilThis line will be right justified.} </verb> 要以对称中间的方式排版,则用 <tt>\centerline</tt>命令: <verb> \centerline{This is the line to be centered.} </verb> 为了要改变左边边缘的距离,如下例,改变 <tt>\hoffset</tt>的值: <verb> \hoffset=1.5in </verb> <tt>\parindent</tt> 命令指定每个段落的第一行缩排的量: <verb> \parindent=.5in </verb> 二个其他尺寸命令, <tt>\leftskip</tt> 和 <tt>\rightskip</tt>使得在他们之後的段落,分别向左或向右缩排: <verb> \leftskip=.5in \rightskip=.5in </verb> 控制命令 <tt>\narrower</tt> 等於 <verb> \leftskip=\parindent \rightskip=\parindent </verb> 也就是 <tt>\narrower</tt> ,会以 <tt>\parindent</tt> 的值,把段落边缘变窄。 如前面所提 <tt>\baselineskip</tt> 内定行距为12 pt 。为了要使行距变成内定值的两倍,可使用下列的命令: <verb> \baselineskip=\baselineskip*1.6 </verb> <tt>\parskip</tt> 命令,除了保有 <tt>\baselineskip</tt> 的命令,还会额外增加段落之间的距离,其内定为不增加额外的空间,但在段落之间会多增加1 个点的距离,使内文更正确地填满每一页。如果要在段落之间,增加一空白列,则使用这命令: <verb> \parskip=\baselineskip </verb> <sect2>容忍度 ( 在每列末端那些黑色的长方形是什麽? )<label id="tolerances"> <P> TeX 通常会严格的在容忍度下格式文件。如果, 有一些理由,文件不能在容忍度下格式化,虽然 TeX 会产生一个警告讯息,它还是尽可能格式化文件。如果每一列本文太短,而被伸展太多, TeX 会警告你, <tt>\hbox</tt> 是 underfull 。如果每一列本文太长,而必须被压缩,则会警告你, <tt>\hbox</tt> 是overfull 。 每一个 overfull <tt>\hbox</tt>, TeX 会在每列末端,产生 <em>实心</em>黑色的长方形。这实心的长方形,代表不能够在 <tt>\hbadness</tt> 参数规定内,格式化这一列。文件在指定的尺寸大小下的适合性,是用 <em>badness</em>来衡量,它是一个介於 0 到 10000之间数字。badness 为0 ,代表最完美, 10000 代表适合性最差, <tt>\hbadness</tt> 内定为 1000。如果你把 <tt>\hbadness</tt> 设为 10000 , TeX 永远不会报告 underfull 。有时 TeX 允许一列,能扩充到右边的边缘,这是 TeX作者的美学决定的一部份,这是由内定为 0.1 pt 的 <tt>\hfuzz</tt> 参数所决定的。如果本文装不进一列内,<tt>\tolerance</tt> 的参数会处理<tt>\hbox</tt> overfull 的问题。 <tt>\tolerance</tt> 内定为 200 ,把设定改为1000 ,则会抑制 overfull <tt>\hbox</tt> 和实心黑色长方形的产生。 <sect1>页面设计 <label id="tex-page"> <P> 除了早先提到的左边的边缘,和行宽之外, TeX 也让你可以指定顶端,末端,和垂直的间隔。像在早先提到的 <tt>\hsize</tt> 和 <tt>\hoffset</tt> 尺寸大小一样, TeX 也提供那 <tt>\vsize</tt> 和 <tt>\voffset</tt> 命令。<tt>\vsize</tt> 内定为 8.9 □, <tt>\voffset</tt> 内定为 0 □。 正常地, teTeX 会把本文第一行的开端,放在离顶端下面 1 □,且离左边的边缘1 □的位置。你能用命令,让本文更靠近每页的顶端: <verb> \voffset=-0.5in </verb> 如果你要增加一份文件里的垂直空间,命令 <tt>\smallskip</tt>, <tt>\medskip</tt>, 和<tt>\bigskip</tt> 将会增加大约 3 , 6 , 或 12 点的空白垂直间隔。这些都是大约的量, TeX 将会以一个点,一个点的方式调整,正确地填满每一页。 <tt>\vfill</tt>命令,会在每一页的段落之间,增加一个可调整的垂直间隔,它可以无限地伸展,所以它会把每一页,剩下的垂直间隔填满。如果你要指定一个尺寸大小,如下指定 <tt>\vskip</tt> 为: <verb> \vskip 10pt </verb> <tt>\hss</tt> 和 <tt>\vss</tt> 命令类似 <tt>\hfil</tt> 和 <tt>\vfill</tt>,但是他们可以无限地收缩和伸展。 <tt>\vskip</tt> 和 <tt>\vfill</tt> 命令,可产生弹性的长度,如果没有内文,他们不增加空间,举例来说,在任一页的顶端。如果你要增加一绝对的空间,使用 <tt>\vglue</tt> 。 TeX 会尽量去填满 <tt>\vsize</tt> 的尺寸,直到新的一页开始。 <tt>\vfill \eject</tt> 会强迫跳行,如果不用 <tt>\vfill</tt> ,内文会继续填满每一页,直到 <tt>\break</tt> 出现。 如果你要 TeX 更能够有弹性的使用垂直标示,在你的文件中,可用 <tt>\raggedbottom</tt>命令,然後 TeX 将会些微地调整每页的底部边缘,使垂直的间隔更一致。 <sect1>页数、标首和注脚 <P> teTeX 的页数,内定放在每页底部中心的位置,如果你要改变放页数的位置和格式,你能藉由改变 <tt>\headline</tt> 和 <tt>\footline</tt>的定义,变更标首和注脚, <tt>\footline</tt> 内定包含 <tt>\folio</tt> 命令,因此会列印页数, <tt>\headline</tt> 内定包含 <tt>\hfil</tt>命令,因此会列印一空白列。 <tt>\pageno</tt>命令,如同是TeX's 的内在页数计算器。你能藉由变更<tt>\pageno</tt> ,而改变页数,如果 <tt>\pageno</tt> 是负的,则页数以罗马数字列印: <verb> \pageno=10 \pageno=-1 </verb> 不列印页数的命令, <tt>\nopagenumbers</tt> ,可速记为: <verb> \headline={\hfil} \footline={\hfil} </verb> 内定的 footline ,也包含字型命令 <tt>\tenrm</tt>,将页数字的字型,设定为 10 点罗马字型,举例来说,如果你要以 12 点罗马字型,列印页数,首先你先定义12 点罗马字型,然後在 <tt>\footline</tt>定义中使用,字型命令在<ref id="tex-font-commands" name="Font commands"> 这一节中会讨论。 <verb> \font\twelvrm=cmr12 \footline={\hss\twelvrm\folio\hss} </verb> 你能藉由重新定义 <tt>\headline</tt> ,来制定一条 <em>rule</em> ,在每页的顶端,放一个水平线: <verb> \headline={\hrulefill} </verb> 使用 <tt>\ifodd</tt>,指定偶数页和奇数页放的位置不同,它的语法如下: <verb> \ifodd[condition][true-action]\else[false-action </verb> 一个用 <tt>\headline</tt> 指定偶数页和奇数页摆法不同的例子,就如: <verb> \headline={\ifodd\pageno odd-page-header \else even-page-header} </verb> 如果是奇数页, <tt>\ifodd</tt> 就使用第一个参数,否则使用第二个参数。 <sect1>标题和巨集 <P> TeX 只提供制定每节标题,使用 <tt>\beginsection</tt> 命令,它在内文之上,留一个空间,用粗体字列印标题,标题之後增加一个 <tt>\smallskip</tt> ,并使得下一个段落不缩排。 底下提到的LaTeX 标示章节的命令,会替每一节,标上节数,而且将会列印每一节名称,并在标首,列印页数,并自动地把这些章节,加入目录表。 在 plain TeX 中你必须亲自加上这些命令。<tt>\def</tt> ,允许你定义新的命令,假如你要列印章名,首先你要定义使用的字型,如果使用放大的sans serif 字型,则定义如下: <verb> \font\chapterfontsans=cmss12 scaled \magstep 4 </verb> 如果你要使用高约24 个点的字型,则使用 <tt>\chapterfontsans</tt> 命令,转变到这个字型,然而,在这个例子中,它主要被用在<tt>\chaptertitlesans</tt>之中。它的定义为: <verb> \def\chaptertitlesans#1{\hbox{}\bigskip\bigskip \noindent{\leftline{\chapterfontsans#1}} \par\bigskip\bigskip\noindent} </verb> 第一行中, <tt>\hbox{}\bigskip</tt>的<tt>\hbox{}</tt>指令,在每页的顶端,放置一个 12 点的空间,这样章名,既不缩排,也不会使得下个段落紧接在後,如果你在<tt>\sschaptertitle</tt> 巨集和下一个段落之间,要放置一条空白列,则最後的 <tt>\noindent</tt> ,会作用到这空白列,而非下列的段落。为了要正确地格式化,在这个例子中,使用 <tt>\sschaptertitle</tt> : 定义里的 <tt>#1</tt> 陈述,由第一个参数,替换到 <tt>\chaptertitlesans</tt>; ,也就是章名, TeX 的参数以 <tt>#1</tt>, <tt>#2</tt>, <tt>#3</tt>,等等前後顺序宣告,一个如何使用<tt>\chaptertitlesans</tt> 的例子如下: <verb> \chaptertitlesans{Chapter 1} This is the starting text of the first paragraph of the chapter. The paragraph will not be indented. The chapter's title is "Chapter 1." </verb> <sect> LaTeX 命令 <label id="print-your-own"> <P> <sect1>文章架构 <P> 用 LaTeX 编排文章只有几个法则,但已够用来编排复杂的文章。 LaTeX也尽可能简化了编译的过程。 实际上 LaTeX 是一种文件标示语言,它把内文逻辑和输出形式分开来处理。例如,用TeX 制定,每一节标题的格式,为预留36 点的垂直距离,然後印上粗体两倍大的标题和页数,隔两个字元的垂直距离,再继续内文的输入。相对的,LaTeX 使用<tt>\section{}</tt>命令, 它会做上述的所有的工作。如果你要改变它的格式,可以修改<tt>\section{}</tt> 来代替更改文件内容。这将会使得重新格式超过数十页的文件时,会省下很多时间。 所有 LaTeX 文件包含三个部份 : <em>前文</em> ,<em>内文</em>和 <em>结尾</em>, 这些都是 TeX 专家常用的语法。 在前文部份,最少要指定文件的型态 --- <em>文件的型态</em> --- 和文件内文开始的标志,就像: <verb> \documentclass{article} \begin{document} </verb> 文件的结尾通常很简单,除了某些特殊例子,它只有: <verb> \end{document} </verb> 其中 <tt>\begin{document}</tt> 和 <tt>\end{document}</tt> 必须成对使用,在 LaTeX 中,这就叫做<em>环境</em>,所有输入文章,都须要在环境中,而且许多命令,只有在呼叫它们的环境中,才有作用,然而,在使用 LaTeX, 一定要有 <tt>document</tt>的环境,即唯一须要的环境。( 除了<tt>letter</tt> 型态,须要宣告<tt>\begin{letter}</tt> 和 <tt> \end{letter}</tt>,参考section <ref id="letter-class" name="Letters信件"> 。 ) 还有许多格式的环境,在底下会再提到。 文件格式也叫做参数,内文内定字高度为 10 点,若要改变预定格式,可以更改参数,如: <verb> \documentclass[12pt]{article} </verb> 字高度改为 12 点。 <em>article,</em>格式也做了一些必要的调整。 下列有一些常用的标准格式。<em>report</em> 格式是和<em>article</em>格式相似的,是报告格式预先设定一个主题名称,每一节由新的一页开始。<em>letter</em> 格式包含一些特别的 addresses , salutations 和 closings 定义,底下会提到一些。 你可以用<tt>\usepackage{}</tt>的命令,来加入包装好的 LaTeX 内文码,一般叫做<em>程式集</em> , <verb> \usepackage{fancyhdr} </verb> 上述命令,就是加入在<tt>TEXINPUTS</tt>子目录中的风格档,<tt>fancyhdr.sty</tt>,通常在装好TeX 系统後,就会有许多类似的风格档。 <verb> \documentclass{article} \usepackage{fancyhdr} \begin{document} </verb> 注意<tt>\usepackage{}</tt> 必须在<tt>\begin{document}</tt>之前, 即文件的前文。 其中<tt>fancyhdr.sty</tt> 会增加<tt>\pagestyle{}</tt> 的命令,使得用者可依须要,自己设计 headers 和 footers , 大多数 LaTeX 提供下列headers 和 footers 的标准格式: <verb> \pagestyle{plain} % 内定格式档 - 页数在底部中间 \pagestyle{empty} % 没有 headers 和 footers \pagestyle{headings} % 节数和页数在每页顶端 \pagestyle{myheadings} % 在每页顶端列印你要印的东 </verb> 百分比符号右边是命令的注解。 <tt>\pagestyle{}</tt> 的命令,直到编译下页时才作用,因此要改变正在输入的地方的 headers 和 footers 可使用: <verb> \thispagestyle{the_pagestyle} </verb> <sect1>字元与内文型态<label id="characters"> <P> 一般LaTeX 会内定字元的型态,但是它也允许输出别的型态,例如粗体字、斜体字等 ,也可以画底线,详见<ref id="latex-packages" name=" LaTeX 扩充程式集与其他资源"> 有几种方法表示内文要强调的部分,最常用的是 <tt>\em</tt> 命令,在它的□围里面所有的本文,都用强调体字型编排,例如: <verb> This word will be {\em emphasized.} </verb> 如果你已经用调体字型编排某个段落,可以用 <tt>\/</tt>取消用调体字型的命令,是用,一个反斜线和一个向前的斜线。例如: <verb> This example {\em will\/} print correctly. This example will {\em not} print correctly. </verb> 另外,稍为缺少可携带性,但还可以接受的是, <tt>\it</tt>, <tt>\bf</tt>,和<tt>\tt</tt>命令,在命令的□围里面,分别使用意大利斜体字,粗体字和打字机字体,例如:. <verb> {\tt This text will be printed monospaced,} {\it this text will be italic,} and {\bf this text will be bold\dots} all in one paragraph. </verb> 命令 <tt>\dots</tt> 连续列印不分开的三个句点。 LaTeX 最近的版本,也是你有的版本,後用的指定命令,会代替前面的命令。 <verb> This is {\it not {\bf bold italic!}} </verb> TeTeX 用意大利斜体字编排本文,直到它遇到那 <tt>\bf</tt> 命令,才改为粗体字。 为了要到达这目的,选择字型的 NFSS 方案需要考虑每种字体的三个参数: shape , series 和 family 。如果需要替换另外的字型, LaTeX先会警告你。你也可以先宣告使用下列各项字型: You can specify the following font shapes: <verb> \textup{text} % 正常的形状 ( 预设值 ) \textit{text} % 意大利斜体字 \textsl{text} % 斜体字 \textsc{text} % small caps </verb> 大部分的字型都可使用下列两种 series : <verb> \textmd{text} % 中等 series ( 预设值 ) \textbf{text} % 黑体字 series. </verb> 有三个families的类型可用 <verb> \textrm{text} % 罗马体 ( 预设值 ) \textsf{text} % sans 字体 \texttt{text} % 打字机字体 ( 类似 Courier ) </verb> 你能使用这些参数设定字型,以组成想要的效果。 <verb> \texttt{\textit{This example likely will result in a font substitution, because many fonts don't include a typewriter italic typeface.}} </verb> TeX系统内定使用点距阵的字型,即 Computer Modern,其他Postscript 格式的 Type 1 字型也常用到。使用的方法参考 <ref id="postscript-fonts" name="使用 PostScript 字型">。 也有许多特别的字元可以使用,下列是少许例子,自己用印表机试试。 <verb> \'{o} \`{e} \^{o} \"{u} \={o} \c{c} `? `! \copyright \pounds \dag </verb> 最後,在 TeX 和 LaTeX 也可以使用 meta 和 ESC 的字元可以使用,只要与一个反斜线一起使用就可以了。例如: <verb> # $ % & _ { } </verb> LaTeX 提供许多非英文的字母,像希腊字母和斯拉夫字母,其他参考会详述这些。 <sect1>边缘和行距 <P> TeX 或 LaTeX 文件里的边缘,不可以直接的变更,往往它跟你正在试著调整的内文有关系,放置变更命令的位置也是很重要的。 对於控制 LaTeX 文件宽度的命令,可使用<tt>\evensidemargin</tt> 和<tt>\oddsidemargin</tt>,他们分别会改变偶数页的左侧和奇数页的右侧。举例来说, <verb> \evensidemargin=1in \oddsidemargin=1in </verb> 使得正常离边缘一□的偶数页的左侧和奇数页的右侧, <em>额外</em> 再增加一□到两□, 而且这些命令会到影响全部的文件,不会被其他局部的命令影响到,所以<tt>诗文体</tt> 和 <tt>列表</tt>,很适合使用这些命令。 下面是本文作者写的一组变更边缘的巨集指令,他们和上面提到的命令,有不同的效果,因为他们使用 plain TeX 命令,不保证在 LaTeX 文件中会有效,但是你还是可以把它放在开始想改变边缘的位置。 <verb> %% margins.sty -- v. 0.1 by Robert Kiesling %% 这个巨集指令可以自由地被散布及使用 %% %% 一些基本的 plain TeX 变更边缘的命令. 长度单位为□ %% %% \leftmargin{1} %% 文件左边离边缘一□ %% \leftindent{1} %% 段落左边离边缘一□ %% \rightindent{1} %% 段落右边离边缘一□ %% \llength{3} %% 下列各行的长度设定为 3 □ %% \message{Margins macros...} \def\lmargin#1{\hoffset = #1 in} \def\lindent#1{\leftskip = #1 in} \def\rindent#1{\rightskip = #1 in} \def\llength#1{\hsize = #1 in} %% %% (End of margins macros.} </verb> 把这个 <tt>margins.sty</tt> 放在<tt>$TEXINPUTS</tt> 的目录内。命令的作用如同注解,在一份文件前文中使用下列命令,就可以使用它们了: <verb> \usepackage{margins} </verb> 由於 LaTeX 会自己调整每行右边的边缘,( 使每一行的尾端都对齐,但是有时会看起来怪怪的 ) ,可以使用下列命令取消这内定的功能: <verb> \raggedright </verb> 设定行距也有些复杂。 <em>baselineskip</em> 的量是设定文章的行距,通常都会给一个正的数,举例来说: <verb> \baselineskip=24pt </verb> 或使用较好的: <verb> \setlength{\baselineskip}{24pt} </verb> 二者之间的差异是, <em>setlength</em> 会优先让其他会影响文章编排的命令执行。 使用 baselineskip 的问题是,它也会影响到区段的标题,注脚和相似的命令。如果使用 baselineskip ,必须随时注意它对你正在格式的文章的影响,有些 LaTeX 的巨集,像<tt>setspace.sty,</tt> ,对在这些环境中的使用将会帮助,请参考:<ref id="latex-packages" name=" LaTeX 扩充程式集与其他资源">. <sect1>文章格式 <P> LaTeX 提供标准化的格式提供给文件输入,诸如目录、引用段落、注脚及其他文件的格式供人使用,下列包含一些常用的标准格式。 <sect2>文章与报告 <P> 如前面所提到, <tt>文章</tt>格式和 <tt>报告</tt>格式是相似的。主要的不同是报告格式,预先设定一个主题名称,每一节由新的一页开始。虽然这样,两者大至上是相似的。,预先设定一个主题名称,每一节由新的一页开始。 举例来说,为了要制造主题名称,摘要和每一行,预先在前面输入: <verb> \title{The Breeding Habits of Cacti} \author{John Q. Public} \abstract{Description of how common desert cacti search for appropriate watering holes to perform their breeding rituals.} </verb> 然後,这命令 <verb> \maketitle </verb> 会使得用报告格式的文章,在开始的地方或第一页的顶端,产生主题名称和摘要。 其他段落的命令定义如下: <verb> \section \subsection \subsubsection </verb> 这些命令将会在文件中,产生标准并已编号的小节,若不让每小节自动编号,则使用: <verb> \section* \subsection* \subsubsection* </verb> 以此类推。 LaTeX 提供许多表现输出文件的环境供人使用,你能用<tt>引述</tt> 环境,包括要引述的部分。 <verb> \begin{quotation} Start of paragraph to be quoted... ... end of paragraph. \end{quotation} </verb> 比较短的引述,可以使用 <tt>引述</tt>环境。 至於要格式化诗文,则用 <tt>诗文体</tt>环境。 <verb> \begin{verse} Because I could not stop for death\\ He kindly stopped for me \end{verse} </verb> 可以使用两个反斜线(\\),达到跳行的目的,否则LaTeX 会以这诗体的格式,继续编排直到这一行结束。 至於列表有几种方式,用<tt>list</tt> 环境的列举格式, <verb> \begin{list} \item This is the first item of the list. \item This is the second item of the list... \item ... and so on. \end{list} </verb> 用<tt>enumerate</tt>环境标示号码顺序的: A numbered list uses the <tt>enumerate</tt> environment: <verb> \begin{enumerate} \item Item No. 1. \item Item No. 2. \item \dots \end{enumerate} </verb> 用<tt>description</tt>环境描述主题的: <verb> \begin{description} \item{Oven} Dirty, needs new burner. \item{Refrigerator} Dirty. Sorry. \item{Sink and drainboard} Stained, drippy, cold water faucet. \end{description} </verb> <sect2>信件格式<label id="letter-class"> <P> 这<tt>信件</tt>格式特别为商业信件制定一些特殊的用法。 这<tt>信件</tt>格式有一点争论,即收信人的住址。<tt> address </tt> 的命令,必须在文件前文中出现,而定义寄件人名字,<tt>signature</tt> 的命令,则在结束之後出现。. 一个使用 LaTeX 信件格式的简单例子就像: <verb> \documentclass[12pt]{letter} \signature{John Q. Public} \address{123 Main St.\\Los Angeles, CA. 96005\\Tel: 123/456-7890} \begin{document} \begin{letter}{ACME Brick Co.\\100 Ash St.\\San Diego, CA 96403} \opening{Dear Sir/Madam:} With regard to one of your bricks that I found on my living room carpet surrounded by shards of my broken front window... (Remainder of the body of the letter.) \closing{Sincerely,} \end{letter} \end{document} </verb> 注意住址中两个反斜线的地方,就是跳行的地方。 <sect> LaTeX 扩充程式集与其他资源 <label id="latex-packages"> <P> 上面提到,用划底线的方式来强调文件重点的方式,有一点特殊。实际上,对 TeX  而言,划底线是数学上常用编排的方法,LaTeX 则可用下列的方法划底线: <verb> \underline{text to be underlined} </verb> 问题是划底线不会连接到下一行,因此在一些情况下,可能会不平顺的。然而, LaTeX 有一个现成的巨集,会在强调的部分划底线,它就是 <tt>ulem.sty</tt>,这是一个可以经由网际网路,自由传递及自由使用的巨集之一。 为了要使用 <tt>ulem.sty</tt>,可在前文使用: <verb> \usepackage{ulem} </verb> 那些提供LaTeX 使用的巨集指令还包括: <descrip> <tag/ifthen /在文件中包括有条件的陈述 <tag/initials /定义字首字母的字型 <tag/sanskrit /用 Sanskrit 编排文件 <tag/recipe /一个 LaTeX2e 清单式的命令 <tag/refman /不同的报告和文章格式 </descrip> 为了完整的给予目录中 URL 正确的位址和目录,可以把它分成主机和 CTAN archive 的目录,举例来说,位置 <htmlurl url="ftp://ftp.tex.ac.uk" name="ftp.tex.ac.uk"> 的最高阶层的 CTAN 目录是 <tt>ctan/tex-archive</tt>. 使用 <bf>refman</bf> 巨集中表示完整的 URL 的目录就如下面一样: <verb> ftp://ftp.tex.ac.uk/ctan/tex-archive/ + macros/latex/contrib/supported/refman = ftp://ftp.tex.ac.uk/ctan/tex-archive/macros/latex/contrib/supported/refman/ </verb> 有些巨集不只一个档案,所以必须指明它所在目录的路径。 当你有 URL 时,便能从後面 <ref id="ctan-list" name="Appendix A">中任何一个 CTAN archive 位置,取回巨集。你也能从archive 的最高层的目录中,下载以 <tt>FILES.byname</tt>为名的档案,它□面有archive 全部档案的目录表,也可以在<tt>ftp</tt>中使用查询的命令: <verb> quote site index <keyword> </verb> <sect>用 <tt>dvips</tt> 混合文与图<label id="dvips"> <P> 大体上,这节中的方法,可用於任何 TeX 或LaTeX 文件中,混合编排本文和图形。 和最其他的 TeX 组件一样,teTeX 预先设定使用Computer Modern fonts 。当用 Type 1 scalable fonts 或用画图的方式列印文件时,字型和描图的方法,就是 <tt>dvips</tt>要作的事。 <tt>dvips</tt> 能使用点距阵型的Computer Modern fonts 或向量型的Type 1 scalable  fonts 或两者混合使用。首先,让我们著重於图形的列印和预览。 你或许会依照这个程序,在 LaTeX 文件的前文中,使用: <verb> \includepackage{graphics} </verb> 这指令要LaTeX在文件里加入 <tt>graphics.sty</tt> 的指令集,其中有一些的命令可以用来画图,但是不管有没有使用 <tt>dvips</tt>,在 plain-TeX 中这些命令可能不能用。这两者最显著的差别,在输入文件时,後者会遗漏图形。 因此,我们将会著重於 LaTeX 使用 <tt>graphics.sty</tt> 指令集。你可能须要看一看原始的 TeX 输入,teTeX 不包含这部分,但是它会在下列网址中提供: <verb> ~CTAN/macros/latex/packages/graphics/grfguide.tex. </verb> teTeX 和一般 TeX 一样会输出 <tt>.dvi</tt> 档,这样有一个理由,就是为了正常的输出文件,而必须依照顺序把Type 1 fonts 包括进来。如果要用LaTeX 的 <tt>grfguide.tex,</tt> ,请参考下一节。现在我们将会使用 <tt>dvips</tt>来处理输出。 档案 <tt>grfguide.dvi</tt> 位於目录 <verb> texmf/doc/latex/graphics </verb> 输出 <tt>grfguide.dvi</tt> 的第一个步骤,是将它翻译成Postscript ,正如 <tt>dvips</tt> 的名字,这就是它的目的。呼叫 <tt>dvips</tt>, 有许多方法,但是最简单的是: <verb> dvips -f -r <grfguide.dvi >grfguide.ps </verb> <tt>dvips</tt> 中 <tt>-f</tt>选项,当作过滤器,由标准的输入读入,并由标准的输出写出来, <tt>dvips</tt> 的预设标准的输出为<tt>lpr</tt>。 如果你能利用<tt>lpr</tt>,直接由印表机列印Postscript 档,则只要输入: <verb> dvips -r grfguide.dvi </verb> <tt>-r</tt> 选项,则要dvips 依相反顺序输出结果,那麽由印表机印出来时,文件正好由前至後,按照顺序排好,就依你的输出设备,决定要不要使用这选项。 <tt>dvips</tt> 和 metafont 会依编译成dvi 时,<tt>dvilj2</tt>是否有必要的字型,自动决定要不要产生<tt>grfguide.dvi.</tt>需要的新的字型。之後,就会从预备好的输出设备,输出由 <tt>dvips</tt> 转成的 Postscript 档。 如果你够幸运 ( 或富有 ) ,已经有一部Postscript的印表机,就能够直接列印 <tt>grfguide.ps</tt> 。你能藉由使用 <tt>lpr</tt> 送到印表机的输出。如果你的印表机软体安装不正确,也能使用下列命令列印: <verb> cat grfguide.ps >/dev/lp0 </verb> 但是不建议使用这方法。 这是手动呼叫 Ghostscript 运作的标准的程序:第一步是呼叫 Ghostscript 进入命令模式,像这样: <verb> gs -help | less </verb> 你将会看见支援的输出设备目录,和其他的命令。选择和你的印表机最相配的输出设备。通常我都输出黑白的文章,因此选择<tt>cdjmono</tt> 驱动程式,作为彩色 Deskjet 的黑白模式的驱动程式。 我会使用这样的命令: <verb> gs -dNOPAUSE -sDEVICE=cdjmono -sOutputFile=/tmp/gs.out grfguide.ps -c quit </verb> 这将会在 <tt>/tmp</tt>目录里产生HP 相容的输出。使用一个目录像 <tt>/tmp,</tt>,是一个好的主意,因为 <tt>gs</tt> 牵涉到使用权的问题,而且你当然不能 ( 也不应该 ) 以 <tt>root</tt> 的身份,进入系统使用。现在你能使用下列命令列印档案: <verb> lpr /tmp/gs.out </verb> 明显地,这些能被写成一个shell 档来使用。在我的系统上,我就写了二个简单的 shell 档, <tt>pv</tt> 和 <tt>pr,</tt> ,输出Postscript档案到显示器或印表机。不使用 X 视窗,也可以预览结果,但是并不理想,所以想要好好预览结果,最好安装 XFree86 。 因为一些 <tt>gs</tt> 命令列的选项会告诉 Ghostscript 到那个程式库 ,去找Postscript 的部分程式码,所以命令列的选项次序非常重要的。 还记得 <tt>grfguide.dvi</tt> 会请求使用Computer Modern 点距阵字和Type 1向量字型,如果你能混合使用这两种字型,你就成了一个TeX 专家了。 <sect1>如果我的印表机不被支援,怎麽办? <P> teTeX 系统的DVI 输出驱动程式,只有几个选择: <tt>dvips</tt>,HP 雷射印表机,就没别的。如果你有一部不是 HP LaserJet 相容的印表机,你有二个选择:使用 <tt>dvips</tt>和 Ghostscript ,这是我所能推荐的,或者找一下其他的 dviware 来源。 只有几个 DVI 驱动程式,被移植到Linux ,并预先编译成二进位的执行档,可以在下列网址找到: <htmlurl url="ftp://sunsite.unc.edu/pub/Linux/apps/tex/dvi/" name="ftp://sunsite.unc.edu/pub/Linux/apps/tex/dvi/">. 这些 dviware 的程式,主要由犹他大学的档案库维护,如果在那里,找不到一个支援你的印表机,那很可能就是它不存在。你也能藉由那里提供的样本, <em>自己</em>写 DVI 驱动程式,程式库的网址为:<htmlurl url="ftp://ftp.math.utah.edu/pub/tex/dvi/" name="ftp://ftp.math.utah.edu/pub/tex/dvi/">. <sect>使用Postscript字型 <label id="postscript-fonts"> <P> 通常Type 1 向量字型的列印品质比Computer Modern 点距阵字型差,最近几年,这种情形虽有改善,但是使用那些字型,还是由你决定。在一部机器上,过多的字型是多馀的也是不必要的,而且浪费磁碟空间。<em>正式</em> 使用上, Computer Modern 字型较为适合,这提醒我,有时也要用好的容器□狗,至少你不需要花费太多的时间,就能使用专业品质的字型。 LaTeX2e 比前身还要好的一个主要改进,就是加入新的字型选择技巧,( 它现在被叫做 PSNFSS)。正常TeX 使用者会以这样命令指定字型: <verb> \font=bodyroman = cmr10 scaled \magstep 1 </verb> 这命令非常明确的指定要那一种字型,但是想要运用自如,还需要有设计者和数学家的技巧,同时它的携带性也不好,如果一个系统没有 <tt>cmr10</tt>, ( 即Computer Modern Roman 体的 10 字型 ) , 则它会以某个特定的字型规格,替全部的文件编码。而这个 PSNFSS 允许由一系列的字型 ( Computer Modern, URW Nimbus,Helvetica, Utopia, 等等 ) 、字的粗细 ( 细体,中体,粗体 ) 、字的方位 ( 正直的或斜 ) 、字形 ( 罗马体,斜体 ) 和基本字型大小,指定要用的字型。 ( 详细使用方法,请参考 <ref id="characters" name="字元、字形形态"> 那小节 ) 有很多字型会被同时包含在同一字型集,举例来说, Helvetica 字型集包含罗马字型和 sans serif 字型, Courier 包含罗马字型和 monospaced 字型。你也可和其他LaTeX 使用者一样,用一个命令,就可以使用某一个字型集。 正如前面所提,有几个高品质字型集供人自由使用,其中之一是 Adobe 的 Utopia 字型,另外之一是 Bitstream 的 Charter 字型,两者都是已经被捐赠,让人自由使用的具有商业化品质字型。 我也乐於见到下列两个状况发展,其中一个是,观察周围CTAN 资料库,你会发现在那里,不但有这些字型,而且还收录了其他的字型。在那里有充足的字型,供你用 LaTeX 设计文件,同时并不只限於使用英文。本来 TeX 被设计来作数学的排版,所以有完整可用的数学的字型,例如斯拉夫体、希腊体、 Kana 和其他太很多而不能提到的字母。 另一个重要的事是有关副档名为<tt>.pfa</tt> 或 <tt>.pfb</tt> 的档案,他们本身就是向量字型档,而不是描述字型大小等资料的档案,Type 1 向量字型使用副档名为 <tt>.pfm</tt> 的档案,当做描述字型大小等资料的档案,不同於点距阵字型使用副档名为<tt>.tfm</tt> 的档案,这两种字形集分别都放收在 teTeX 中。 正如我所言,用PSNFSS 选择字型和下面的例子一样,真的很容易,如果我们要在文件中,使用Charter 字型代替 Computer Modern 字型,只要在文件前文中,加入 LaTeX 指令就可以了: <verb> \renewcommand{\familydefault}{bch} </verb> 其中 "bch" 指定使用 Bitstream Charter字型,这字型放在下列目录中: <verb> /usr/lib/teTeX/texmf/fonts/type1/bitstrea/charter </verb> 在那里你将会看见Charter 字型的 <tt>.pfb</tt> 档案:<tt>bchb8a.pfb</tt> 代表粗体Charter 字型, <tt>bchr8a.pfb</tt> 代表罗马体Charter 字型, <tt>bchbi8a.pfb</tt> 代表斜体Charter 字型,"8a" 代表字元编码。不同於 8 位元的字元,这些字采用 超过128 位元数的方法编码,所以不要担心不够用,他们大概用来定义重音和非英文的字元。因为Type 1 字元的编码和给国际字元使用的ISO 8859 标准一致,很适合使用西方的字元,所以这也是使用这一类字型的额外好处。 如果要用Charter 字型排版文件,你要下这样的命令: <verb> pslatex document.tex </verb> <tt>pslatex</tt> 是 teTeX 的标准 <tt>latex</tt>的一个变体命令,它定义Type 1 字型在那些目录,和额外的latex 内码,你将会在TeX 作用下,伴随出来的讯息,看见执行 <tt>pslatex</tt> 的警示萤幕。过一会,就产生须要Charter 字型的 <tt>.dvi</tt> 档案,然後你能用<tt>dvips</tt>列印档案,如果有须要,就使用<tt>gs</tt> 。 只要你遵从一些基本的步骤,安装一个Type 1 字型是不困难的。你应该解开在<tt>/usr/lib/teTeX/texmf/fonts/type1</tt> 中的 Type 1 字型,然後执行 <tt>texhash</tt> ,让那些目录搜寻程式知道那些字型已经被加入。然後在档案<tt>psfonts.map</tt> 中,加入字型描述,让<tt>dvips</tt>知道他们在系统中。<tt>psfonts.map</tt> 档案的格式,在上述所提到不同地方的参考位址都有。要记得执行<tt>texhash</tt> 去更新 teTeX 目录资料库。 在X 视窗系统使用teTeX --- 在 Linux中的 XFree86 --- 的确很棒,因为它允许预览 文件。虽然这并一定需要,但是容易预览文件,有助於改善输出的品质。但这会牺牲掉编辑的速度,必竟在文字模式执行速度会比较快。 <sect>Appendix A: CTAN 网址位置目录 <label id="ctan-list"> <P> 这□是一份记载 <tt>CTAN.sites,</tt> 网址位置的文件,你可在每一个 CTAN 资料库或映射位置的最上层目录中找到。 <verb> 为了要减少网路负荷,建议你使用最靠近你的 TeX 资料库网路主机 (CTAN) 。或者,你也可以找一份 (CTAN) 出版的光碟片 ( 细节请看help/CTAN.cdrom ) 。已知完整 CTAN 的映射位置,按字母顺序为: cis.utovrm.it (Italia) /TeX ctan.unsw.edu.au (NSW, Australia) /tex-archive dongpo.math.ncu.edu.tw (Taiwan) /tex-archive ftp.belnet.be (Belgium) /packages/TeX ftp.ccu.edu.tw (Taiwan) /pub/tex ftp.cdrom.com (West coast, USA) /pub/tex/ctan ftp.comp.hkbu.edu.hk (Hong Kong) /pub/TeX/CTAN ftp.cs.rmit.edu.au (Australia) /tex-archive ftp.cs.ruu.nl (The Netherlands) /pub/tex-archive ftp.cstug.cz (The Czech Republic) /pub/tex/CTAN ftp.duke.edu (North Carolina, USA) /tex-archive ftp.funet.fi (Finland) /pub/TeX/CTAN ftp.gwdg.de (Deutschland) /pub/dante ftp.jussieu.fr (France) /pub4/TeX/CTAN ftp.kreonet.re.kr (Korea) /pub/CTAN ftp.loria.fr (France) /pub/unix/tex/ctan ftp.mpi-sb.mpg.de (Deutschland) /pub/tex/mirror/ftp.dante.de ftp.nada.kth.se (Sweden) /pub/tex/ctan-mirror ftp.oleane.net (France) /pub/mirrors/CTAN/ ftp.rediris.es (Espa\~na) /mirror/tex-archive ftp.rge.com (New York, USA) /pub/tex ftp.riken.go.jp (Japan) /pub/tex-archive ftp.tu-chemnitz.de (Deutschland) /pub/tex ftp.u-aizu.ac.jp (Japan) /pub/tex/CTAN ftp.uni-augsburg.de (Deutschland) /tex-archive ftp.uni-bielefeld.de (Deutschland) /pub/tex ftp.unina.it (Italia) /pub/TeX ftp.uni-stuttgart.de (Deutschland) /tex-archive (/pub/tex) ftp.univie.ac.at (\"Osterreich) /packages/tex ftp.ut.ee (Estonia) /tex-archive ftpserver.nus.sg (Singapore) /pub/zi/TeX src.doc.ic.ac.uk (England) /packages/tex/uk-tex sunsite.auc.dk (Denmark) /pub/tex/ctan sunsite.cnlab-switch.ch (Switzerland) /mirror/tex sunsite.icm.edu.pl (Poland) /pub/CTAN sunsite.unc.edu (North Carolina, USA) /pub/packages/TeX wuarchive.wustl.edu (Missouri, USA) /packages/TeX CTAN 已知部分的映射位置,按字母顺序为: ftp.adfa.oz.au (Australia) /pub/tex/ctan ftp.fcu.edu.tw (Taiwan) /pub2/tex ftp.germany.eu.net (Deutschland) /pub/packages/TeX ftp.gust.org.pl (Poland) /pub/TeX ftp.jaist.ac.jp (Japan) /pub/TeX/tex-archive ftp.uu.net (Virginia, USA) /pub/text-processing/TeX nic.switch.ch (Switzerland) /mirror/tex sunsite.dsi.unimi.it (Italia) /pub/TeX sunsite.snu.ac.kr (Korea) /shortcut/CTAN 若有新资料请寄给 <ctan@urz.uni-heidelberg.de>. 参予 CTAN 的有: ftp.dante.de (Deutschland) -- anonymous ftp /tex-archive (/pub/tex /pub/archive) -- gopher on node gopher.dante.de -- e-mail via ftpmail@dante.de -- World Wide Web access on www.dante.de -- Administrator: <ftpmaint@dante.de> ftp.tex.ac.uk (England) -- anonymous ftp /tex-archive (/pub/tex /pub/archive) -- gopher on node gopher.tex.ac.uk -- NFS mountable from nfs.tex.ac.uk:/public/ctan/tex-archive -- World Wide Web access on www.tex.ac.uk -- Administrator: <ctan-uk@tex.ac.uk> </verb> <sect>Appendix B: 安装 CTAN 的 teTeX 套件 <label id="ctan-install"> <P> 一般而言,安装 teTeX 套件并不比安装 Linux 的程式集难,请看以下: <ref id="generic-CTAN" name="一般 CTAN 套件"> 如果你属於下面情形之一,应该考虑安装来自那些 CTAN的 teTeX 档案套件: <itemize> <item>你的系统并非标准的 Linux <item>在你的系统上你没有管理者的主权 <item>你需要最近的 teTeX 或 LaTeX 版本 <item>你没有足够的磁碟空间完整的安装 <item>你不要在 <tt>/usr</tt> 中安装 teTeX <item>你想要与网路上的其他的 UNIX 相容系统或平台分享你的 teTeX。这种情况,更应该直接由 <em>原始来源档</em> 套件自行安装。请看以下: <ref id="generic-CTAN" name="安装来源档套件 "> <item>你要使用 teTeX 最新公开 Type 1 字型的版本,它比较早的版本中所包含的字型较好。 </itemize> 可执行档的完整安装需要约 40-50 Mb 的磁碟空间,直接由来源码安装则需要大约 75 Mb,所以你应该在开始编译之前,确定有足够的磁碟空间。虽然在 X 视窗中,可以预览结果,你不需要一定要安装X 视窗系统,也不需要安装 GCC 编译程式,全部所你需要是一个能够编辑简单的 ASCII 文件的编辑程式。够简单吧 ? 你能从 <ref id="ctan-list" name="附录 A">中,任何一个 CTAN 档案库,取回这些档案, 在下面的例子中,那些档案是从 CTAN 档案库, <htmlurl url="ftp://ftp.tex.ac.uk" name="ftp.tex.ac.uk">,被取回的。 <sect1>二进位档案套件的安装 <P> <sect2>最小的安装 <label id="minimal-installation"> <P> 首先,用 FTP 连到 <htmlurl url="ftp://ftp.tex.ac.uk/ctan/tex-archive/systems/unix/teTeX/contrib" name="ftp.tex.ac.uk"> 并 <tt>cd</tt> 到下列目录:y <verb> ctan/tex-archive/systems/unix/teTeX/distrib/ </verb> 取回这些档案 <verb> INSTALL.bin install.sh </verb> 把他们放在你要安装 teTeX 的最上层的目录中,举例来说, <tt>/var/teTeX</tt> 如果你计划在 <tt>/var</tt> 中安装 teTeX 。 把 <tt>INSTALL.bin</tt> 档案印出来,并继续保存它,因为它描述该如何安装一个最小的 teTeX 系统。最小的安装只需要 10-15 MB的磁碟空间, 但是如果有可能,建议你安装完整的 teTeX 系统。对於最小的安装,你将会需要那些档案: <verb> ctan/tex-archive/systems/unix/teTeX/distrib/base/latex-base.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/base/tetex-base.tar.gz </verb> 你也将会需要上述两个档案库之一的 teTeX 的可执行档,取回这个档案: <verb> ctan/tex-archive/systems/unix/teTeX/distrib/binaries/i386-linux.tar.gz </verb> 如果你的系统使用 Linux ELF shared libraries , <tt>ld.so</tt>的版本至少要 1.73 以上, clibs 则至少要 5.09 以上,如果没有,取回: <verb> ctan/tex-archive/systems/unix/teTeX/distrib/binaries/i386-linuxaout.tar.gz </verb> 这是使用较老的 a.out 静态程式库编译成的可执行档。 然後,依 <tt>INSTALL.bin</tt>,指示,在最上层的 teTeX 安装目录中执行命令: <verb> sh ./install.sh </verb> ( 确定那些 teTeX 档案也在那里 ) ,片刻之後,安装程式会警告你,你正在失去一些 teTeX 档案,然而,你只想安装一个最小的 teTeX 系统,所以你不用理睬警告,继续 安装。至於如何设定,参考底下<ref id="base-config" name="基本系统设定">。 要安装那些其馀的程式集, 请参考下一节。 <sect2>完整安装 <label id="complete-installation"> <P> 为了要安装完整teTeX 的系统,除了取回上述那些档案,还要取回下列的档案: <verb> ctan/tex-archive/systems/unix/teTeX/distrib/doc/ams-doc.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/doc/bibtex-doc.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/doc/eplain-doc.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/doc/fonts-doc.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/doc/general-doc.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/doc/generic-doc.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/doc/latex-doc.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/doc/makeindex-doc.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/doc/metapost-doc.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/doc/programs-doc.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/fonts/ams-fonts.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/fonts/dc-fonts.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/fonts/ec-fonts.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/fonts/misc-fonts.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/fonts/postscript-fonts.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/fonts/sauter-fonts.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/goodies/amstex.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/goodies/bibtex.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/goodies/eplain.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/goodies/latex-extra.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/goodies/metapost.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/goodies/pictex.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/goodies/pstricks.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/goodies/texdraw.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/goodies/xypic.tar.gz </verb> 所有这些档案,应该被放在你要安装 teTeX 系统的最上层的目录之内,和最小的安装一样,执行命令: <verb> sh ./install.sh </verb> <sect1>基本系统设定 <label id="base-config"> <P> 决定要那一种 teTeX 之後,执行 <tt>install.sh</tt> 会出现一些选项的目录,唯一需要的设定,就是 " D " 选项,即选择要在那□安装 teTeX 系统的最上层的目录,当然在这个目录中,你必须拥有写入的权利,举例来说,你正在你的家目录里安装teTeX ,你必须指定teTeX 安装的目录为: <verb> /home/john.q.public/teTeX </verb> 然後回到主要的目录之後,再选 " I " 选项,继续安装,这目录可以不存在,<tt>install.sh</tt> 会自动产生这目录。 即使你计划只使用 Postscript 格式、 Type 1 字型或偶而使用 Computer Modern 字型,你还是可以考虑另一个选项,设定一个其它的目录,存放产生的字型,你还要有这目录的写入权利。接上面例子,你能指定: <verb> /home/john.q.public/texfonts </verb> 或者,你想让系统上的所有的使用者,都能使用这些产生的字型,就把这放字型的目录令为: <verb> /var/texfonts </verb> 我建议 <em>不要 </em> 把这目录令为<tt>/var/tmp/texfonts</tt> ,因为有可能在系统重新启动之後,这些字型会被删除掉,而在下次要使用这些字型时,又要重新制造。 在选了 " I " 选项後, <tt>install.sh</tt> 会继续安装,设定不同的允许权,连结档案目录,并编译档案,最後结束跳出,并会提醒你,把teTeX 的执行档目录,加入<tt>$PATH</tt>环境变数中,man pages 和 info 档所在目录,分别加入<tt>$MANPATH</tt>和<tt>$INFOPATH</tt> 环境变数中,例如,如果你使用<tt>bash</tt> shell ,则把下列指令加入<tt>˜/.profile</tt>中: <verb> export PATH=$PATH:"/home/john.q.public/teTeX/bin" export MANPATH=$MANPATH":/home/john.q.public/teTeX/man" export INFOPATH$=INFOPATH":/home/john.q.public/teTeX/info" </verb> 如果你使用别种 shell ,则加入 ~/.profile 中。然後签出再签入,使环境变数重新登录,再执行: <verb> texconfig confall </verb> 以确定安装是正确的。 接著,你能为特定的硬体设定 teTeX ,参考底下<ref id="post-install" name="安装完後设定的细节"> <sect1> CTAN 来源码套件的安装<label id="generic-CTAN"> <P> 要从程式码自行编译安装 teTeX V. 0.4 ,先用 <tt>ftp</tt> 到 CTAN,如 <htmlurl url="ftp://ftp.tex.ac.uk" name="ftp://ftp.tex.ac.uk"> ,抓取: <verb> ctan/tex-archive/systems/unix/teTeX/distrib/INSTALL.src ctan/tex-archive/systems/unix/teTeX/distrib/sources/README.texmf-src ctan/tex-archive/systems/unix/teTeX/distrib/sources/teTeX-lib-0.4pl8.tar.gz ctan/tex-archive/systems/unix/teTeX/distrib/sources/teTeX-src-0.4pl7.tar.gz </verb> 先看 <tt>INSTALL.src</tt>中的指示,再用 <tt>su</tt>变为系统管理者,然後在一个你有读,写,执行等权利的目录中,解开这些档案。 记得<tt>tar</tt>要用<tt>p</tt>选项,而且也要记得在<tt>bash</tt>中 unset ,<tt>noclobber</tt>选项,你可以这样下命令: <verb> set +o noclobber </verb> <tt>+o</tt> 就是 <tt>设定</tt> <em>取消</em>一个变数,就像预期会作用,但是没发生一样。 解开 <tt>teTeX-lib-0.4pl8.tar.gz</tt> 会产生<tt>./teTeX</tt>的目录,解开 <tt>teTeX-src-0.4pl7.tar.gz</tt> 会产生 <tt>teTeX-src-0.4</tt> 的目录,列印<tt>INSTALL.src</tt> ,而且保存在手边,以便为下列那些的步骤使用。再 <tt>切换</tt> 到 <tt>./teTeX-src-0.4</tt> 的目录,依 <tt>INSTALL.src</tt> 的说明,修改<tt>./Makefile</tt>。你还须要把 teTeX 所在的绝对目录,令为 <tt>TETEXDIR</tt> 的环境变数,这目录将会是你解开来源码和程式库档案所在目录的<tt>teTeX</tt>子目录。举例来说,如果你在自己的家目录解开这些档,就把<tt>TETEXDIR</tt> 令为: <verb> /home/john.q.public/teTeX </verb> 剩下<tt>Makefile</tt>的其他选项就和一般差不多,除非你使用一个非标准化的编译器和程式库的设定,或者要编译器做更多的最佳化,或其他原因,否则只要 GCC 的版本为 2.7.2或更新的就可以了。因为编译过程,<tt>dialog</tt>程式使用到 ncurses 程式库,所以还要检查<tt>USE_DIALOG</tt>,<tt>USE_NCURSES</tt>和<tt>HAVE_NCURSES</tt> 的变数,是否设定正确。在安装套件□,就以经包含了<tt>ncurses</tt> 程式库,所以 <tt>Makefile</tt> 可能会很顺利,如果你没有 <tt>ncurses</tt> ,可供连结编译,<tt>texconfig</tt> 依然能执行。 如果到这□,每件事都很正确,你就能在最上层的来源目录里,执行 <tt>make world</tt> ,等到teTeX 的执行档造出来,安装就完成了,这可能要花几个小时。 在安装完成之後,要把 teTeX 目录加入 <tt>$PATH , $MANPATH</tt>, <tt>$INFOPATH</tt>那些环境变数之中,承上例,只要在<tt>˜/.bash_profile</tt> 档案加入: <verb> export PATH=$PATH":/home/john.q.public/teTeX/bin/i386-linux" export MANPATH=$MANPATH":/home/john.q.public/teTeX/man" export INFOPATH=$INFOPATH":/home/john.q.public/teTeX/info" </verb> 用来源码安装和用以编译好的二进位码安装, <tt>$PATH</tt> 变数是不同的,前者的可执行档的路径是 <tt>teTeX/bin/i386-linux</tt> ,而後者是<tt>teTeX/bin</tt>。 到这□,你能执行 <tt>texconfig confall</tt> ,确定那些路径已经正确地被设定,然後进行如同和用安装可执行档的步骤一样,参考 <ref id="post-install" name="安装完後设定的细节">。 <sect1>安装完後设定的细节 <label id="post-install"> <P> 首先参考 Thomas Esser 的<tt>README</tt> 档案,它包含许多,如何设定teTeX 的输出装置 ( 也就是,印表机 ) 的暗示。 <tt>README</tt>档案位於目录: <verb> /usr/lib/teTeX/texmf/doc/tetex </verb> 用下列命令浏览这档案( 在此是使用 Slackware 套件 ): <verb> less /usr/lib/teTeX/texmf/doc/tetex/README </verb> 或用这命令列印出来: <verb> cat /usr/lib/teTeX/texmf/doc/tetex/README >/dev/lp0 </verb> 假定你的印表机被连接到 <tt>/dev/lp0</tt>。 如果不是,则适当的修改成连接的装置。 或者使用 <tt>lpr</tt>命令: <verb> lpr /usr/lib/teTeX/texmf/doc/tetex/README </verb> 你应该在安装 Linux 时,已经顺便安装印表机 daemon 了,如果没有,再依安装过程,重新安装一次。 印出 <tt>teTeX-FAQ.</tt> ,并放在手边,它包含许多如何设定teTeX 的印表机驱动程式的暗示,在比较新的 teTeX 版本中,则可直接由<tt>texconfig</tt>看到 <tt>teTeX-FAQ</tt> 。 然後,你要定义一个目录储存你的自己的 TeX 格式档案。teTeX 会搜寻,在系统内的<tt>/etc/profile</tt>档,被列在 <tt>$TEXINPUTS</tt> 环境变数中那些目录内的 TeX 输入档案: <verb> export TEXINPUTS=".:~/texinputs:" </verb> 个别的使用者,则把它加入他们的<tt>˜/.profile</tt> 中,或加入<tt>˜/.bash_profile</tt> ,如果使用 <tt>bash</tt> 的话。<tt>$TEXINPUTS</tt> 环境变数,告诉teTeX ,到使用者的家目录之下的<tt>˜/texinputs</tt> 目录,去寻找使用者的个别 TeX 格式档案,<em>要确实的</em> 在目录前面和後面加上冒号,也就是把搜寻到的结果,附加到你的目录。首先你必须使 teTeX 去搜寻部分的格式档案,然後它再使用你编辑过的标准格式档案的部分版本。 如果你以管理者的身份安装teTeX ,把<tt>/usr/lib/teTeX/bin</tt> 目录,加入系统的路径,若你是自己个人要安装,把 teTeX 的执行档的目录,放到<tt>˜/.profile</tt> 或<tt>˜/.bash_profile</tt>中<tt>$PATH</tt>的<em>前面</em>: <verb> export PATH="~/tetex/bin:"$PATH </verb> 现在以 <tt>root</tt>身份签入,并依<tt>teTeX-FAQ</tt>指示,执行<tt>texconfig</tt>,而且选择与你系统连接的印表机,确定你在 teTeX 中,是否正确的设定好印表机和印表机解析度。 最後执行<tt>texhash</tt> ,以确定 teTeX 的内在资料库是最新的,资料库实际上是一个<tt>ls-lR</tt>档案,每一次改变系统结构<em>必须</em> 执行 <tt>texhash</tt>,否则 teTeX 将不能够找出你改变的地方。 <sect> 附录 3: 套件和版权 <label id="copyright" <P> <sect1> 套件 <P> teTeX 为 <em>自由软体</em> ,这代表它在某些条件下,它可以自由被使用与散布。这程式集不是公众的,而是有版权的,和一些限制条件的,但是这些限制,被设计允许一个好的合作市民,将会做的每件事物。避免分享不到其他由此免费的软体,所发展出来任何更进一步的版本。确实的情况,在与许多软体一起包裹过来的GNU General Public License 中被找到,也出现在下一节中。 一个得到这程式集方法,就是跟有它的人要。你不需要我们的许可或告诉任何的人, 就可以拷贝它。如果你会使用网际网路存取,就藉由匿名的 FTP得到最近的套件版本,详细情况请看 `` 来源 '' 。 当你买一部电脑的时候,你也可能得到这软体。电脑制造业者,跟任何人适用的情况一样,也可以免费取得这软体。这些专有术语,保证他们要给你那些完整的来源,包括他们可能已经做的任何改变, General Public License 也允许你重新散布这些从他们得来的套件。换句话说,这些不但对你是免费的,同时对制造业者也是。 你在可以向免费软体基金会,订购这个 GNU 软体的光碟,这是一个取得软体既方便又可靠的方法,它也可以帮助我们的基金会。 ( 基金会由此得到大多数的赞助基金 ) 订购单会附在大多数的套件□,或由我们网站 http://www.gnu.ai.mit.edu/order/order.html. 找到。对於进一步的消息,请写到 <verb> Free Software Foundation 59 Temple Place, Suite 330 Boston, MA 02111-1307 USA USA </verb> 来自套件的收入,都用来支助基金会的目标:新的免费软体的发展和改进已存在的软体。 如果你在你的工作地点使用 GNU 软体,请提议公司赞助。如果公司政策对此类赞助,是不表赞同的,你可提议偶而向基金会订购光碟,或定期的更新使用的软体。 <sect1>GNU GENERAL PUBLIC LICENSE <P> Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. <bf>Preamble.</bf> The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software---to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. <bf>TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</bf> <itemize> <item> This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The ``Program'' below, refers to any such program or work, and a ``work based on the Program'' means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term,``modification.'') Each licensee is addressed as ``you.'' Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. <item> You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. <item> You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: 1. You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. 2. You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. 3. If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. <item> You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: 1. Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, 2. Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, 3. Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. <item> You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. <item> You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. <item> Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. <item> If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. <item> If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. <item> The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and ``any later version,'' you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. <item> If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. <bf>NO WARRANTY</bf> <item> BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. <item> IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. </itemize> <bf>END OF TERMS AND CONDITIONS</bf> <sect1>How to Apply These Terms to Your New Programs <P> If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the ``copyright'' line and a pointer to where the full notice is found. <verb> [one line to give the program's name and an idea of what it does. Copyright (C) 19[yy] [name of author] This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. </verb> Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: <verb> Gnomovision version 69, Copyright (C) 19[yy] [name of author] Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. </verb> The hypothetical commands ``<tt>show w</tt>'' and ``<tt>show c</tt>'' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than ``<tt>show w</tt>'' and ``<tt>show c</tt>''; they could even be mouse-clicks or menu items---whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a ``copyright disclaimer'' for the program, if necessary. Here is a sample; alter the names: <verb> Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. [signature of Ty Coon] 1 April 1989 Ty Coon, President of Vice </verb> This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. </article>