VS Code Integration with latex_it

latex_it integrates with Visual Studio Code in two ways:

  1. Native VS Code Tasks (zero extensions required).
  2. LaTeX Workshop Extension (the full IDE LaTeX setup).

Instant Automated Setup (l --vscode-init)

Run the following command inside your LaTeX project root:

l --vscode-init

latex_it automatically creates or updates the .vscode/ configuration files:


Workflow 1: Native VS Code Tasks (Zero Extensions)

You can build documents using VS Code’s standard task runner without installing any LaTeX extension.

Create .vscode/tasks.json in your project root:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Build LaTeX (latex_it)",
      "type": "shell",
      "command": "l",
      "args": ["--compile"],
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "presentation": {
        "reveal": "silent",
        "panel": "shared"
      },
      "problemMatcher": {
        "owner": "latex",
        "fileLocation": ["relative", "${workspaceFolder}"],
        "pattern": {
          "regexp": "^([^:]+):(\\d+)(?::(\\d+))?:\\s+(error|warning|alert|note):\\s+(.*)$",
          "file": 1,
          "line": 2,
          "column": 3,
          "severity": 4,
          "message": 5
        }
      }
    }
  ]
}

Key Shortcuts:


Workflow 2: LaTeX Workshop Extension

If you use the popular LaTeX Workshop extension, configure latex_it as a custom compiler tool and recipe in .vscode/settings.json (or your global User Settings):

{
  "latex-workshop.latex.tools": [
    {
      "name": "latex_it",
      "command": "l",
      "args": ["--vscode-lw", "%DOC%"],
      "env": {}
    }
  ],
  "latex-workshop.latex.recipes": [
    {
      "name": "latex_it",
      "tools": ["latex_it"]
    }
  ],
  "latex-workshop.latex.recipe.default": "latex_it",
  "latex-workshop.latex.outDir": "%DIR%/junk",
  "latex-workshop.latex.autoClean.run": "never"
}

Why set outDir to junk?

latex_it isolates temporary build artifacts (.log, .aux, .fls) in junk/. Telling LaTeX Workshop that "latex-workshop.latex.outDir": "%DIR%/junk" ensures its internal log parser can find junk/<doc>.log and correctly populate VS Code’s diagnostic view.


latex_it compiles documents with -synctex=1 by default and automatically exports <doc>.synctex.gz (and <doc>.pdf) to the project root directory, while also preserving copies in junk/.

In LaTeX Workshop (Internal Viewer):

In External Viewers:

Because the .pdf and .synctex.gz files live side-by-side in your project root, external PDF viewers with SyncTeX support work out of the box: