Reputation: 1187
Consider the following:
\documentclass[12pt]{article}
\usepackage{natbib}
\usepackage[margin=1in]{geometry}
\begin{document}
<<setup, include = FALSE, echo = FALSE>>=
Sys.setenv(TEXINPUTS = getwd(),
BIBINPUTS = getwd(),
BSTINPUTS = getwd())
@
Some text \citet{brockwelldavis}
\newpage
\nocite{*}
\bibliographystyle{jasa}
\bibliography{test}
\end{document}
@book{brockwelldavis,
author = {Brockwell, Peter J. and Davis, Richard A.},
year = 2016,
title = "Introduction to Time Series and Forecasting",
editor = "",
publisher = "Springer International Publishing",
address = "Switzerland"
}
This file can be found at either https://github.com/merliseclyde/AAIS/blob/master/jasa.bst or https://github.com/auk12/MSc-Thesis-backup/blob/master/Bibliography/jasa.bst.
In RStudio, when I hit "Compile PDF" using test.rnw
, I get
output file: test.tex
[1] "test.tex"
Running pdflatex.exe on test.tex...failed
Issues: 2 warnings
and from the log file:
Package natbib Warning: Citation `brockwelldavis' on page 1 undefined on input
line 58.
[1
{C:/Users/[my name]/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}]
No file test.bbl.
Package natbib Warning: There were undefined citations.
So, I run test.tex
created from test.rnw
using pdfLaTeX + MakeIndex + BibTeX in TeXworks, and test.bbl
is created. Interestingly, test.pdf
compiles correctly and can be viewed through TeXworks. I can clearly both the .bbl and .pdf files using Windows Explorer.
But when I hit "Compile PDF" in RStudio after compiling through TeXworks, I still get the same warning as above. Anyone have any insight as to how to fix this?
What's also baffling is that on my old computer, test.rnw
compiles fine without having to use TeXworks as an intermediate step and on my new computer, it does not. The only difference I can think of is that perhaps my new computer has more updated versions of R and MikTeX. I also tried uninstalling and reinstalling MikTeX on my new computer and still ran into the same problem.
From R (using RStudio 1.2.5033):
> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.6.3 tools_3.6.3
Through the Windows command prompt:
> pdftex --version
MiKTeX-pdfTeX 2.9.7338 (1.40.21) (MiKTeX 2.9.7380 64-bit)
Copyright (C) 1982 D. E. Knuth, (C) 1996-2020 Han The Thanh
TeX is a trademark of the American Mathematical Society.
using bzip2 version 1.0.6, 6-Sept-2010
compiled with curl version 7.61.1; using libcurl/7.61.1 WinSSL
compiled with expat version 2.2.6; using expat_2.2.6
compiled with jpeg version 9.3
compiled with liblzma version 50020042; using 50020042
compiled with libpng version 1.6.37; using 1.6.37
compiled with libressl version LibreSSL 2.8.2; using LibreSSL 2.8.2
compiled with MiKTeX Application Framework version 4.7348; using 4.7348
compiled with MiKTeX Core version 16.7375; using 16.7375
compiled with MiKTeX Archive Extractor version 1.6882; using 1.6882
compiled with MiKTeX Package Manager version 9.7364; using 9.7364
compiled with poppler version 0.60.1
compiled with uriparser version 0.9.2
compiled with zlib version 1.2.11; using 1.2.11
From R (using RStudio 1.2.5001):
> sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.6.2 tools_3.6.2
Through the Windows command prompt:
> pdftex --version
MiKTeX-pdfTeX 2.9.6050 (1.40.17) (MiKTeX 2.9 64-bit)
Copyright (C) 1982 D. E. Knuth, (C) 1996-2016 Han The Thanh
TeX is a trademark of the American Mathematical Society.
compiled with zlib version 1.2.8; using 1.2.8
compiled with libpng version 1.6.24; using 1.6.24
compiled with poppler version 0.46.0
compiled with jpeg version 8.4
Both are using knitr and pdfLaTeX based on Tools > Global Options > Sweave in RStudio.
Upvotes: 3
Views: 1366
Reputation: 30114
This has finally be resolved in the RStudio IDE, and the fix will appear in the patch release after RStudio 1.4, which is not available yet. Currently you have to use the daily build of RStudio: https://dailies.rstudio.com
In Tools -> Global Options
, you can check the box "Use tinytex when compiling .tex files":
Then the bibliography should be compiled correctly.
Upvotes: 1
Reputation: 51
I had a similar problem, on Windows. I tried to use R-studio and Miktex, but bibliographic citations were not generated. I installed TinyTex but it was in conflict with Texmaker. Solution: I installed the full Texlive. Everything working now.
RStudio (1.3.959), R (4.0.2), Texlive (2020-r55535), Texmaker 5.0.4, Windows 10 x64 single language.
Upvotes: 0