LaTeX 简介与安装

来源:互联网 发布:桂树焉知泰山之高的焉 编辑:程序博客网 时间:2024/04/30 12:15

原文地址:http://blog.csdn.net/YhL_Leo/article/details/48289791


1 LaTeX 简介

Leslie Lamport 开发的 LaTeX 是当今世界上最流行和使用最为广泛的TeX格式。它构筑在Plain TeX的基础之上,并加进了很多的功能以使得使用者可以更为方便的利用TeX的强大功能。使用LaTeX基本上不需要使用者自己设计命令和宏等,因为LaTeX已经替你做好了。因此,即使使用者并不是很了解TeX,也可以在短短的时间内生成高质量的文档。对于生成复杂的数学公式,LaTeX表现的更为出色。

LaTeX文档的写作流程如上图所示,对应其三个主要环节,可将LaTeX分为三层:底层是TeX基础编译源,中层是文本编译器,上层是PDF文稿查看器。LaTeX官网中提供了Linux,Mac和Windows下的安装套件。

2 LaTeX相关配置

2.1 TeX基础编译源

本地编译器主要有MiKTeX,TeX Live和Texmaker。MiKTeX和TeX Live两者各有优劣,有兴趣的可以阅读一篇讨论帖,至于Texmaker笔者接触也不多~

除了本地编译外,还有在线LaTex编译器,例如ShareLaTeX、JaxEdit等。

2.2 文本编译器

比较常见的有Sublime Text、TeXworks、TexStudio、WinEdt、Emacs、Notepad++、LyX等。在维基百科中有一篇对比网页,其中有超过20种文本编辑器。如果喜欢纯键盘编辑,可以尝试Vim~

笔者使用的是TeXstudio,集编辑和预览于一身,用起来比较方便,可适用于Linux,Mac和Windows操作系统,下图是Windows下的界面:

2.3 PDF文稿查看器

常用的有SumatraPDF,Adobe Acrobat,Adobe Reader等。笔者使用的是Adobe Acrobat集PDF浏览与编辑于一体,比较便捷。(但是SumatraPDF在打开和阅读PDF文件的时候,非常流畅,建议尝试。)

2.4 参考文献管理

考虑到写论文时参考文献的管理是无法逃避的问题,为此很有必要单独讲解一下,参考文献的管理,笔者认为有三种方法:

  • 最简单粗暴法:直接全手动写入,例如:
<code class="language-latex hljs tex has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-command" style="box-sizing: border-box; color: rgb(0, 0, 136);">\begin</span><span class="hljs-special" style="box-sizing: border-box; color: rgb(102, 102, 0);">{</span>thebibliography<span class="hljs-special" style="box-sizing: border-box; color: rgb(102, 102, 0);">}</span><span class="hljs-special" style="box-sizing: border-box; color: rgb(102, 102, 0);">{</span>1<span class="hljs-special" style="box-sizing: border-box; color: rgb(102, 102, 0);">}</span><span class="hljs-command" style="box-sizing: border-box; color: rgb(0, 0, 136);">\bibitem</span><span class="hljs-special" style="box-sizing: border-box; color: rgb(102, 102, 0);">{</span>IEEEhowto:kopka<span class="hljs-special" style="box-sizing: border-box; color: rgb(102, 102, 0);">}</span>H.<span class="hljs-special" style="box-sizing: border-box; color: rgb(102, 102, 0);">~</span>Kopka and P.<span class="hljs-special" style="box-sizing: border-box; color: rgb(102, 102, 0);">~</span>W. Daly, <span class="hljs-command" style="box-sizing: border-box; color: rgb(0, 0, 136);">\emph</span><span class="hljs-special" style="box-sizing: border-box; color: rgb(102, 102, 0);">{</span>A Guide to <span class="hljs-command" style="box-sizing: border-box; color: rgb(0, 0, 136);">\LaTeX</span><span class="hljs-special" style="box-sizing: border-box; color: rgb(102, 102, 0);">}</span>, 3rd<span class="hljs-special" style="box-sizing: border-box; color: rgb(102, 102, 0);">~</span>ed.<span class="hljs-command" style="box-sizing: border-box; color: rgb(0, 0, 136);">\hskip</span> 1em plus  0.5em minus 0.4em<span class="hljs-command" style="box-sizing: border-box; color: rgb(0, 0, 136);">\relax</span> Harlow, England: Addison-Wesley, 1999.<span class="hljs-command" style="box-sizing: border-box; color: rgb(0, 0, 136);">\end</span><span class="hljs-special" style="box-sizing: border-box; color: rgb(102, 102, 0);">{</span>thebibliography<span class="hljs-special" style="box-sizing: border-box; color: rgb(102, 102, 0);">}</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li></ul>

  • 知乎中看到一种相对简单的管理方法,将参考文献复制粘贴到bib文件,然后在编辑文档中访问bib文件实现对参考文献的管理和引用,感兴趣的可以阅读;

  • 使用参考文献管理软件,如JabRef,笔者推荐使用该方法: 
    在谷歌学术中搜索参考文献的BibTeX

使用JabRef添加到bib文件中:

直接调用bib文件即可:

<code class="language-latex hljs matlab has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">\bibliographystyle<span class="hljs-cell" style="box-sizing: border-box;">{IEEEtran}</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">% style</span>\bibliography<span class="hljs-cell" style="box-sizing: border-box;">{paper}</span>         <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">% include the paper.bib</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>

结束语: 
笔者的配置为:MiKTeX+TeXstudio+Adobe Acrobat+JabRef~后来使用过程中发现有些宏包不全,就改为CTeX+TeXstudio+Adobe Acrobat+JabRef(其实CTeX中已经含有一些文本编辑器,例如WinEditTeXworks)就更好用了~

参考文献:

  • 知乎1:http://www.zhihu.com/question/19954023
  • 知乎2:http://www.zhihu.com/question/23565739/answer/51511029
  • 知乎3:http://www.zhihu.com/question/21375839
  • 维基百科:https://en.wikipedia.org/wiki/Comparison_of_TeX_editors
  • StackExchange:http://tex.stackexchange.com/questions/20036/what-are-the-advantages-of-tex-live-over-miktex

0 0
原创粉丝点击