简单的latex环境配置(Eclipse版)

关键词:Latex, MiKTeX, Eclipse, R language, Texlipse, StatET, wordwrap,SVN

2011/6/3 [email protected] http://hi.baidu.com/shichunqi

前言:

很多时候Latex会给你带来美丽, 缓解复杂, 和所有的高级工具一样, 欺负新人。 又说工 欲善其事, 必先利其器。 说到文本编辑, 首推当然两大编辑神器Emacs, VI。 如果你不用, 那真是 一大损失。 另外, 像我这样的菜鸟, 一直认为Eclipse 是菜鸟的神器。 本文会介绍一下怎么在Eclipse 下配置Latex编辑环境。 虽然,本人首推Latex编辑依然是:Emacs for Linux环境, Winedt for Window环境。 只是目前 还是在windows工作, 并且Winedt是Shareware, 很崇拜Shareware这种勾引策略。 但是不愿掏钱,又 想尊重人家。 之后, 就试着在Vista下面配Emacs,结 果 Vista是在太烂了。 无奈下继续拜一拜Eclipse, 菜鸟嘛, 你懂得。 如果你有同样困境, 说不定可以用到。 结果一试,还算满意。

特点:

1,容易安装: windows点击安装, eclipse在线安装, eclipse配置简单。 2,语法检查: Texlipse 支持即时Latex语法检查这个比较强大。 3,拼写检查: eclipse的默认和Texlipse语法检查不错, 还能自己加词。 4,备份容易: SVN强大的备份用在latex论文管理太小儿科了, 而且压缩不占空间。 每次备份还可 以加comment, SVN 比较修改太方便了。 5,预览方便: 能记忆上次打开位置, 利用eclipse快捷键(ctrl+4), 一键跳到上次修改的 位置。 不比Emacs即时预览差劲。 6,容易制图: R语言加Eclipse良好的编辑环境,函数自动提示, 画好看的统计图不在那么难。 7,很占空间: Eclipse比较占用空间。这个是个比较大的缺点。 8,用新工具: SVN可能要学一下, 不是那么太难, 比latex简单多了。

术语介绍:

1,MiKTeX: 一个Latex发型版, windows第一推荐, 差不多吧。 2,R Language: 一个免费的统计系统, 用来画统计图, 挺好的。 本着免费, 轻量, 应该推荐 下下。 当然你有Matlab, Mathematica… 那应该不用了。 3,SVN: 一个版本控制的。 由于Latex修改备份麻烦, 用了后觉得不错。 4,VisualSVN: 一个Windows下轻量的SVN服务器。 5,Texlipse: Tex 在 eclipse下插件。 6,StatET: R 语言在 eclipse下插件。 7,Subclipse:SVN在 eclipse下插件,比较推荐的一个。 8,Wordwrap: 一个换行的eclipse下插件,要不要多可以。 9,hunspell4eclipse:一个语法检查的eclipse下插件,要不要多可以。 10, metafile2eps: 一个LyX的插件, 可以单独提供, 将WMF,EMF转成EPS,在Windows下应 该常用的。 11, Fox Reader 4.3: PDF阅读器。国产轻量的阅读器。 有很多优点, 可以记忆上次打开的文档信 息呀。 不锁定文件呀(lock file)。 注意 5.0 是锁定文件的, 我已经跟他们报BUG了。 “5.0 中阅读器会锁定文件”该情况却是如您所说。该情况已经上报给我们的QA部门,上报号 26971.。-Lisa Foxit Corporation”

软件:

当前系统 Vista, 烂系统, 当然Vista下多能用, 那么所有系统应该能用了, 哈哈。

软件下载: 1,MiKTeX 2.9:http://miktex.org/about Windows下一直这么推荐的 2,R环境:http://www.r-project.org/ 3,Fox Reader 4.3: http://www.foxitsoftware.com/downloads/older_ver.html 注意, 不要下 5.0 会锁 定文件, 那样不如用。SumatraPDF http://blog.kowalczyk.info/software/sumatrapdf/download-free--viewer.html 4,VisualSVN:http://www.visualsvn.com/ 5,metafile2eps:http://wiki.lyx.org/Windows/MetafileToEPSConverter 6,Eclipse Helios:http://www.eclipse.org/downloads/

