Skip to content

Instantly share code, notes, and snippets.

@felixfbecker
Last active April 29, 2021 12:09
Show Gist options
  • Save felixfbecker/4a1ee1d03d8c7b8ae4de to your computer and use it in GitHub Desktop.
Save felixfbecker/4a1ee1d03d8c7b8ae4de to your computer and use it in GitHub Desktop.
VS Code tasks.json for Latex to PDF compilation w/ problem matcher
/*
An example tasks.json for VS Code that defines a task for compiling Latex to PDF including a problem matcher.
This is for Windows but it should be easy to adopt it for Linux/Mac, basically replace powershell with sh and -Command with -c
*/
{
"version": "0.1.0",
"isShellCommand": true,
"suppressTaskName": true,
"windows": {
"command": "powershell",
"args": ["-Command"],
"tasks": [
{
"taskName": "pdflatex",
"args": ["cd ${fileDirname}; pdflatex.exe -c-style-errors -interaction=nonstopmode ${fileBasename}; $pdf = [System.IO.Path]::GetFileNameWithoutExtension('${fileBasename}') + '.pdf'; start $pdf"],
"showOutput": "silent",
"isBuildCommand": true,
"problemMatcher": {
"owner": "latex",
"fileLocation": ["relative", "${fileDirname}"],
"pattern": {
"regexp": "^(.*):([0-9]+): (.*)$",
"file": 1,
"line": 2,
"message": 3
}
}
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment