我的系統是Ubuntu7.04。
首先我們需要下載安裝TeX.使用如下的命令: apt-get install tetex-base
當然如果你覺得你硬盤空間夠多,還可以下tetex-extra,命令是:apt-get install tetex-extra
安裝好以後,我們開始寫我們第一個tex文件:
使用gvim foo.tex 新建一個.tex的文件(作為TeX的輸入文件),在裡面輸入下面的文本:
\documentclass[a4paper,11pt]{article}
% define the title
\author{Wang E}
\title{This is a Test}
\begin{document}
% generates the title
\maketitle
% insert the table of content
\tableofcontents
\section{Hello,Earth!}
Hello,I'm WangE from Mars!\newline This document is generated by \LaTeX !
\section{Bye,Earth}
\ldots{} and here it ends.
\end{document}
輸入上面文本以後,保存。
然後輸入下面命令:
latex foo.tex
這將生成foo.dvi的設備無關文件。
然後輸入下面命令:
xdvi foo.dvi &
這是使用xdvi工具對生成的dvi文件預覽。
使用命令:
dvipdf foo.dvi
將生成pdf文件,這時就可以用
xpdf foo.pdf進行查看了。
其實更好的方法是直接寫一個腳本程序,這樣就免去了每次都要敲好幾個命令的麻煩。