您的位置:首页 > 其它

使用LaTeX(一)

2007-07-31 19:27 232 查看
我的系统是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进行查看了。

其实更好的方法是直接写一个脚本程序,这样就免去了每次都要敲好几个命令的麻烦。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: