compilation failure caused by bibliography in Rstudio

I do apologise if this is a stupid question. Hope you can help out!

Problem

I just want to cite in .Rmd, but the output latex file can't be compiled normaly however hard I try.
this is the yaml:

---
title: "test cross-refering"
author: "name"
date: "date"
output:
  bookdown::pdf_document2: 
    keep_tex: true
    keep_md: true
    includes:
      in_header: extarticle.tex
toc: true
toc-depth: 3
fontsize: 12pt
documentclass: extarticle
bibliography: testref.bib
geometry: margin=1in
numbersections: true
header-includes: \setlength{\parindent}{2em}
mathspec: true
abstract: abstract
---

the .bib is like this :

@Manual{R-base,
  title = {R: A Language and Environment for Statistical
           Computing},
  author = {{R Core Team}},
  organization = {R Foundation for Statistical Computing},
  address = {Vienna, Austria},
  year = {2019},
  url = {https://www.R-project.org},
}

which is copied from a tutorial.

But it results in :

! LaTeX Error: Lonely \item--perhaps a missing list environment.

while the output .tex is like this (Error part):

\phantomsection\label{refs}
\begin{CSLReferences}{1}{0}
\bibitem[\citeproctext]{ref-R-base}
R Core Team. 2019. \emph{R: A Language and Environment for Statistical Computing}. Vienna, Austria: R Foundation for Statistical Computing. \url{https://www.R-project.org}.

\end{CSLReferences}

It seems texlive is not able to compile this part. Obviously, it looks not very neat and normal like a common bibliography itself. Pandoc did it and I don't know why the error.

I have changed the bib file several times but it still does not work. How can I cite in R markdown correctly and efficiently?

I can't thank you enough for giving me some suggestions! :laughing:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.