上面这些软件你就统统装上就好了。 我懒, 用了默认安装, 其实随便啦。

安装: 1,MiKTeX 2.9:C:\Program Files\MiKTeX 2.9 2,R:C:\Program Files\R\R-2.12.1 3,Fox Reader 4.3:C:\Program Files\Foxit \Foxit Reader 4,VisualSVN:C:\Program Files\VisualSVN Server 5,metafile2eps:C:\Program Files\Metafile to EPS Converter 6,Eclipse Helios:D:\system\eclipse

插件安装: Help  Install New Software 1,Texlipse - http://texlipse.sourceforge.net/. 注意下载词典(目前只有英文的): http://sourceforge.net/projects/texlipse/files/dictionaries/ 2,R - http://download.walware.de/eclipse-3.6 3,Wordwrap - http://ahtik.com/eclipse-update/ 4,Hunspell4eclipse - http://hunspell4eclipse.googlecode.com/svn/trunk/com.lorands.hunspell4eclipse.updatesite 5,Subclipse - http://subclipse.tigris.org/update_1.6.x

配置

软件配值: 1,VisualSVN: 自己设定了一个备份池: D:\svnrepository 地址: https://locahost/svn/ , 当然如果配 上机器名,其他机器也可以访问。

2,Foxit Reader: Tool PreferenceHistory: Restore last view setting when reopening √ (记忆历史) | Reading: Read the entire document √ (缓存整个文件)| Document: Tabbed documents √ (面板方 式展示)

3. R Language: http://www.walware.de/it/statet/installation.mframe 要记得按装一个Package R Package rj 运行:"C:\Program Files\R\R-2.12.1\bin\i386\Rgui.exe" --internet2 直接install.packages("rj", repos="http://download.walware.de/rj-0.5")

插件配置: 1,EclipseWindowsPreferenceTexlipse: 1.1 Builder Setting

1.2 View Setting 为PDF配置Foxit Reader View name: pdf View command: C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe View argument:-z %file View input file format: pdf

1.3 Spelling Checker: 下载词典http://sourceforge.net/projects/texlipse/files/dictionaries/ 到 D:\system\dictionary\en.dict

2,EclipseWindowsPreferenceStatET: Run/Debug: R Environment Add Try find automatically.

好至此配置全部完成。

使用介绍:

编个Latex先

1.1 建个目录写个Tex Eclipse File New Other Wizard TexlipseLatex Project

Next Create project at external location Project name: helloworld Directory: d:/temp/latex Next Finish

1.2 编辑: document.tex

¥documentclass{article} ¥begin{document} ¥title{Eclipse for Latex} ¥author{Chunqi Shi} ¥date{June 2011} ¥maketitle % Hello world! ¥end{document}

Texlipse是即时检查语法错误的。 很容易定位到哪里出错了。

另外Eclipse也有部分自动提示的。

1.3 预览  Ctr+s 保存,Ctr+4 预览(或者菜单LatexPreview Document)

画个R图 R language简单图可以看:http://www.harding.edu/fmccown/r/#autosdatafile

2.1 Project Hello World 右键New Filefigure.R

2.2 把workspace切到StatET (右上角)

2.3 编辑R 语言 # figure.R # Define the cars vector with 5 values cars <- c(1, 3, 6, 4, 9)

# Graph the cars vector with all defaults plot(cars)

2.4 运行R: Menu RunRun Configuration Name: runRJ

RunRun file in R via command (快捷键 ctrl+a, ctrl+r, ctrl+r)

结果

2.5 输出到文件: 修改figure.R  ctrl+a, ctrl+r, ctrl+r

# Define the cars vector with 5 values cars <- c(1, 3, 6, 4, 9)

postscript(file="D:¥¥temp¥¥latex¥¥figure.eps", onefile=TRUE, horizontal=FALSE, width = 4, height = 4, paper="special", family="Times")

# Graph the cars vector with all defaults plot(cars) dev.off()

2.6 另外Eclipse F2 快捷键帮助也可以用哦, 双击postscipt选中 F2。

保存备份

3.1 连上SVN: Project helloworld  右键TeamShare ProjectSVNNextCreate a new repository location

3.2 Create a new repository locationuser project name as folder nameFinish https://localhost/svn/paper

3.3 提交备份: hello world右键Teamcommit

3.4 workspace 切回到Texlipse继续工作