因为写作业要用latex,所以来配置一下,看很多人都用subline,我比较喜欢用vscode,所以就基于vscode配置吧!
1、拥有vscode,如果没有,下载一个
2、下载MacTex(http://tug.org/mactex/)
3、在vscode插件(extension)中安装Latex workshop和Latex Language support
4、在setting中打开配置的json文件
5、加入以下配置:
(1)在latex-workshop.latex.tools配置中,增加xelatex项,具体如下。这一项的作用是在工具集中定义xelatex项,以便下一项配置能找到
(2)在latex-workshop.latex.recipes配置中,将第一项的latexmk改为xelatex。这里定义的是编译时调用的工具顺序,默认第一个为latexmk,因为我们要支持中文,所以替换为xelatex。
{
"latex-workshop.latex.tools": [
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%DOC%"
]
},
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%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": "pdflatex -> bibtex -> pdflatex*2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
}
]
}
6、创建一个.tex文件,注意编码一定要是utf8,输入以下内容。保存,option + command + B 编译。会自动编译产生对应的pdf。
\documentclass[UTF8]{ctexart}
\title{你好,world!}
\author{李明}
\date{\today}
\begin{document}
\maketitle
你好,world!
\end{document}
网友评论