backref 在 VS 代码中不起作用

backref 在 VS 代码中不起作用

我无法使引文的反向引用与 VS Code 配合使用。

下面是我的最小可重现示例,它在 overleaf 上运行良好,但在 VS Code 上运行不佳:

\documentclass{article}
\usepackage{natbib}
\usepackage[pagebackref]{hyperref}

\begin{document}
\cite{author_2018}
\bibliographystyle{plainnat} 
\bibliography{test}
\end{document}

哪里test.bib

@article{author_2018,
  title = {Title},
  author = {Example},
  year = {2018},
}

仅供参考,我在 VS Code 上进行编译pdflatex ➞ bibtex ➞ pdflatex ×2,我的 latex-workshop settings.json 如下:

{
"latex-workshop.latex.tools": [
    {
      "name": "pdflatex",
      "command": "pdflatex",
      "args": [
        "-synctex=1",
        "-interaction=nonstopmode",
        "-file-line-error",
        "--aux-directory=build",
        "%DOC%"
      ],
      "env": {}
    },
    {
      "name": "bibtex",
      "command": "bibtex",
      "args": [
        "%DOCFILE%"
      ],
      "env": {}
    }
  ],
"latex-workshop.latex.recipes": [
  {
      "name": "pdflatex ➞ bibtex ➞ pdflatex`×2",
      "tools": [
        "pdflatex",
        "bibtex",
        "pdflatex",
        "pdflatex"
      ]
    }
  ],
  "editor.minimap.enabled": false,
  "security.workspace.trust.untrustedFiles": "open",
  "latex-workshop.view.pdf.viewer": "tab",
  "window.zoomLevel": 1,
  "latex-workshop.latex.autoClean.run": "onBuilt",
  "editor.wordWrap": "on",
  "latex-workshop.latex.autoBuild.run": "never",
  "latex-workshop.message.warning.show": false,
  "latex-workshop.message.error.show": false,
  "latex-workshop.view.pdf.invertMode.enabled": "compat",
  "latex-workshop.view.pdf.invertMode.grayscale": 0,
  "latex-workshop.view.pdf.invert": 1,
  "latex-workshop.latex.recipe.default": "lastUsed",
  "latex-workshop.intellisense.biblatexJSON.replace": {
  
  },
  "latex-utilities.message.update.show": false

}

答案1

@TeddyvanJerry 的评论给出了解决方案:它可以很好地工作latexmk。(我想回复他的评论,但文本框太小,所以我在这里回复)。

准确地说,我必须删除软件包multibib,因为它似乎与不兼容。然后,我在>中添加了以下几行后backref进行了编译:latexmksettings.jsonlatex-workshop.latex.tools

{
  "name": "latexmk",
  "command": "latexmk",
  "args": [
    "-synctex=1",
    "-interaction=nonstopmode",
    "-file-line-error",
    "-pdf",
    "-outdir=%OUTDIR%",
    "%DOC%"
  ],
  "env": {}
}

并将这些放入settings.json>latex-workshop.latex.recipes

  {
    "name": "latexmk",
    "tools": [
      "latexmk"
    ]
  },  

latexmk请注意,如果该选项已建议用于编译(默认情况下是),则不必添加这些行。我需要这样做是因为我已经修改了settings.json。我更喜欢使用pdflatex ➞ bibtex ➞ pdflatex ×2而不是因为它快两倍,但现在当我需要编译最终版本时,latexmk我将切换到。latexmk

相关内容