How do I quickly compile LaTeX in vscode workshop without having to go to the TeX tab everytime?

I know the CTRL + ALT + B hotkey but I can't select the recipe I want.

1 Answer 1


I. LaTeX Workshop way

Go to user settings (UI) tab and search for recipe:, you will be able to see a section called Latex-workshop > Latex > Recipe: Default.

Change first to last used, then compile whatever recipe you need on the TeX menu, after that every compile you make using CTRL + ALT + B will be LuaLaTex.

II. Code Runner way

I prefer this way because I like to use the mouse for compiling.

The Code Runner extension allows people to compile a lot of file extension by using the right click menu, so here's how to use it with LaTeX:

  1. First, download Code Runner from vscode extension tab.

  2. Next, on the same page, click the little gear on the right of the uninstall button.

  3. Then, click Edit in settings.json under Executor Map by File Extension

  4. After that, add the following line before .vb or whatever comes first:

".tex": "cd $dir && latexmk -lualatex -interaction=nonstopmode -synctex=1 $fileName"

That's going to give you the exactly same thing as clicking the LuaLaTex button on the TeX menu.

You can change to -xetex or whatever you need.

In the end, the config should look like this:

"code-runner.executorMapByFileExtension": {
        ".tex": "cd $dir && latexmk -lualatex -shell-escape -interaction=nonstopmode -synctex=1 $fileName",
        ".vb": "cd $dir && vbc /nologo $fileName && $dir$fileNameWithoutExt",
        ".vbs": "cscript //Nologo",
        ".scala": "scala",
        ".jl": "julia",
        ".cr": "crystal",

Now whenever you right click a LaTeX file you should be able to use the Run Code option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.