LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1378|回复: 8

喜欢Latex

[复制链接]
发表于 2006-10-21 13:51:14 | 显示全部楼层 |阅读模式
看了moi关于的文章,我也想说几句。
既然有很多人说latex难学, 那就写一个简明教程。我先开始。
如果你也想用latex写paper, 就一起学一下。

1. 推荐环境

  操作系统: linux
  编辑器: emacs
  latex:  tetex or tex live

  你的系统中应该都有吧。

2. 配置emacs

   在文件~/.emacs 中加入

;;; enable 语法高亮
(global-font-lock-mode t)
;;; 当打开 *.tex 时自动加载 latex mode
(setq auto-mode-alist '(
  ("\\.tex$" . latex-mode)))

   这个简单.

3. 第一个 latex 文件 first.tex

(3.1)用 emacs 编辑新文件 first.tex

   emacs first.tex

(3.2)输入一个template

\documentclass{article}

\title{My First Latex Paper}

\author{Kevin Liu \\
Linux Sir Forum, Beijing, China}

% begin of the document
\begin{document}
\maketitle

\abstract{
This is the abstract of my first latex paper.
}

\section{Introduction}
Hi, this is introduction.
If you want to start a new paragraph, insert a blank line.

The new paragraph. This paragraph has more than one line,
you can add what you want here.

The third paragraph. I will use mathematical variable $x$ and $y$.
The first formulae is $x = y^2$ ($x$ is the square of $y$).

\section{Method}
Hi, this is section Method. Here, I use the first reference \cite{Knuth1984}.

\subsection{Model}
This is the first subsection of Method.

\subsection{Algorithm}
This is the second subsection of Method.

\section{Result}
Hi, this is section Result.

\begin{thebibliography}{99}
\bibitem{Knuth1984}
Donald E. Knuth, The TeXbook, Addison-Wesley, 1984.
\end{thebibliography}

\end{document}


有点长,我想大家都比较急,直接把框架写出来。
你可以 copy paste.

(3.3) 下面就是编译了。下面的是 emacs 中命令
C_x C_s :  保存文件 first.tex
C_c C_f :  latex first.tex 第一遍
C_c C_f :  latex first.tex 第二遍  (没有新的label的话,第二遍可省略).

(3.4) 显示paper

xdvi first.dvi

(3.5) 生成 ps 和 pdf

dvips -f first.dvi > first.ps
ps2pdf first.ps

4  分析 first.tex

几个符号:

%  百分号是用来注释的, 就象 C 中的 /* ....  */
\  这个符号后面的都是 latex 的命令  比如 \begin  \title \section
\\ 换行
$x$  数学符号, 例如 x, 或者是数学公式,例如 x = y^2 要放到两个$符号之间.

把 first.dvi 和 first.tex 一对照, 大部分命令就明白了。
讲几个。

\begin{document} \end{document} 文章开始,结束
\maketile  生成标题
\cite{Knuth1984}    引用参考文献 Knuth1984
\bibitem{Knuth1984} 参考文献的一项. Knuth1984 是给这个参考文献定的名字(label).
发表于 2006-10-22 07:18:19 | 显示全部楼层
建议使用 AucTeX
回复 支持 反对

使用道具 举报

发表于 2006-10-22 08:24:09 | 显示全部楼层
emacs+AucTeX 几乎所见即所得。
回复 支持 反对

使用道具 举报

发表于 2006-10-22 08:29:34 | 显示全部楼层
另外 liangzi 的那个中文 TeXLive2005 经试用做得相当好:

http://linuxsir.cn/bbs/showthread.php?t=274754
回复 支持 反对

使用道具 举报

发表于 2006-10-22 08:35:58 | 显示全部楼层
Post by wildfire
emacs+AucTeX 几乎所见即所得。

vim能实现吗?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-10-22 18:24:53 | 显示全部楼层
latex 文件只是一个简单的文本文件,你可以用任何editor, 然后将 3.3 改一下.

1. 保存文件 first.tex
2. 在shell 中运行 $ latex first.tex

关于vi, 我不是很熟, 大体如下。

:w   保存文件 first.tex
:sh  进入shell
$ latex first.tex  编译
^D  返回vi

可能有一些有用的macro,会简单些, 我就不清楚了。
回复 支持 反对

使用道具 举报

发表于 2006-10-22 19:20:04 | 显示全部楼层
用了很多编辑器,还是kile顺手
回复 支持 反对

使用道具 举报

发表于 2006-10-22 22:27:32 | 显示全部楼层
Post by 食古不化
vim能实现吗?


vim+LaTeX-suite 也是很好的 LaTeX 环境,但没有象 AucTeX 那样的 preview:

http://www.gnu.org/software/auctex/img/preview-screenshot.png
回复 支持 反对

使用道具 举报

发表于 2006-10-24 23:29:14 | 显示全部楼层
I am using VIM+Latex, not bad
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表