I use LaTex to compile documents in Rstudio, and use the 'natbib' package for bibliographies. My university upgraded all computers to Windows 10 a couple months ago. After the change, I reinstalled R (version 3.6.2), Rstudio, and MikTex (version 2.9), and updated packages. I have had trouble compiling documents ever since. Most pertinently, when I open a .Rnw with citations in it and hit the "Compile PDF" button in Rstudio, it usually fails, even if the document and associated .bib file are error-free. The errors in the log read "Package natbib warning: citation 'xxx' on page x undefined on input line xxx", and "No file dissertation.bbl. Package natbib Warning: There were undefined citations."
It would seem that this .bbl file isn't getting written by whatever process is initiated after I hit the "Compile PDF" button perhaps? However, for a .Rnw titled 'test_for_latex_stackexchange_post.Rnw', if I run the commands
Sweave('test_for_latex_stackexchange_post.Rnw') system("latex test_for_latex_stackexchange_post") system("bibtex test_for_latex_stackexchange_post") system("latex test_for_latex_stackexchange_post") system("latex test_for_latex_stackexchange_post")
(indeed running the final "latex " command twice), the "Compile PDF" button will (usually) work. I've tried a lot of stuff I've found in other posts, and while it seems to be better than it was when I first reinstalled everything after the Windows 10 upgrade, I am not satisfied. I want the "Compile PDF" button to work properly all the time.
A sample .Rnw, with all associated auxiliary files that were written after a successful compile using the commands in the code chunk above (contained in the file 'test_for_latex_stackexchange_post.R') and a .bib (and assoicated .bst file, which I don't really understand) are in a Google Drive folder at
Perhaps this isn't useful if the log file doesn't contain all the original errors. Any guidance anyone might provide would be greatly appreciated, and I will gladly provide additional information if necessary. I am a latex infant.