0

I have been using Overleaf for several years, but I am trying to switch to compiling LaTeX documents locally as I am starting much larger projects now and I would like to be able to insert figures automatically. I have the following setup which works perfectly fine on Overleaf, but I am unable to get it to work on VSCode. Any help would be greatly appreciated!

I am using the LaTeX Workshop extension in VSCode and I am trying to use biblatex without success. My operating system is Windows 11.

Here is my minimum example TeX file:

\documentclass{article}
\usepackage[backend=biber]{biblatex}
\addbibresource{np-breakeven.bib}

\begin{document}
Hello \cite{banzhaf_bundling_2022}
\printbibliography
\end{document}

where np-breakeven.bib is the bib file with the following content:

@article{banzhaf_bundling_2022,
    title = {Bundling Private Complements to Finance Public Goods},
    volume = {98},
    issn = {0023-7639, 1543-8325},
    url = {http://le.uwpress.org/lookup/doi/10.3368/le.98.3.082621-0099},
    doi = {10.3368/le.98.3.082621-0099},
    pages = {440--460},
    number = {3},
    journaltitle = {Land Economics},
    shortjournal = {Land Economics},
    author = {Banzhaf, H. Spencer and Smith, V. Kerry},
    urldate = {2023-07-17},
    date = {2022-08},
    langid = {english},
    file = {Banzhaf and Smith - 2022 - Bundling Private Complements to Finance Public Goo.pdf:C\:\\Users\\wmrobin3\\Zotero\\storage\\LDTY6SY6\\Banzhaf and Smith - 2022 - Bundling Private Complements to Finance Public Goo.pdf:application/pdf},
}

My settings for LaTeX Workshop are

"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%.tex"
            ]
        },
        {
            "name": "bibtex",
            "command": "bibtex",
            "args": [
                "%DOCFILE%"
            ]
        },
        {
            "name": "biber",
            "command": "biber",
            "args": [
                "%DOCFILE%"
            ]
        },
        {
            "name": "xelatex",
            "command": "xelatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOC%"
            ]
        }
    ],

    "latex-workshop.latex.recipes": [
        {
            "name": "pdflatex",
            "tools": [
              "pdflatex"
            ]
        },
        {
            "name": "xelatex -> biber -> xelatex*2",
            "tools": [
                "xelatex",
                "biber",
                "xelatex",
                "xelatex"
            ]
        }
      ],

      "latex-workshop.intellisense.citation.backend": "biblatex"

and I am trying to compile the PDF through the recipe xelatex -> biber -> xelatex*2 but I am getting a weird error that says ! LaTeX Error: File 'biblatex.sty' not found. but there should be no need for a biblatex.sty file when I am using LaTeX Workshop, right?

7
  • You are loading biblatex.sty in your document with the line \usepackage[backend=biber]{biblatex}. Somehow the package can't be found on your system. This has, most likely, nothing to do with VS Code, you could try compiling your document on the command line to check if the error occurs there too
    – DG'
    Commented Oct 12, 2023 at 21:06
  • Welcome. Run kpsewhich biblatex.sty from your terminal/commandline. Does it find the file? If not, there might be a problem with your $PATH. Maybe your TeX distro wasn't set up correctly. What OS are you running and which TeX distro do you use? BTW there is no need to run xelatex if you don't load system fonts etc. (of course, it neither should throw an error)
    – lukeflo
    Commented Oct 12, 2023 at 21:14
  • @DG' I get the same error when compiling the document from the command line. This suggests that it is not an error with VS Code or the extension, correct?
    – RobinsonWM
    Commented Oct 12, 2023 at 21:21
  • @lukeflo When I run this in the terminal I get no result. This suggests that the file biblatex.sty is missing, right? I am using Windows 11 (I updated the question to reflect this) but I don't know how to identify the TeX distro. How do I do this?
    – RobinsonWM
    Commented Oct 12, 2023 at 21:23
  • 1
    OK. Then it can not work. You need to install a Latex distro. Latex Workshop is just an extension for VS Code which offers code highlighting, auto completion etc. but not the software (La)TeX itself.
    – lukeflo
    Commented Oct 12, 2023 at 21:31

1 Answer 1

1

From your comments its clear you're missing a LaTeX distro. Thus, it cannot work since VS Code doesn't install the TeX engine itself.

Look out for TeXLive or MiKTeX. I would go with the former, but that's purely personal preference.

After you've installed TeX, you're code should work.

2
  • 1
    This solved the issue I was having. Thank you.
    – RobinsonWM
    Commented Oct 13, 2023 at 15:29
  • 1
    Happy that I could help. Have fun TeXing!
    – lukeflo
    Commented Oct 13, 2023 at 16:12

You must log in to answer this question.

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