James-Yu / LaTeX-Workshop

Boost LaTeX typesetting efficiency with preview, compile, autocomplete, colorize, and more.
MIT License
10.72k stars 535 forks source link

LaTeX-Workshop warnings in citations that are present (using %!TEX root) #734

Closed gandalfsaxe closed 6 years ago

gandalfsaxe commented 6 years ago

Description

If I cite a reference from a .bib file in a file that points to a master tex file with %!TEX root = master.tex, then I get warnings of citation being undefined. However it builds fine to the PDF with no reference issues.

How to reproduce

  1. Have a library.bib file with an item called test
  2. Have a master.tex file with the line \include{chapter.tex} and \addbibresource{library.bib}
  3. Have a file chapter.tex with line on top: %!TEX root = master.tex
  4. In chapter.tex use command \cite{test} and receive warning.

Expected behavior

No warning on undefined citation.

Actual behavior

Warning on undefined citation.

James-Yu commented 6 years ago

Warnings about bibitem are generated by your latex compile in the latex log. The extension does not explicitly parse bib files for warnings.

gandalfsaxe commented 6 years ago

Ok. Any suggestions of how this situation can be solved then? The thing is, it didn't happen with SublimeText with LaTeXTools extension.

James-Yu commented 6 years ago

Can you please provide a minimal working example? The above description seems not sufficient to reproduce the problem. Please include your recipe settings too.

gandalfsaxe commented 6 years ago

Hmm I'm having trouble reproducing it in a barebones minimal example myself. I'll dig deeper when I have time and write back here what the problem was / is.

gandalfsaxe commented 6 years ago

It's not a minimal example, but here is the project if you want to give it a spin: https://transfer.sh/CPdjU/citation-error.zip

There are tons of "citation undefined" error, despite the PDF file containing all references correctly.

gandalfsaxe commented 6 years ago

Actually this is a somewhat minimal example; it's the template which many of the students at my university uses for their Bsc/MSc/PhD theses: https://bitbucket.org/_laursen/laursens-xelatex-thesis-template/downloads/

If you download it and run it as-is, then it complains that some references are not found, even though that clearly not the case.

gandalfsaxe commented 6 years ago

As I mentioned this does not happen in Sublime's LaTeXTools extension, so something must be up.

gandalfsaxe commented 6 years ago

Here is the output in VSCode using LaTeX-Workshop, after running twice:

image

Here is the output in SublimeText 3 using LaTeXTools, after running twice:

image

I.e. only LaTeX-Workshop for VSCode gives errors of undefined reference. This is the just downloading the template I mentioned and running it out of the box.

What is the cause of this? Can it be fixed? Any suggestions?

gandalfsaxe commented 6 years ago

If I mouse over the so-called "undefined reference" it even pulls in information about it from the .bib file! So obviously it can see the reference. What is going on?

image
gandalfsaxe commented 6 years ago

Solved, see #764.