|
看了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). |
|