Mac系统如何配置VSCode作为LaTex的编译环境

  • 先安装好 MacTex 和 VSCode
  • 打开 VSCode,安装 latex workshop 插件
  • 打开 VSCode 的 settings.json 文件,追加如下配置:
"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"
            ]
        }
    ]
  • 在 VSCode 中打开或创建一个 .tex 文件,注意设置编码为 utf8,输入以下内容,保存,然后按 option + command + B 编译,再点击预览,即可看到对应的效果
\documentclass[UTF8]{ctexart}
\title{你好,world!}
\author{Winston}
\date{\today}
\begin{document}
\maketitle
你好,world!
\end{document}

Mac系统如何配置VSCode作为LaTex的编译环境_第1张图片

你可能感兴趣的:(软件)