Biblatex 无法与 VSCode 配合使用

Biblatex 无法与 VSCode 配合使用

我已经使用 Overleaf 好几年了,但我正尝试切换到在本地编译 LaTeX 文档,因为我现在要开始更大的项目,并且我希望能够自动插入图片。我有以下设置在 Overleaf 上运行良好,但我无法让它在 VSCode 上运行。任何帮助都将不胜感激!

我在 VSCode 中使用 LaTeX Workshop 扩展,并尝试使用 biblatex,但没有成功。我的操作系统是 Windows 11。

这是我的最小示例 TeX 文件:

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

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

np-breakeven.bib具有以下内容的 bib 文件在哪里:

@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},
}

我对 LaTeX Workshop 的设置是

"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"

我正在尝试通过该配方编译 PDF xelatex -> biber -> xelatex*2,但是我收到一个奇怪的错误,提示说当我使用 LaTeX Workshop 时! LaTeX Error: File 'biblatex.sty' not found.不需要文件,对吗?biblatex.sty

答案1

从您的评论中可以清楚地看出您缺少 LaTeX 发行版。因此,它无法工作,因为 VS Code 本身没有安装 TeX 引擎。

密切注意,提防,小心TeXLive或者微特克斯。我会选择前者,但这纯粹是个人喜好。

安装 TeX 之后,您的代码就可以运行了。

相关内容