首页 > 解决方案 > 在 natbib 中编译带有引用的 .Rnw 文件时,RStudio 不会写入 .bbl 文件

问题描述

我在 RStudio 中有一个带有引用的 .Rnw 文件(Test.Rnw)。.bib 文件与 .Rnw 文件位于同一文件夹中,但是当我编译 .Rnw 文件时,没有写出 .bbl 文件,并且出现错误:

There were undefined citations

并检查日志,我发现,正如预期的那样:

No file Test.bbl

这是我要编译的代码:

\documentclass[12pt, oneside]{article}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{graphicx}
\usepackage{float}
\usepackage[sort,comma,numbers,super]{natbib}
\usepackage{url}
\usepackage{enumitem}
\usepackage[utf8]{inputenc}
\usepackage[letterpaper, top=1in, bottom=1in, right=1in, left=1in]{geometry}

\begin{document}

\title{Analysis}
\author{Amanda E. Gentry}
\date{April 7, 2019}
\maketitle

\section{Introduction}
Some text\citep{Hoerl70}. More text\citep{Tibshirani96}. Even more text\citep{Zou05}.

Code section below:
<<loading, echo=FALSE, eval=TRUE, message=F, warning=F>>=
x <- seq(1:10)
summary(x)
@

\bibliography{Refs}
\bibliographystyle{plain}

\end{document}

我在网上搜索了答案,但没有找到与此问题直接相关或到目前为止如何解决它的任何内容。

有趣的是,相同的代码将在 RStudio 版本 1.1.143(我已安装在另一台机器上)中正确编译,但不会在最新版本的 RStudio 或任何旧版本(返回大约 3 个版本)和 1.1 中编译.143 不是当前可供下载的存档版本。

到目前为止,我已将此问题发布到 RStudio 社区委员会,但运气不佳。

编辑:这是我正在使用的 .bib 文件

@Article{Hoerl70,
  author={Arthur E. Hoerl and Robert W. Kennard},
  title={Ridge Regression: Biased Estimation for Nonorthogonal Problems},
  journal={Technometrics},
  volume={12},
  number={1},
  year={1970},
  pages={55-67}
}

@article{Tibshirani96,
    author={Robert Tibshirani},
    title={Regression Shrinkage and Selection via the Lasso},
    journal={Journal of the Royal Statistical Society, Series B},
    volume={58},
    number={1},
    year={1996},
    pages={267-288}
    }

@Article{Zou05,
  author={Hui Zou and Trevor Hastie},
  title={Regularization and variable selection via the elastic net},
  journal={Journal of the Royal Statistical Society Series B-Statistical Methodology},
  volume={67},
  number={Part 2},
  pages={301-320},
  year={2005}
}

这是错误消息的屏幕截图:

错误信息

标签: rlatexrstudioknitrsweave

解决方案


推荐阅读