linux - 在 Linux 上开始使用 Latex

对 is-latex-worth-learning-today 印象深刻,以及许多关于 Windows 的操作方法,

你是如何在 Linux 上开始使用 LaTeX 的?

你如何从中生成一个 pdf 并放弃 OOO 字处理器?

更新:

感谢这里给出的所有建议。我能够使用 Beamer 类创建一个很棒的 ppt:http://github.com/becomingGuru/gids-django-ppt .我发现这种方法比使用 powerpoint 之类的方法要好得多。

有兴趣的可以查看TEX file ,带有许多自定义命令和 corresponding presentation .

最佳答案

首先您需要安装它:

  • 如果您使用的是包含 LaTeX 的发行版(几乎所有发行版都可以),请查找 texlivetetex。 TeX Live 是两者中较新的版本,现在正在大多数发行版上取代 tetex。

如果您使用的是 Debian 或 Ubuntu,例如:

<code>apt-get install texlive</code>

..将安装它。

RedHat 或 CentOS 需要:

<code>yum install tetex</code>

注意:这需要root权限,所以要么使用su将用户切换到 root,或在命令前加上 sudo ,如果您尚未以 root 用户身份登录。

接下来,您需要获得一个文本编辑器。任何编辑器都会做,所以无论你喜欢什么。您会发现 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 &lt;2003/12/01&gt;
Babel &lt;v3.8d&gt; 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页面并浏览那里的项目,因为您需要要编写的文档的功能。

future 需要考虑的事情包括:

  • 使用 xfigdia 等工具创建图表。这些可以很容易地以各种格式插入到您的文档中。请注意,如果您正在创建 PDF,那么您不应该对图像使用 EPS(封装后记) - 如果可能,请使用从图表编辑器导出的 pdf,或者您可以使用 epstopdf \includegraphics 中包含的图形自动从 (e)ps 转换为 pdf 的软件包.

  • 开始对您的文档使用版本控制。起初这似乎有些过分,但是当您编写大型内容时能够返回并查看早期版本可能非常有用。

  • 使用 ma​​ke 为您运行 latex 。当您开始使用 latex 的引用书目、图像和其他更复杂的用途时,您会发现您需要在多个文件或多次运行它(第一次更新引用文献,第二次将引用文献放入文档中,因此它们除非您运行 latex 两次,否则可能会过时...)。将其抽象为 makefile 可以节省大量时间和精力。

  • 使用更好的编辑器。像 Emacs + AUCTeX 这样的东西非常称职。这当然是一个非常主观的主题,所以我将把它留在那个地方(那个 Emacs 显然是最好的选择 :)

https://stackoverflow.com/questions/1017055/

相关文章:

linux - Bash 脚本并行处理有限数量的命令

python - 如何在 Flask-SQLAlchemy 应用程序中执行原始 SQL

linux - 如何获取进程 ID 以杀死 nohup 进程?

python - 找出 Python 中的对象正在使用多少内存

python - 如何使用python解析包含毫秒的时间字符串?

python - 在python中将 float 转换为整数的最安全方法?

linux - bash 中是否有 "goto"语句?

linux - 如何规范化 Bash 中的文件路径?

linux - 如何使用 Bash 脚本自动添加用户帐户和密码?

python - 如何从文件中读取特定行(按行号)?