科研第一步,LaTex学起来
必备软件
1、Texlive
LaTeX的实现软件有多种,常见的有Texlive, Miktex, CTex......本次安装选择使用Texlive。(其实是安装Miktex后出现了一些无法解决的小问题所以转而下载有3+G的Texlive,安装后成功运行)
2、VScode
LaTeX的编辑器其实有很多,常见的有TexStudio、Texworks、Sublime Text、Atom、VScode......本次安装选择使用VScode。(微软大法好)
安装
1、Texlive
安装教程(参照百度经验)
1、打开“install-tl-advanced.bat”文件
2、选择安装路径,完成后点击“确定”
3、选择“more”查看更多安装选项,如图1.1
4、在“Customize”中选择常用的中文和英文,减少安装所占内存以及时间,如图1.2以及图1.3
5、选择完成后点击“安装”,该过程耗时较久,本人大概耗费20min
6、安装完成后在cmd下输入tex -v 或 latex -v 或 xelatex -v验证安装是否成功
至此Texlive安装成功。
2、VScode
在VScode中使用Latex需要使用扩展插件LaTeX Workshop以及LaTeX language support
1、安装VScode(傻瓜式安装)
2、安装成功后打开VScode,可以在扩展插件中找“Chinese Language”(如图2.1)并下载以达到汉化VScode的目的
3、在扩展插件中安装“LaTeX language support”(如图2.2)以及“LaTeX Workshop”(如图2.3)
4、修改user setting,选择 “文件→首选项→设置”,配置文件如下
配置文件:
{
"latex-workshop.view.pdf.viewer": "tab",
// Latex workshop后加入的配置
"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%DOC%"
]
},
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
]
}
],
"latex-workshop.latex.recipes": [
{
"name": "xelatex",
"tools": [
"xelatex"
]
},
{
"name": "latexmk",
"tools": [
"latexmk"
]
},
{
"name": "pdflatex -> bibtex -> pdflatex*2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
}
],
"latex-workshop.latex.clean.enabled": true,
"latex-workshop.latex.clean.fileTypes": [
"*.aux",
"*.bbl",
"*.blg",
"*.idx",
"*.ind",
"*.lof",
"*.lot",
"*.out",
"*.toc",
"*.acn",
"*.acr",
"*.alg",
"*.glg",
"*.glo",
"*.gls",
"*.ist",
"*.fls",
"*.log",
"*.fdb_latexmk"
],
"latex-workshop.latex.autoClean.run": "onBuilt" //后加入的配置
}
5、新建xxx.tex文件即可运行使用
其中,ctrl + s保存并编译文件,图2.4中浏览生成的pdf文件