Citation Error on VScode Latex

Posted on Updated on

Introduction

It is because the pdflatex compiler didn’t run the bibitex. By default you need to run the bibitex to process the .bib file before compiling the latex.

To solve this problem, add the bibiTex tools to the code latex-workshop plugin and define a now recipe for compiling the latex file.

Solution

Add the `bibiTex` to the latex-workshop tools

"latex-workshop.latex.tools": [
    {
        "name": "pdflatex",
        "command": "pdflatex",
        "args": [
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "%DOCFILE%"
        ]
    },
    {
        "name": "bibtex",
        "command": "bibtex",
        "args": [
            "%DOCFILE%"
        ]
    }
],

Add the new recipe on the vscode setting.json

"latex-workshop.latex.recipes": [
    {
        "name": "pdflatex",
        "tools": [
            "pdflatex"
        ]
    },
    {
        "name": "pdflatex (w/ bib)",
        "tools": [
            "pdflatex",
            "bibtex",
            "pdflatex",
            "pdflatex"
        ]
    }
],

Leave a comment