到官网下载latexMacTeX - TeX Users Group
点这里下载:
下载完成后,启动台里会多出下面4个东西:
BibDesk是储存引用文献的,Tex Live Utility是管理软件包的,TexShop是官方的tex编辑器
2.添加路径:
/Library/Tex/texbin
路径下有一系列latex
的指令,若路径没有添加,在编译bib文件时,会出现biber: command not found
错误。
0. 检查/Library/Tex/texbin路径存在:ls /Library/Tex/texbin1. 打开 bash_profile文件: vim ~/.bash_profile 2. 追加: export PATH=/Library/Tex/texbin:$PATH3. 使bash_profile文件生效:source ~/.bash_profile4. 检查path变量:echo PATH
3. vscode安装latex workshop插件
4. 在settinng.json里追加(左下角齿轮里搜索setting):
注意:latex是要编译4次的,假设我的tex文件名为test.tex, 编译的流程一般是latex test->bibtex test->latex test->latex test,在setting里设置好就可以一键编译了。mac的pdflatex
对中文不太友好,但网上很多人的设置都是用pdflatex的,我们需要把pdflatex改成xelatex。刚开始我就是被坑了,在从 bib 引入参考文献时一直报错。
参考:/questions/429274/chinese-on-mactex-simple-example
"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 -> bibtex -> xelatex*2","tools": ["xelatex","bibtex","xelatex","xelatex"]},{"name": "xelatex","tools": ["xelatex"]},],"editor.wordWrap": "on" // 自动换行
4. 测试
documentclass[UTF8]{ctexart}title{你好,world!}author{Winston}date{today}begin{document}maketitle你好,world!end{document}
commad + option + B 编译,commad + option + V显示。
参考:
CSDN-专业IT技术社区-登录李晓芸的博客 | Lixy Bloghumanlee1011.github.io