什么是LaTeX
了解LaTeX之前,首先要知道TeX,TEX(TeX)是由著名的计算机科学家Donald E. Knuth(高德纳)发明的排版系统,本质上还是一门宏语言。而LaTeX是基于这门宏语言,经过后人不断的完善形成的一种排版格式。
其和现在很多人使用的、常常用于写文章的Markdown格式,没有本质的不同,都是通过不同标签来控制文章的格式。
这里是我的个人网站:https://endlesslethe.com/latex-installation-tutorial.html
有更多总结分享,最新更新也只会发布在我的个人网站上。
快速安装
先给出结论:推荐使用TeX Live( https://tug.org/texlive ) (编译器、内核)+Atom(https://atom.io) (编辑器、IDE)
- 分别完全安装上述两个软件
- TexLive的安装时间会很长,因为它会下载很多可能会用到的宏包,慢慢等待吧=v=
- 打开Atom,File -> Settings -> Install,搜索并安装
- language-latex
- latex
- pdf-view
- 安装后,File -> Settings -> Packages,点击latex的settings选项
- 在第一个空白栏“Tex Path”中添加自己安装latex所在的bin目录
- 环境已经配置成功,输入下面的测试代码并使用Ctrl+Alt+B运行(或者通过 Packages -> LaTeX -> build)
\documentclass[UTF8]{article}
\usepackage{ctex}
\begin{document}
\begin{center}
你好 \LaTeX
\end{center}
\end{document}
名词解释
TeXLive
TeXLive 是一款跨平台的TeX编译器。
MiKTEX
MiKTeX是一款跨平台的TeX编译器。
CTEX
CTEX提供了CTEX 中文套装,其把MiKTEX和一些相关工具(如WinEdt、GSview 等)打包在一起,同时对中文接口进行了配置,以实现对中文文本的编辑。
TeXStudio、WinEdt
TeXStudio、WinEdt 是编辑器 LaTeX 是编译引擎 CTeX 是基于MikTeX的封装了中文支持的套装 ctex 是中文支持宏包
比较和总结
- TeXLive是一个组织在维护,使用的人也更多,所以看起来more future-safe。
- 据说MikTeX和TeXLive代码基本差不多,有越来越靠近的趋势。
- CTeX已经很久没人维护了,极其不推荐。
So: 推荐使用TeXLive。编译器个人推荐atom,其他的编辑器应该也差不多。
platform | TeX Distribution |
---|---|
Only Windows | CTeX |
Only Mac | MacTeX |
Windows, Linux | MikTeX TeXLive |
编辑器的配置
Atom作为励志要取代Vim和Sublime的编辑器,通过安装各种各样的插件,可以实现One for All的效果。
比如:用Atom编辑Markdown、编译C、编译Python脚本、编译LaTex。
而且除了支持Vim和Sublime的快捷键外,还有很多美化插件XD。
- 安装Atom( https://atom.io )
- File -> Settings -> Install
搜索并安装:- language-latex
- latex
- pdf-view
快捷键
Ctrl+Alt+B:预览功能,等同于通过 Packages -> LaTeX -> build。左边是源码,右边是生成的pdf文件。
一个更复杂的测试用例
\documentclass[UTF8]{article}
\author {Author}
\title {Title}
\usepackage{ctex}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\maketitle
\section{First section} test1.
\subsection{First subsection} test2.
\subsubsection{First double subsection}
\paragraph{Fist paragraph} test3.
\subparagraph{First subparagraph} test4.
\subsection{Second subsection}
\paragraph{段落} 中文测试。
\\
Hello World! \\ % This is comment
Hello \LaTeX ! \\
$\lim\limits_{n \rightarrow +\infty} P\lbrace\frac{\sum\limits_{i=1}{n}Xi - n\cdot EX}{ \sqrt{n \cdot DX} } \leqslant x\rbrace = \Phi(x)$ \\
$P\lbrace a<X<b \rbrace \approx \Phi(\frac{b - n\cdot EX}{\sqrt {n\cdot DX}}) - \Phi(\frac{a - n\cdot EX}{\sqrt{n\cdot DX} })$ \\
$F(x,y) = F_{X}(x)F_{Y}(y)$
\end{document}
参考文献
I. LaTeX新人教程,30分钟从完全陌生到基本入门
II. What are the advantages of TeX Live over MiKTeX?
III. Latex编辑器(Atom+TexLive)
IV. 用atom写LaTeX文档
V. 【论文工具】LaTeX环境配置(TeX Live 2018和TeXstudio)