33

I want to use the VS Code extension LaTeX Workshop and I want to set up my own recipe for compiling the documents. The FAQ's are good but missing the part where they tell where the recipes are stored and where to put your custom recipe. Could someone help me out on that?

3 Answers 3

31

Assume that you have to make a recipe that uses pdflatex once only, not pdflatex > biblatex > pdflatex > pdflatex.

In settings.json:

  • Add this to "latex-workshop.latex.recipes":

    {
        "name": "pdflatex",
        "tools": [
          "pdflatex"
        ]
    }
    
  • Add this to "latex-workshop.latex.tools" if it is not present:

    {
        "name": "pdflatex",
        "command": "pdflatex",
        "args": [
            "--shell-escape", // if you want to have the shell-escape flag
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "%DOC%.tex"
        ]
    }
    

Don't forget to add the .tex after "%DOC%".

4
  • Thanks @JouleV that solved my problem. Still I have no idea about the recipe but, I could remove latexmk from the tool chain, can compile my pdf now. In addition I learned something new about how to use VS code. Double thx :) Commented Mar 11, 2019 at 13:36
  • 1
    Actually I am wondering why someone wanted to use pdflatex > biblatex > pdflatex > pdflatex. What would be the benefit? Commented Mar 11, 2019 at 13:43
  • @FuzzyTemper Well, you should not remove latexmk. As for the second recipe: look at the amazing use of BibLaTeX.
    – user156344
    Commented Mar 11, 2019 at 14:03
  • 3
    @user156344 and how do you use the newly created recipe in VS Code?
    – Vladimir
    Commented Jul 23, 2019 at 13:43
6

Here is how I entered in settings.json and it worked well. Thanks user156344.

{
    "workbench.colorTheme": "Noctis",
    "editor.fontFamily": "'Droid Sans Fallback', 'Droid Sans Mono', 'monospace', monospace",
    "editor.fontSize": 20,
    "files.autoSave": "afterDelay",
    "files.autoSaveDelay": 5000,
    "latex-workshop.view.pdf.viewer": "tab",
    "latex-workshop.latex.tools": [
        {
            "name": "pdflatex",
            "command": "pdflatex",
            "args": [
                "--shell-escape", // if you want to have the shell-escape flag
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOC%"
            ]
        }
    ],
    "latex-workshop.latex.recipes": [
        {
            "name": "pdflatex",
            "tools": [
                "pdflatex"
            ]
        }
    ]
}
1
  • I get the error chktex could not be found with this recipe
    – Clerni
    Commented Oct 12, 2021 at 9:29
4

To edit recipes you should go on the Code Tab (from the name of the program, Visual Studio Code), then Preferences, and from there Settings. Open the tree for the Extension settings and you will find your LaTeX (Workshop) settings. Click on "Edit in settings.json" and you will see the file opened for your edits.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .