LaTeX快速上手
前言
写这篇文章的目的是为了总结技术安利LaTeX,它是一款非常专业的排版软件,能够让你专心于内容的创造。
与markdown相比,对于普通的理科生来说,LaTeX在学术论文的使用更加广泛,而markdown则是用来做笔记,写博客(这篇分享文章就是用markdown写的^_^)。
当然,刚开始使用latex是会有一段非常痛苦的学习过程,但是一旦掌握了latex的基本使用方法,那么你就可以从繁琐的排版任务中解脱出来,尤其是在写大小论文的时候,用word排版实在太难受了,所以,长痛不如短痛,学一学latex总归是对你没坏处的。
LaTeX的安装和美化
太丑的界面可能会让人失去创作的兴趣。
-----鲁迅
首先下载texlive,根据自己的操作系统选择不同的版本。
安装之后,界面如下所示。
这个界面看起来光秃秃的,不是很漂亮的样子。所以我们还需要进行美化。
这时候就要使用一个coding神器:VSCODE了。
在标注红框的位置,你可以搜索”latex”,我推荐使用LaTeX workshop。这样就可以在vscode里面使用latex环境了,有补全,语法高亮,缩进,等等。
难不难的无所谓,主要是漂亮
当然,还有中文补丁,界面主题,字体等等
VScode,它不香嘛? |
ok,到此为止,美化界面的工作暂时结束,如果觉得不够漂亮还可以自由发挥~~~
VScode内配置latex编译器
ctl+shift+x 打开vscode插件栏,查找latex-workshop安装并重启。
文件 ->首选项->设置 打开搜索栏搜索latex-workshop.latex.recipes并点击Edit setttings.json进行修改。
初始配置应该非常简短,我们需要添加latex编译配置,因为默认的pdflatex没法编译中文。所以我们将配置改成如下所示,更详细的可以参考知乎
1 | { |
认识LaTeX
1 | \documentclass{article} |
以上这一段latexdiamante可以说是非常之短小了,但是它是能运行的!
这一段代码的大概意思就是首先生成一个article环境,然后打印一段Here comes \LaTeX!
先说一句,document之外的都属于模板,不同的模板有不同的命令,但是大部分模板内部所使用宏包都基本相同,本篇文章只抓重点讲解。
latex的命令都是以\开头,最常见的就是1
2
3\being{*environment}
\end{*environment}
,代表开始一个新的环境,*enviroment是可选参数。如果你想新建一个插图,那就1
2
3\being{figure}
\end{figure}
如果想新建一个表格,那就:1
2
3\being{table}
\end{table}
具体的使用语法可以在写作的过程中查询~