\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}
If you're using a distro which packages LaTeX (almost all will do) then look for texlive or tetex. TeX Live is the newer of the two, and is replacing tetex on most distributions now.
If you're using Debian or Ubuntu, something like:
apt install texlive
..will get it installed.
RedHat or CentOS need:
yum install tetex
Note : This needs root permissions, so either use su to switch user to root, or prefix the commands with sudo, if you aren't already logged in as the root user.
Next you'll need to get a text editor. Any editor will do, so whatever you are comfortable with. You'll find that advanced editors like Emacs (and vim) add a lot of functionality and so will help with ensuring that your syntax is correct before you try and build your document output.
Create a file called test.tex and put some content in it, say the example from 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}
Once you've got this file you'll need to run latex on it to produce some output (as a .dvi file to start with, which is possible to convert to many other formats):
latex test.tex
This will print a bunch of output, something like this:
=> 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.
..don't worry about most of this output -- the important part is the Output written on test.dvi line, which says that it was successful.
Now you need to view the output file with xdvi:
xdvi test.dvi &
This will pop up a window with the beautifully formatted output in it. Hit `q' to quit this, or you can leave it open and it will automatically update when the test.dvi file is modified (so whenever you run latex to update the output).
To produce a PDF of this you simply run pdflatex instead of latex:
pdflatex test.tex
..and you'll have a test.pdf file created instead of the test.dvi file.
After this is all working fine, I would suggest going to the LaTeX primer page and running through the items on there as you need features for documents you want to write.
Future things to consider include:
Use tools such as xfig or dia to create diagrams. These can be easily inserted into your documents in a variety of formats. Note that if you are creating PDFs then you shouldn't use EPS (encapsulated postscript) for images -- use pdf exported from your diagram editor if possible, or you can use the epstopdf package to automatically convert from (e)ps to pdf for figures included with \includegraphics.
Start using version control on your documents. This seems excessive at first, but being able to go back and look at earlier versions when you are writing something large can be extremely useful.
Use make to run latex for you. When you start on having bibliographies, images and other more complex uses of latex you'll find that you need to run it over multiple files or multiple times (the first time updates the references, and the second puts references into the document, so they can be out-of-date unless you run latex twice...). Abstracting this into a makefile can save a lot of time and effort.
Use a better editor. Something like Emacs + AUCTeX is highly competent. This is of course a highly subjective subject, so I'll leave it at that (that and that Emacs is clearly the best option :)
To get started with LaTeX on Linux, you're going to need to install a couple of packages:
You're going to need a LaTeX distribution. This is the collection of programs that comprise the (La)TeX computer typesetting system. The standard LaTeX distribution on Unix systems used to be teTeX, but it has been superceded by TeX Live. Most Linux distributions have installation packages for TeX Live--see, for example, the package database entries for Ubuntu and Fedora.
You will probably want to install a LaTeX editor. Standard Linux text editors will work fine; in particular, Emacs has a nice package of (La)TeX editing macros called AUCTeX. Specialized LaTeX editors also exist; of those, Kile (KDE Integrated LaTeX Environment) is particularly nice.
I would recommend start using Lyx, with that you can use Latex just as easy as OOO-Writer. It gives you the possibility to step into Latex deeper by manually adding Latex-Code to your Document. PDF is just one klick away after installatioin. Lyx is cross-plattform.
这取决于您的 Linux 发行版和您对编辑器的偏好等。但我建议从 Kile (一个 KDE app),因为它很容易学习和安装,它应该安装大多数 LaTex 和 PDF 生成所需的包。 只需看一下屏幕截图即可。
It depends on your Linux distibution and your preference of editors etc. but I would recommend to start with Kile (a KDE app) as it is easy to learn and installing it should install most of the needed packages for LaTex and PDF generation. Just have a look at the screenshots.
If you use Ubuntu or Debian, I made a tutorial easy to follow: Install LaTeX on Ubuntu or Debian. This tutorial explains how to install LaTeX and how to create your first PDF.
在此环境中包含图形的最佳格式是< a href="http://en.wikipedia.org/wiki/Encapsulated_PostScript" rel="nofollow noreferrer">eps(封装后记)尽管并非所有软件都会生成行为良好的后记。 可以使用各种机制包含 jpeg 或其他格式的照片。< /p>
LaTeX comes with most Linux distributions in the form of the teTeX distribution. Find all packages with 'teTeX' in the name and install them.
Most editors such as vim or emacs come with TeX editing modes. You can also get WYSIWIG-ish front-ends (technically WYSIWYM), of which perhaps the best known is LyX.
LaTeX works like a compiler. You compile the LaTeX document (which can include other files), which generates a file called a .dvi (device independent). This can be post-processed to various formats (including PDF) with various post-processors.
To do PDF, use dvips and use the flag -PPDF (IIRC - I don't have a makefile to hand) to produce a PS with font rendering set up for conversion to pdf. PDF conversion can then be done with ps2pdf or distiller (if you have this).
The best format for including graphics in this environment is eps (Encapsulated Postscript) although not all software produces well-behaved postscript. Photographs in jpeg or other formats can be included using various mechanisms.
发布评论
评论(8)
首先,您需要安装它:
如果您使用的是 Debian 或 Ubuntu,类似:
.. 将安装它。
RedHat 或 CentOS 需要:
注意:这需要 root 权限,因此可以使用
su
将用户切换到 root,或者在命令前加上sudo
(如果您不这样做)尚未以根用户身份登录。接下来您需要获取一个文本编辑器。 任何编辑器都可以,所以无论你喜欢什么。 您会发现 Emacs(和 vim)等高级编辑器添加了很多功能,因此将有助于在尝试构建文档输出之前确保语法正确。
创建一个名为 test.tex 的文件并在其中放入一些内容,例如 LaTeX 入门:
获得此文件后,您需要在其上运行 Latex 以生成一些输出(作为开始的 .dvi 文件,这可以转换为许多其他格式):
这将打印一堆输出,如下所示:
..不要担心大部分输出 - 重要的部分是写在 test.dvi 上的输出线,这表明它已经成功。
现在您需要使用 xdvi 查看输出文件:
这将弹出一个窗口,其中包含格式精美的输出。 点击“q”退出,或者您可以将其保持打开状态,当 test.dvi 文件被修改时它将自动更新(因此每当您运行 Latex 来更新输出时)。
要生成此 PDF,您只需运行 pdflatex 而不是 Latex:
..并且您将创建一个 test.pdf 文件而不是 test.dvi 文件。
一切正常后,我建议转到 LaTeX 入门 页面并当您需要要编写的文档的功能时,请浏览那里的项目。
未来需要考虑的事项包括:
使用 xfig 或 dia 等工具创建图表。 这些可以轻松地以各种格式插入到您的文档中。 请注意,如果您要创建 PDF,则不应使用 EPS(封装后记)作为图像 - 如果可能,请使用从图表编辑器导出的 pdf,或者您可以使用
epstopdf 包自动将
\includegraphics
中包含的图形从 (e)ps 转换为 pdf。开始对文档使用版本控制。 乍一看这似乎有些过分,但是当您编写大型内容时能够返回并查看早期版本可能非常有用。
使用 make 为您运行 Latex。 当您开始使用参考书目、图像和其他更复杂的乳胶用途时,您会发现需要在多个文件或多次上运行它(第一次更新参考文献,第二次将参考文献放入文档中,这样它们可能会过时,除非你运行乳胶两次......)。 将其抽象到 makefile 中可以节省大量时间和精力。
使用更好的编辑器。 像 Emacs + AUCTeX 这样的东西非常有能力。 这当然是一个高度主观的主题,所以我就到此为止(Emacs 显然是最好的选择:)
First you'll need to Install it:
If you're using Debian or Ubuntu, something like:
..will get it installed.
RedHat or CentOS need:
Note : This needs root permissions, so either use
su
to switch user to root, or prefix the commands withsudo
, if you aren't already logged in as the root user.Next you'll need to get a text editor. Any editor will do, so whatever you are comfortable with. You'll find that advanced editors like Emacs (and vim) add a lot of functionality and so will help with ensuring that your syntax is correct before you try and build your document output.
Create a file called test.tex and put some content in it, say the example from the LaTeX primer:
Once you've got this file you'll need to run latex on it to produce some output (as a .dvi file to start with, which is possible to convert to many other formats):
This will print a bunch of output, something like this:
..don't worry about most of this output -- the important part is the Output written on test.dvi line, which says that it was successful.
Now you need to view the output file with xdvi:
This will pop up a window with the beautifully formatted output in it. Hit `q' to quit this, or you can leave it open and it will automatically update when the test.dvi file is modified (so whenever you run latex to update the output).
To produce a PDF of this you simply run pdflatex instead of latex:
..and you'll have a test.pdf file created instead of the test.dvi file.
After this is all working fine, I would suggest going to the LaTeX primer page and running through the items on there as you need features for documents you want to write.
Future things to consider include:
Use tools such as xfig or dia to create diagrams. These can be easily inserted into your documents in a variety of formats. Note that if you are creating PDFs then you shouldn't use EPS (encapsulated postscript) for images -- use pdf exported from your diagram editor if possible, or you can use the
epstopdf
package to automatically convert from (e)ps to pdf for figures included with\includegraphics
.Start using version control on your documents. This seems excessive at first, but being able to go back and look at earlier versions when you are writing something large can be extremely useful.
Use make to run latex for you. When you start on having bibliographies, images and other more complex uses of latex you'll find that you need to run it over multiple files or multiple times (the first time updates the references, and the second puts references into the document, so they can be out-of-date unless you run latex twice...). Abstracting this into a makefile can save a lot of time and effort.
Use a better editor. Something like Emacs + AUCTeX is highly competent. This is of course a highly subjective subject, so I'll leave it at that (that and that Emacs is clearly the best option :)
要开始在 Linux 上使用 LaTeX,您需要安装几个软件包:
您需要一个LaTeX 发行版。 这是构成 (La)TeX 计算机排版系统的程序集合。 Unix 系统上的标准 LaTeX 发行版曾经是 teTeX,但它已被 TeX Live。 大多数 Linux 发行版都有 TeX Live 的安装包 - 例如,请参阅 Ubuntu 和 Fedora。
您可能需要安装LaTeX 编辑器。 标准 Linux 文本编辑器可以正常工作; 特别是,Emacs 有一个很好的 (La)TeX 编辑宏包,名为 AUCTeX。 还存在专门的 LaTeX 编辑器; 其中,Kile(KDE 集成 LaTeX 环境)特别好。
您可能需要一个LaTeX 教程。 经典教程是“LaTeX2e(并非如此)简短介绍”,但现在 LaTeX wikibook 可能是更好的选择。
To get started with LaTeX on Linux, you're going to need to install a couple of packages:
You're going to need a LaTeX distribution. This is the collection of programs that comprise the (La)TeX computer typesetting system. The standard LaTeX distribution on Unix systems used to be teTeX, but it has been superceded by TeX Live. Most Linux distributions have installation packages for TeX Live--see, for example, the package database entries for Ubuntu and Fedora.
You will probably want to install a LaTeX editor. Standard Linux text editors will work fine; in particular, Emacs has a nice package of (La)TeX editing macros called AUCTeX. Specialized LaTeX editors also exist; of those, Kile (KDE Integrated LaTeX Environment) is particularly nice.
You will probably want a LaTeX tutorial. The classic tutorial is "A (Not So) Short Introduction to LaTeX2e," but nowadays the LaTeX wikibook might be a better choice.
我建议开始使用 Lyx,这样您就可以像使用 OOO-Writer 一样简单地使用 Latex。
它使您可以通过手动将 Latex 代码添加到文档中来更深入地了解 Latex。
安装后只需一键即可获取 PDF。 Lyx 是跨平台的。
I would recommend start using Lyx, with that you can use Latex just as easy as OOO-Writer.
It gives you the possibility to step into Latex deeper by manually adding Latex-Code to your Document.
PDF is just one klick away after installatioin. Lyx is cross-plattform.
这取决于您的 Linux 发行版和您对编辑器的偏好等。但我建议从 Kile (一个 KDE app),因为它很容易学习和安装,它应该安装大多数 LaTex 和 PDF 生成所需的包。 只需看一下屏幕截图即可。
It depends on your Linux distibution and your preference of editors etc. but I would recommend to start with Kile (a KDE app) as it is easy to learn and installing it should install most of the needed packages for LaTex and PDF generation. Just have a look at the screenshots.
如果您使用 Ubuntu 或 Debian,我制作了一个易于理解的教程:在 Ubuntu 或 Debian 上安装 LaTeX 。 本教程介绍如何安装 LaTeX 以及如何创建您的第一个 PDF。
If you use Ubuntu or Debian, I made a tutorial easy to follow: Install LaTeX on Ubuntu or Debian. This tutorial explains how to install LaTeX and how to create your first PDF.
LaTeX 以 teTeX 发行版的形式随大多数 Linux 发行版一起提供。 查找名称中包含“teTeX”的所有软件包并安装它们。
大多数编辑器,例如 vim 或 emacs 附带 TeX 编辑模式。 您还可以获得所见即所得的前端(技术上所见即所得),其中可能是最好的已知的是 LyX。
LaTeX 的最佳快速介绍是 Oetiker 的 'LaTeX 的不那么简短的介绍'
LaTeX 的工作方式就像一个编译器。 您编译 LaTeX 文档(可以包含其他文件),该文档生成一个名为
.dvi 的文件
(与设备无关)。 可以使用各种后处理器将其后处理为各种格式(包括 PDF)。要制作 PDF,请使用
dvips
并使用标志 -PPDF(IIRC - 我手头没有 makefile)来生成带有字体渲染设置的 PS 以转换为 pdf。 然后可以使用ps2pdf
或 distiller(如果有的话)。
在此环境中包含图形的最佳格式是< a href="http://en.wikipedia.org/wiki/Encapsulated_PostScript" rel="nofollow noreferrer">
eps
(封装后记)尽管并非所有软件都会生成行为良好的后记。 可以使用各种机制包含 jpeg 或其他格式的照片。< /p>LaTeX comes with most Linux distributions in the form of the teTeX distribution. Find all packages with 'teTeX' in the name and install them.
Most editors such as vim or emacs come with TeX editing modes. You can also get WYSIWIG-ish front-ends (technically WYSIWYM), of which perhaps the best known is LyX.
The best quick intro to LaTeX is Oetiker's 'The not so short intro to LaTeX'
LaTeX works like a compiler. You compile the LaTeX document (which can include other files), which generates a file called a
.dvi
(device independent). This can be post-processed to various formats (including PDF) with various post-processors.To do PDF, use
dvips
and use the flag -PPDF (IIRC - I don't have a makefile to hand) to produce a PS with font rendering set up for conversion to pdf. PDF conversion can then be done withps2pdf
or distiller (if you have this).The best format for including graphics in this environment is
eps
(Encapsulated Postscript) although not all software produces well-behaved postscript. Photographs in jpeg or other formats can be included using various mechanisms.我个人会使用完整的编辑包,例如:
然后我会安装“MikTeX”作为编译包,它允许您使用 pdfLaTeX 编译器从文档生成 PDF。
I would personally use a complete editing package such as:
Then I would install "MikTeX" as the compiling package, which allows you to generate a PDF from your document, using the
pdfLaTeX
compiler.不足以让我的 centos 发行版获得 Latex 命令。
此站点 https://gist.github.com/melvincabatuan/350f86611bc012a5c1c6 包含其他软件包。 特别是:
已经足够了,但作者也指出了这些:
仅在需要时:
was not enough for my centos distro to get the latex command.
This site https://gist.github.com/melvincabatuan/350f86611bc012a5c1c6 contains additional packages. In particular:
was enough but the author also points out these as well:
Only if needed: