“UbuntuHelp:LaTeX/zh”的版本间的差异
来自Ubuntu中文
(New page: {{Translation}} {{From|https://help.ubuntu.com/community/LaTeX}} {{Translator|zhan}} {{Languages|UbuntuHelp:LaTeX}} Latex is a language for describing a document. If you have used HTML, ...) |
|||
第7行: | 第7行: | ||
Latex is a language for describing a document. If you have used HTML, or edited a wiki then you will be familiar with the idea of using symbols or commands within a text file to describe the layout of text. Latex is commonly used in scientific publishing. It helps you to make well formated papers, with good looking formulae. It also helps keep track of figure and equation numbers. Latex files can be converted into a huge number of formats such as PDF, PostScript, DVI, and HTML. | Latex is a language for describing a document. If you have used HTML, or edited a wiki then you will be familiar with the idea of using symbols or commands within a text file to describe the layout of text. Latex is commonly used in scientific publishing. It helps you to make well formated papers, with good looking formulae. It also helps keep track of figure and equation numbers. Latex files can be converted into a huge number of formats such as PDF, PostScript, DVI, and HTML. | ||
− | + | LaTeX 是一种文档描述语言。如果你曾使用过 HTML, 或曾经编辑过 wiki 那么你对文本中使用符号或命令来描述文档结构的方法很熟悉。 LaTeX 普遍使用在科学出版界。它帮助你制作非常漂亮的论文,还有非常好看的数学公式。它也能帮助你跟踪记录图片和公式的编号。LaTeX 源文件能够被转换成非常多的格式比如 PDF, PostScript, DVI, 和 HTML。 | |
A Latex file is an ASCII file containing the text and markup commands. It can be written in a text editor such as Gedit or vim. It is converted into an output format using a Latex compiler. Some people like to write Latex files in a more integrated environment, with menus and buttons for formatting commands. There are also many add on packages that add features to Latex. | A Latex file is an ASCII file containing the text and markup commands. It can be written in a text editor such as Gedit or vim. It is converted into an output format using a Latex compiler. Some people like to write Latex files in a more integrated environment, with menus and buttons for formatting commands. There are also many add on packages that add features to Latex. | ||
第16行: | 第16行: | ||
= 安装 = | = 安装 = | ||
Like Linux, Latex is a collection of many tools and files. Rather than find and install them all you use a Latex distribution. Latex distributions in the Ubuntu repositories are | Like Linux, Latex is a collection of many tools and files. Rather than find and install them all you use a Latex distribution. Latex distributions in the Ubuntu repositories are | ||
− | 就像 Linux, LaTeX 也包含了非常多的相互依赖的工具和文件。一般来说,您会使用一个 LaTeX 的发行版,而不是寻找和安装所有的这些文件,在 Ubuntu | + | |
+ | 就像 Linux, LaTeX 也包含了非常多的相互依赖的工具和文件。一般来说,您会使用一个 LaTeX 的发行版,而不是寻找和安装所有的这些文件,在 Ubuntu 的软件仓库中的发行版是: | ||
* Tetex | * Tetex | ||
第22行: | 第23行: | ||
Tetex is a common Latex distribution for Linux. This is in the main Ubuntu repository and can be installed with synaptic or apt-get. At a minimum you will need to install the packages | Tetex is a common Latex distribution for Linux. This is in the main Ubuntu repository and can be installed with synaptic or apt-get. At a minimum you will need to install the packages | ||
+ | |||
+ | Tetex 是一个常用的适用于 Linux 的 LaTeX 的发行版。它在 Ubuntu 的 main 软件仓库中,可以使用新利得(synaptic)或 apt-get 来安装。同时您需要安装的软件包是: | ||
+ | |||
<pre><nowiki> | <pre><nowiki> | ||
tetex-base tetex-bin | tetex-base tetex-bin | ||
</nowiki></pre> | </nowiki></pre> | ||
you may also want some add on packages | you may also want some add on packages | ||
+ | 您可能也需要一些插件包: | ||
<pre><nowiki> | <pre><nowiki> | ||
tetex-extra | tetex-extra | ||
第31行: | 第36行: | ||
Another Latex distribution you can install is texlive. Texlive has a more comprehensive selection of Latex tools than tetex but takes up more space. It is also a newer addition to Ubuntu so you may run into some teething problems. It is available for Ubuntu from version 6.10 and is in the universe repository. | Another Latex distribution you can install is texlive. Texlive has a more comprehensive selection of Latex tools than tetex but takes up more space. It is also a newer addition to Ubuntu so you may run into some teething problems. It is available for Ubuntu from version 6.10 and is in the universe repository. | ||
+ | |||
+ | 另一个您可以安装的 LaTeX 的发行版是 texlive。Texlive 是一个比 tetex 更加丰富的LaTeX 套件的选择,同时也需要更大的空间。同时它也是 Ubuntu 新加入的特性,所以您可能的遇到一些问题。从 6.10 开始它就可以使用在 Ubuntu 上并处于 universe 的软件仓库中。 | ||
To install texlive install the package | To install texlive install the package | ||
+ | 安装 texlive 您需要安装软件包 | ||
<pre><nowiki> | <pre><nowiki> | ||
texlive | texlive | ||
</nowiki></pre> | </nowiki></pre> | ||
− | + | = Add on packages = | |
− | + | = 附加软件包 = | |
Latex can be extended using add on packages. | Latex can be extended using add on packages. | ||
+ | 可以使用附加软件包来扩展 LaTeX 的功能。 | ||
− | + | == Repositories == | |
− | + | ==软件仓库== | |
In addition to <code><nowiki>tetex-extra</nowiki></code> there are numerous packages in the repositories containing add-ons. To see what packages are available you can browse | In addition to <code><nowiki>tetex-extra</nowiki></code> there are numerous packages in the repositories containing add-ons. To see what packages are available you can browse | ||
− | |||
− | + | 除了 <code><nowiki>tetex-extra</nowiki></code> 之外仓库中还有很多软件包包含有 LaTeX 的附加软件。您可以查看以下页面来看看究竟有哪些软件 | |
+ | |||
+ | [http://packages.ubuntu.com/breezy/tex/ breezy 的软件包,tex 章节]. | ||
+ | [http://packages.ubuntu.com/dapper/tex/ dapper 的软件包,tex 章节]. | ||
+ | [http://packages.ubuntu.com/edgy/tex/ edgy 的软件包,tex 章节]. | ||
+ | [http://packages.ubuntu.com/feisty/tex/ feisty 的软件包,tex 章节]. | ||
+ | |||
+ | == Other add-ons == | ||
+ | == 其他的附加软件 == | ||
There are also lots of add-ons which are not in the repositories. | There are also lots of add-ons which are not in the repositories. | ||
− | A comprehensive list is availiable at the [http://www.tug.org/tex-archive/help/Catalogue/index.html TeX Catalogue Online] or the [http://www.ctan.org/ Comprehensive TeX Archive Network]. They are usually downloaded as tar.gz or zip files. To install them they need to be uncompressed and copied to /usr/local/share/texmf/tex/latex/. Then you need to run texhash, to update the database. | + | |
+ | 还有非常多不在软件仓库中的附加软件。 | ||
+ | |||
+ | A comprehensive list is availiable at the | ||
+ | |||
+ | 下面有一个非常丰富的列表。 | ||
+ | [http://www.tug.org/tex-archive/help/Catalogue/index.html TeX Catalogue Online] or the [http://www.ctan.org/ Comprehensive TeX Archive Network]. They are usually downloaded as tar.gz or zip files. To install them they need to be uncompressed and copied to /usr/local/share/texmf/tex/latex/. Then you need to run texhash, to update the database. | ||
+ | |||
+ | [http://www.tug.org/tex-archive/help/Catalogue/index.html 在线 TeX 目录 ] 或者 [http://www.ctan.org/ 全面的 TeX 软件包网络]. | ||
+ | 通常下载回来的软件包是 tar.gz 或者 zip 格式的。安装它们您需要把它们解压并拷贝到 /usr/local/share/texmf/tex/latex 中,然后您需要运行 texhash 命令来更新数据库。 | ||
If you downloaded the package mhchem.zip to your home directory, then this should work: | If you downloaded the package mhchem.zip to your home directory, then this should work: | ||
+ | |||
+ | 如果您下载了一个软件包 mhchem.zip 到您的家目录,那么执行下面的步骤应该能够起作用: | ||
<pre><nowiki> | <pre><nowiki> | ||
cd /usr/local/share/texmf/tex/latex | cd /usr/local/share/texmf/tex/latex | ||
第57行: | 第84行: | ||
sudo texhash | sudo texhash | ||
</nowiki></pre> | </nowiki></pre> | ||
− | + | ||
+ | == Local Installation == | ||
+ | == 本地安装 == | ||
You can also install style or class files in your home directory. This is especially useful if you don't have access to root privileges. The variable <code><nowiki> TEXINPUTS </nowiki></code> controls where latex looks for local files. | You can also install style or class files in your home directory. This is especially useful if you don't have access to root privileges. The variable <code><nowiki> TEXINPUTS </nowiki></code> controls where latex looks for local files. | ||
+ | |||
+ | 您也可以吧类型或类文件安装在您的家目录中。如果您没有 root 权限的话,这样做显得尤其有用。<code><nowiki> TEXINPUTS </nowiki></code> 控制 LaTeX 在什么地方寻找本地的文件。 | ||
Suppose you want to put them in a subdirectory of your home directory called <code><nowiki>mylatex</nowiki></code>. Just set <code><nowiki> TEXINPUTS </nowiki></code> as follows: | Suppose you want to put them in a subdirectory of your home directory called <code><nowiki>mylatex</nowiki></code>. Just set <code><nowiki> TEXINPUTS </nowiki></code> as follows: | ||
+ | |||
+ | 假定您想把它们放在你的家目录的一个叫做 <code><nowiki>mylatex</nowiki></code> 的子目录下面,只要按照如下设置 <code><nowiki> TEXINPUTS </nowiki></code> : | ||
<pre><nowiki> | <pre><nowiki> | ||
export TEXINPUTS= ~/mylatex/: | export TEXINPUTS= ~/mylatex/: | ||
第67行: | 第100行: | ||
Now you can put files in <code><nowiki> ~/mylatex </nowiki></code> and latex will know where to find them. | Now you can put files in <code><nowiki> ~/mylatex </nowiki></code> and latex will know where to find them. | ||
+ | |||
+ | 现在您可以把文件解压到 <code><nowiki> ~/mylatex </nowiki></code>, LaTeX 能够知道到什么地方去寻找它们。 | ||
To set this as the default value of <code><nowiki>TEXINPUTS</nowiki></code> add the line above to <code><nowiki>.bashrc</nowiki></code> or type | To set this as the default value of <code><nowiki>TEXINPUTS</nowiki></code> add the line above to <code><nowiki>.bashrc</nowiki></code> or type | ||
+ | |||
+ | 把这个设置成 <code><nowiki>TEXINPUTS</nowiki></code> 的默认值需要将上面的一样加入到 <code><nowiki>.bashrc</nowiki></code> 或者在终端中输入: | ||
+ | |||
<pre><nowiki> | <pre><nowiki> | ||
cd | cd | ||
第74行: | 第112行: | ||
</nowiki></pre> | </nowiki></pre> | ||
− | + | == Useful addons include: == | |
− | + | == 有用的附加软件 == | |
− | * [http://www.tug.org/tex-archive/help/Catalogue/entries/mhchem.html mhchem] | + | * [http://www.tug.org/tex-archive/help/Catalogue/entries/mhchem.html mhchem] , chemical reactions etc. |
+ | 化学符号,化学反应式等。 | ||
* [http://www.tug.org/tex-archive/help/Catalogue/entries/isotope.html isotope] | * [http://www.tug.org/tex-archive/help/Catalogue/entries/isotope.html isotope] | ||
− | === | + | = Resources = |
+ | = 资源 = | ||
+ | * [http://www.tug.org/interest.html TeX Users Group TeX 用户组] Lots of links 大量的链接 | ||
+ | * [http://www.latex-project.org/guides/ Latex Documentation Latex 文档] | ||
+ | * [http://tug.org/TeXnik/mainFAQ.cgi?file=index A-Z TeX FAQs 列表] | ||
− | + | = Inverse Search = | |
− | + | = 反向搜索 = | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
Inverse search means that | Inverse search means that | ||
− | + | 反向搜索的意思是 | |
+ | |||
+ | * A mouse click in the dvi-viewer window can open an editor with the corresponding place in the (La)TeX source (also called `reverse search') | ||
* Ctrl-Left Click is the default for xdvi | * Ctrl-Left Click is the default for xdvi | ||
* Middle Click is the default for kdvi | * Middle Click is the default for kdvi | ||
− | + | * the dvi-viewer can jump to (and visually highlight) a position in the DVI file that corresponds to a certain line number in the (La)TeX source file (`forward search'). | |
− | **** | + | * 在 dvi-viewer 中点击鼠标可以打开编辑器并且打开到相应的 (La)TeX 源码处(同时也叫做'逆向搜索') |
− | + | * Ctrl+鼠标左键是 xdvi 的默认按键 | |
+ | * 中键是 kdvi 的默认按键 | ||
+ | * dvi-viewer 能够根据相关的 (La)TeX 源码的特定的行跳转到(而且会高亮显示) DVI 文件的相应位置(正向搜索)。 | ||
− | ==== | + | * for information see [http://xdvi.sourceforge.net/inverse-search.html] |
− | + | * 更多资料请看 [http://xdvi.sourceforge.net/inverse-search.html] | |
− | ===== Instructions to set up reverse search with emacs and xdvi ===== | + | == Emacs and xdvi == |
− | + | == Emacs 和 xdvi == | |
− | ** Add the following line to the file <code><nowiki>.emacs</nowiki></code> in your home directory <pre><nowiki> | + | == Reverse search == |
+ | == 逆向搜索 == | ||
+ | === Instructions to set up reverse search with emacs and xdvi === | ||
+ | === 设置 emacs 和 xdvi 的逆向搜索 === | ||
+ | ** Add the following line to the file <code><nowiki>.emacs</nowiki></code> in your home directory | ||
+ | ** 将下面的行加入到您的家目录中的 <code><nowiki>.emacs</nowiki></code> 文件中。 | ||
+ | <pre><nowiki> | ||
(server-start) | (server-start) | ||
− | </nowiki></pre | + | </nowiki></pre |
− | ** Add the following line to <code><nowiki>.Xresources</nowiki></code> <pre><nowiki> | + | ** Add the following line to <code><nowiki>.Xresources</nowiki></code> |
+ | ** 将下面的一行加入到您的家目录下面的 <code><nowiki>.Xresources</nowiki></code> 文件中。 | ||
+ | <pre><nowiki> | ||
xdvi.editor: emacsclient --no-wait +%l %f | xdvi.editor: emacsclient --no-wait +%l %f | ||
</nowiki></pre> | </nowiki></pre> | ||
− | ** and run <pre><nowiki> | + | ** and run |
+ | ** 运行 | ||
+ | <pre><nowiki> | ||
xrdb .Xresources | xrdb .Xresources | ||
</nowiki></pre> | </nowiki></pre> | ||
− | ** Download and install the latex package [http://www.ctan.org/tex-archive/help/Catalogue/entries/srcltx.html srcltx] | + | ** Download and install the latex package |
+ | ** 下载并且安装下面的 latex 软件包 | ||
+ | [http://www.ctan.org/tex-archive/help/Catalogue/entries/srcltx.html srcltx] | ||
− | ** You need to compile your latex file with the srcltx package. Put the line <pre><nowiki> | + | ** You need to compile your latex file with the srcltx package. Put the line |
+ | ** 您需要使用 srcltx 软件包来编译您的 latex 文件。将下面的一行 | ||
+ | |||
+ | <pre><nowiki> | ||
\usepackage[active]{srcltx} | \usepackage[active]{srcltx} | ||
− | </nowiki></pre>in your latex files for this to work | + | </nowiki></pre> |
+ | in your latex files for this to work | ||
− | + | 放在您的 latex 文件中以使用 srcltx 的功能。 | |
− | ** You need to compile your latex file with the srcltx package. Put the line <pre><nowiki> | + | == Kile and kdvi == |
+ | == Kile 和 kdvi == | ||
+ | |||
+ | ** You need to compile your latex file with the srcltx package. Put the line | ||
+ | ** 您需要使用 srcltx 软件包来编译 latex 文件。将下面一行 | ||
+ | <pre><nowiki> | ||
\usepackage[active]{srcltx} | \usepackage[active]{srcltx} | ||
− | </nowiki></pre>in your latex files and forward and reverse search should work. | + | </nowiki></pre> |
+ | in your latex files and forward and reverse search should work. | ||
+ | 写入到您的 latex 文件中,反向查询应该就可以正常工作了。 | ||
2007年5月20日 (日) 14:24的版本
![]() |
点击翻译: |
English • 中文 |
Latex is a language for describing a document. If you have used HTML, or edited a wiki then you will be familiar with the idea of using symbols or commands within a text file to describe the layout of text. Latex is commonly used in scientific publishing. It helps you to make well formated papers, with good looking formulae. It also helps keep track of figure and equation numbers. Latex files can be converted into a huge number of formats such as PDF, PostScript, DVI, and HTML.
LaTeX 是一种文档描述语言。如果你曾使用过 HTML, 或曾经编辑过 wiki 那么你对文本中使用符号或命令来描述文档结构的方法很熟悉。 LaTeX 普遍使用在科学出版界。它帮助你制作非常漂亮的论文,还有非常好看的数学公式。它也能帮助你跟踪记录图片和公式的编号。LaTeX 源文件能够被转换成非常多的格式比如 PDF, PostScript, DVI, 和 HTML。
A Latex file is an ASCII file containing the text and markup commands. It can be written in a text editor such as Gedit or vim. It is converted into an output format using a Latex compiler. Some people like to write Latex files in a more integrated environment, with menus and buttons for formatting commands. There are also many add on packages that add features to Latex.
一个 LaTeX 源文件是一个包含文本和标记命令的 ASCII 文件。它能够在文本编辑器如 Gedit 和 Vim 中编辑。他被 LaTeX 编译器转换成特定的输出格式。有人喜欢在一个更加集成的环境中书写 LaTeX 文件,使用菜单和按钮来生成格式控制命令。也有非常多的插件包为 LaTeX 增加新的功能。
Installing
安装
Like Linux, Latex is a collection of many tools and files. Rather than find and install them all you use a Latex distribution. Latex distributions in the Ubuntu repositories are
就像 Linux, LaTeX 也包含了非常多的相互依赖的工具和文件。一般来说,您会使用一个 LaTeX 的发行版,而不是寻找和安装所有的这些文件,在 Ubuntu 的软件仓库中的发行版是:
- Tetex
- Texlive
Tetex is a common Latex distribution for Linux. This is in the main Ubuntu repository and can be installed with synaptic or apt-get. At a minimum you will need to install the packages
Tetex 是一个常用的适用于 Linux 的 LaTeX 的发行版。它在 Ubuntu 的 main 软件仓库中,可以使用新利得(synaptic)或 apt-get 来安装。同时您需要安装的软件包是:
tetex-base tetex-bin
you may also want some add on packages 您可能也需要一些插件包:
tetex-extra
Another Latex distribution you can install is texlive. Texlive has a more comprehensive selection of Latex tools than tetex but takes up more space. It is also a newer addition to Ubuntu so you may run into some teething problems. It is available for Ubuntu from version 6.10 and is in the universe repository.
另一个您可以安装的 LaTeX 的发行版是 texlive。Texlive 是一个比 tetex 更加丰富的LaTeX 套件的选择,同时也需要更大的空间。同时它也是 Ubuntu 新加入的特性,所以您可能的遇到一些问题。从 6.10 开始它就可以使用在 Ubuntu 上并处于 universe 的软件仓库中。
To install texlive install the package 安装 texlive 您需要安装软件包
texlive
Add on packages
附加软件包
Latex can be extended using add on packages. 可以使用附加软件包来扩展 LaTeX 的功能。
Repositories
软件仓库
In addition to tetex-extra
there are numerous packages in the repositories containing add-ons. To see what packages are available you can browse
除了 tetex-extra
之外仓库中还有很多软件包包含有 LaTeX 的附加软件。您可以查看以下页面来看看究竟有哪些软件
breezy 的软件包,tex 章节. dapper 的软件包,tex 章节. edgy 的软件包,tex 章节. feisty 的软件包,tex 章节.
Other add-ons
其他的附加软件
There are also lots of add-ons which are not in the repositories.
还有非常多不在软件仓库中的附加软件。
A comprehensive list is availiable at the
下面有一个非常丰富的列表。 TeX Catalogue Online or the Comprehensive TeX Archive Network. They are usually downloaded as tar.gz or zip files. To install them they need to be uncompressed and copied to /usr/local/share/texmf/tex/latex/. Then you need to run texhash, to update the database.
在线 TeX 目录 或者 全面的 TeX 软件包网络. 通常下载回来的软件包是 tar.gz 或者 zip 格式的。安装它们您需要把它们解压并拷贝到 /usr/local/share/texmf/tex/latex 中,然后您需要运行 texhash 命令来更新数据库。
If you downloaded the package mhchem.zip to your home directory, then this should work:
如果您下载了一个软件包 mhchem.zip 到您的家目录,那么执行下面的步骤应该能够起作用:
cd /usr/local/share/texmf/tex/latex sudo unzip ~/mhchem.zip sudo texhash
Local Installation
本地安装
You can also install style or class files in your home directory. This is especially useful if you don't have access to root privileges. The variable TEXINPUTS
controls where latex looks for local files.
您也可以吧类型或类文件安装在您的家目录中。如果您没有 root 权限的话,这样做显得尤其有用。 TEXINPUTS
控制 LaTeX 在什么地方寻找本地的文件。
Suppose you want to put them in a subdirectory of your home directory called mylatex
. Just set TEXINPUTS
as follows:
假定您想把它们放在你的家目录的一个叫做 mylatex
的子目录下面,只要按照如下设置 TEXINPUTS
:
export TEXINPUTS= ~/mylatex/:
Now you can put files in ~/mylatex
and latex will know where to find them.
现在您可以把文件解压到 ~/mylatex
, LaTeX 能够知道到什么地方去寻找它们。
To set this as the default value of TEXINPUTS
add the line above to .bashrc
or type
把这个设置成 TEXINPUTS
的默认值需要将上面的一样加入到 .bashrc
或者在终端中输入:
cd echo "export TEXINPUTS= ~/mylatex:" >> .bashrc
Useful addons include:
有用的附加软件
- mhchem , chemical reactions etc.
化学符号,化学反应式等。
Resources
资源
- TeX Users Group TeX 用户组 Lots of links 大量的链接
- Latex Documentation Latex 文档
- A-Z TeX FAQs 列表
Inverse Search
反向搜索
Inverse search means that
反向搜索的意思是
- A mouse click in the dvi-viewer window can open an editor with the corresponding place in the (La)TeX source (also called `reverse search')
* Ctrl-Left Click is the default for xdvi * Middle Click is the default for kdvi
- the dvi-viewer can jump to (and visually highlight) a position in the DVI file that corresponds to a certain line number in the (La)TeX source file (`forward search').
- 在 dvi-viewer 中点击鼠标可以打开编辑器并且打开到相应的 (La)TeX 源码处(同时也叫做'逆向搜索')
* Ctrl+鼠标左键是 xdvi 的默认按键 * 中键是 kdvi 的默认按键
- dvi-viewer 能够根据相关的 (La)TeX 源码的特定的行跳转到(而且会高亮显示) DVI 文件的相应位置(正向搜索)。
Emacs and xdvi
Emacs 和 xdvi
Reverse search
逆向搜索
Instructions to set up reverse search with emacs and xdvi
设置 emacs 和 xdvi 的逆向搜索
- Add the following line to the file
.emacs
in your home directory - 将下面的行加入到您的家目录中的
.emacs
文件中。
- Add the following line to the file
(server-start) </pre ** Add the following line to <code>.Xresources</code> ** 将下面的一行加入到您的家目录下面的 <code>.Xresources</code> 文件中。 <pre> xdvi.editor: emacsclient --no-wait +%l %f
- and run
- 运行
xrdb .Xresources
- Download and install the latex package
- 下载并且安装下面的 latex 软件包
- You need to compile your latex file with the srcltx package. Put the line
- 您需要使用 srcltx 软件包来编译您的 latex 文件。将下面的一行
\usepackage[active]{srcltx}
in your latex files for this to work
放在您的 latex 文件中以使用 srcltx 的功能。
Kile and kdvi
Kile 和 kdvi
- You need to compile your latex file with the srcltx package. Put the line
- 您需要使用 srcltx 软件包来编译 latex 文件。将下面一行
\usepackage[active]{srcltx}
in your latex files and forward and reverse search should work. 写入到您的 latex 文件中,反向查询应该就可以正常工作了。