首先您需要安装它:
- 如果您使用的是包含 LaTeX 的发行版(几乎所有都可以),那么请寻找 texlive 或 tetex。 TeX Live 是两者中较新的版本,现在正在大多数发行版上取代 tetex。
如果您使用的是 Debian 或 Ubuntu,例如:
<code>apt-get install texlive</code>
..将安装它。
RedHat 或 CentOS 需要:
<code>yum install tetex</code>
注意:这需要 root 权限,所以要么使用 su 将用户切换到 root,或者如果您尚未以 root 用户身份登录,则在命令前加上 sudo。
接下来,您需要获得一个文本编辑器。任何编辑器都会做,所以无论你喜欢什么。您会发现 Emacs(和 vim)等高级编辑器添加了很多功能,因此有助于在您尝试构建文档输出之前确保语法正确。
创建一个名为 test.tex 的文件并在其中放入一些内容,例如 the LaTeX primer 中的示例:
\documentclass[a4paper,12pt]{article}
\begin{document}
The foundations of the rigorous study of \emph{analysis}
were laid in the nineteenth century, notably by the
mathematicians Cauchy and Weierstrass. Central to the
study of this subject are the formal definitions of
\emph{limits} and \emph{continuity}.
Let $D$ be a subset of $\bf R$ and let
$f \colon D \to \mathbf{R}$ be a real-valued function on
$D$. The function $f$ is said to be \emph{continuous} on
$D$ if, for all $\epsilon > 0$ and for all $x \in D$,
there exists some $\delta > 0$ (which may depend on $x$)
such that if $y \in D$ satisfies
\[ |y - x| < \delta \]
then
\[ |f(y) - f(x)| < \epsilon. \]
One may readily verify that if $f$ and $g$ are continuous
functions on $D$ then the functions $f+g$, $f-g$ and
$f.g$ are continuous. If in addition $g$ is everywhere
non-zero then $f/g$ is continuous.
\end{document}
获得此文件后,您需要在其上运行 latex 以产生一些输出(作为 .dvi 文件开始,可以转换为许多其他格式) :
latex test.tex
这将打印一堆输出,如下所示:
=> latex test.tex
This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
entering extended mode
(./test.tex
LaTeX2e <2003/12/01>
Babel <v3.8d> and hyphenation patterns for american, french, german, ngerman, b
ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch, esperanto, e
stonian, finnish, greek, icelandic, irish, italian, latin, magyar, norsk, polis
h, portuges, romanian, russian, serbian, slovak, slovene, spanish, swedish, tur
kish, ukrainian, nohyphenation, loaded.
(/usr/share/texmf/tex/latex/base/article.cls
Document Class: article 2004/02/16 v1.4f Standard LaTeX document class
(/usr/share/texmf/tex/latex/base/size12.clo))
No file test.aux.
[1] (./test.aux) )
Output written on test.dvi (1 page, 1508 bytes).
Transcript written on test.log.
..不要担心这个输出的大部分——重要的部分是 Output write on test.dvi 行,它表示它是成功的。
现在您需要使用 xdvi 查看输出文件:
xdvi test.dvi &
这将弹出一个窗口,其中包含格式精美的输出。点击 `q' 退出这个,或者你可以让它保持打开状态,当 test.dvi 文件被修改时它会自动更新(所以每当你运行 latex 来更新输出时)。
要生成此文件的 PDF,您只需运行 pdflatex 而不是 latex:
pdflatex test.tex
..您将创建一个 test.pdf 文件而不是 test.dvi 文件。
一切正常后,我建议您转到the LaTeX primer 页面并浏览那里的项目,因为您需要您想要编写的文档的功能。
未来需要考虑的事情包括:
-
使用 xfig 或 dia 等工具创建图表。这些可以很容易地以各种格式插入到您的文档中。请注意,如果您正在创建 PDF,那么您不应该对图像使用 EPS(封装后记) - 如果可能,请使用从图表编辑器导出的 pdf,或者您可以使用 epstopdf 包自动将 \includegraphics 中包含的数字从 (e)ps 转换为 pdf。
-
开始对您的文档使用版本控制。起初这似乎有些过分,但是当您编写大型内容时能够返回并查看早期版本可能非常有用。
-
使用 make 为您运行乳胶。当您开始使用乳胶的参考书目、图像和其他更复杂的用途时,您会发现您需要在多个文件或多次运行它(第一次更新引用,第二次将引用放入文档中,所以他们除非您运行乳胶两次,否则可能会过时...)。将其抽象为 makefile 可以节省大量时间和精力。
-
使用更好的编辑器。像 Emacs + AUCTeX 这样的东西非常称职。这当然是一个非常主观的主题,所以我将把它留在那里(那个 Emacs 显然是最好的选择:)