VSCode LaTeX Setup

Nowadays, I would just use OverLeaf to compile LaTeX given its carefree LaTeX building environment. One of the most lovable feature is its arXiv export functionality. But when I am on-the-go, I would just fallback to build LaTeX locally to avoid a large phone bill caused by transfering of PDF preview image.

Installing LaTeX

macTeX on macOS

I almost never use GUI that comes with LaTeX distributions, so I just install the mactex-nogui with Homebrew.

brew install mactex-nogui

TeXLive on Windows

VSCode -specific settings

Writing LaTeX, there is some specific tuning I prefer:

This tuning results in the following VSCode .vscode/settings.json file.

{
    "latex-workshop.latex.autoBuild.run": "never",
    "workbench.colorTheme": "GitHub Light Default",
    "editor.minimap.enabled": false,
    "editor.fontSize": 13
}

In addition, I don’t like LaTeX workshop’s autobuild, so I set latex-workshop.latex.autoBuild.run to never and created my own build task:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "latexmk build",
            "type": "process",
            "command": "latexmk main.tex -pdf -pdflatex='pdflatex -synctex=1 -interaction=nonstopmode'",
            "problemMatcher": [],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

PDF Viewer with SyncTeX support

Skim on macOS

On macOS, the best solution for preview the PDF is with Skim, which supports SyncTeX. Navigate back to VSCode with the shortcut cmd+shift+click.

SyncTeX setup in Skim.

Samatra on Windows

I use Sumatra PDF on Windows. It is based on the MuPDF backend and comes with SyncTeX support.

References