With a bib.bib file:
@article{mycite,
title = {title},
author = {author name},
pages = {45-50},
year = {2020},
url = {https://example.com}
}
and an index.rmd file like this:
---
title: title
author: author
bibliography: bib.bib
output:
pdf_document:
latex_engine: xelatex
---
lorem \autocite[48]{mycite}
I get an error when compiling (using Rscript -e "rmarkdown::render('index.rmd')"):
! Undefined control sequence.
l.70 lorem \autocite
[48]{mycite}
Error: LaTeX failed to compile index.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See index.log for more info.
Execution halted
(Lorem @mycite, on the other hand, works.)
How to make citing with LaTeX aware of the bib.bib file?
Same question when using a csl file to change citation style:
---
csl: chicago-fullnote-bibliography-with-ibid.csl
---
Are csl files and LaTeX compatible?
EDIT: A possible solution:
---
title: title
author: author
bibliography: bib.bib
output:
pdf_document:
latex_engine: xelatex
pandoc_args: ["--biblatex"]
header-includes:
- \usepackage[]{biblatex} # \userpackage[]{biblatex-chicago} instead of csl file
---
lorem \autocite[48]{mycite}
Compiles with these warnings:
Warning message:
LaTeX Warning: There were undefined references.
Package biblatex Warning: Please rerun LaTeX.
(biblatex) Page breaks have changed.
Note: this question is different from Using biblatex with R Markdown as the errors in that question stem from loading the same package twice. But a possible answer has been found from the question itself. Furthermore, the question uses bookdown which requires familiarity with it.

pandoc-citeprocand\autociteis a biblatex command, so you must ensure, that you are using biblatex instead of bibtex. See: https://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.htm – DG' May 16 '20 at 17:04\cite[48]{mycite}doesn't work. Errors out with:
– simohamed May 16 '20 at 17:07Warning message: LaTeX Warning: Citation 'mycite' on page 1 undefined on input line 70. LaTeX Warning: There were undefined references.pandoc-citeprocsupports several citation/bibliography backends. One of them isbiblatex, but another one just uses CSL files to generate the citations and bibliography and does not involve LaTeX in the citation processing. I don't know about the default, but as far as I understand you are getting rid of LaTeX's involvement in citations and the bibliography at the very latest when you start using.cslfiles. – moewe May 16 '20 at 17:20How to make citing with LaTeX aware of the bib.bib file?is very clear in terms of what you actually want to achieve and with which tooling. – TeXnician May 17 '20 at 08:13