TransWikia.com

Undefined citations when use latex-workshop in VS-code, while it works well in texstudio

TeX - LaTeX Asked by S huang Song on March 28, 2021

Thanks for your attention, English is not my native language; please excuse typing errors.

I used to write my paper in latex with texstudio and I export my bibliographies by Zotero with add-in "better BibTeX". It works well since bib file can auto-update and citations keys can be compiled in the texstudio (by xelatex).

However, when I use VSCode as my tex-editor with "latex-workshop", it seems that there’s something wrong:

"message": "Citation `zhouDecelerationChinaHuman2020' on page 1 undefined.n",

I have checked the bib file and the cite key, everything is right. When I compile my tex-file, it still worked well in texstudio. Surprisingly, once it has been compiled once in Texstudio, these citations also work properly in VSCode! But when I insert new citations, similar error occurred again.

I have set VSCode following the documentation for latex-workshop but it doesn’t work:

"latex-workshop.kpsewhich.enabled": true,
"latex-workshop.intellisense.package.enabled":true,

And I have set xelatex in recipes (same as texstudio):

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

I’ve been bothered by this question for a long time and would appreciate any help someone might be able to provide!

One Answer

I discovered a solution that may help you. In the Tex section of the Latex-Workshop extension (in the most left vertical panel) it should appear the 'commands' section. Inside that section, it should appear de option 'Build Latex Projects' -> 'Recipe: pdflatex-bibtex-pdflatex x2'. If you click on that it should rebuild the bibtex database using the last .bib file, and that should solve your problem. The problem occurs because the default pdflatex building motor in VS it not automatically update de .bib file to its bibtex database; and with that problem although it can recognizes the cites in the IDE, it cannot put them in the built document.

Correct answer by madHus on March 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP