美文网首页
Mac下使用VScode作LaTeX的集成环境

Mac下使用VScode作LaTeX的集成环境

作者: 哈哈哈8888 | 来源:发表于2020-03-09 14:32 被阅读0次

Mac 下的 LaTeX 使用

1. LaTeX 包

Mac 下的 LaTeX 是MacTeX。

MacTeX 同出于 TUG(TeX Users Group),是专门针对于 Mac 系统推出的 TeX 安装包几何 DVD。

官网下载:http://www.tug.org/mactex/mactex-download.html

国内下载可以到清华源,速度相对快一些:https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/mac/mactex/

2. 编辑器:VScode

MacTeX 自带的编辑器是 TeXshop,太“简洁”了,跟 Windows 下默认的 texworks 一个尿性。生命短暂,为了提高生产力,还是用其他替代比较好。

付费的没用过。免费的,使用过 texstudio,启动慢、文件多了之后更慢。界面难看,多语言支持差。

本着“最小作用”的原理,考虑使用 vscode 替代。Google 了一下方案,还是比较简单的。

首先,安装LaTeX workshop 扩展。

然后,将一段设置贴到 settings文件中。打开 settings的方法:

Code - > preferences -> settings

或者使用命令:cmd+,

这一段设置代码是:

{
    "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.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"
  ]

}

这个设置支持中文的各种写作,因为他把 xelatex设置为了首选编译命令。

其他的设置,我也不知道为什么。

3. 使用

设置好了就可以用了。

LaTeX workshop 同时把代码补全、语法高亮之类的都给支持了。

编译命令是:

cmd+option+B, B=build

查看 PDF 输出:

cmd+option+V, V=view

也可以点击编辑器右上角的图标【长得像一页纸上面有个放大镜】,在右侧显示 PDF 预览窗格。

相关文章

网友评论

      本文标题:Mac下使用VScode作LaTeX的集成环境

      本文链接:https://www.haomeiwen.com/subject/lxkpdhtx.html