如何优雅的在mac上使用latex
作者:互联网
写这份文档的起因
在接触latex一周后,突然想把mac上配置latex环境记录下来,以供需要的人来使用。这里我就不去介绍所谓的latex的各种相关知识了。我就直接进入主题吧!
我习惯使用微软的vscode来写东西,觉得它体积小,写东西超级流畅,各种插件丰富,很是方便。
进入主题
相关软件的命令安装
可以使用 Homebrew 安装所需要的软件,Homebrew 的安装和使用参考其他文章
安装mactex
选择MacTeX作为 LaTeX 编译引擎:
brew cask install mactex
安装vscode
选择VSCode作为LaTex 的编辑器:
brew cask install visual-studio-code
安装 Skim
选择skim作为pdf文件的浏览器
brew cask install skim
相关环境的配置
安装LaTeX Workshop插件
打开 VS Code,搜索插件: LaTeX Workshop,点击安装(下图已经安装),并重启VS Code.
修改 User Setting 配置
Code --> Performance --> Setting --> User Setting
可以使用关键字tools 或者recipes搜索:
LaTeX Workshop 默认的编译工具是 latexmk,根据需要修改所需的工具和命令,这里将其修改为中文环境最常用的 xelatex,根据需求进行修改。
使用如下内容配置:
{
"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.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.view.pdf.viewer": "tab",
"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"
],
}
配置完成后重启VSCode.
标签:latex,pdflatex,name,latexmk,mac,xelatex,优雅,安装 来源: https://blog.csdn.net/harris2019/article/details/95370793