Reputation: 303
given the following reproducible example:
---
title: "pdf output by user defined tex template"
output:
pdf_document:
template: default.latex
#bibliography: bib.bib
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# About Pandoc metadata
https://pandoc.org/MANUAL.html#variables-for-latex
# Default tex templates
https://bookdown.org/yihui/rmarkdown-cookbook/latex-template.html
The default LaTeX template of Pandoc can be found at.
https://github.com/jgm/pandoc/tree/master/data/templates (named default.latex).
If you want to create your own template, you may want to start with this template.
# A reference to be cited in bibliography
here it is: @R-base
# References
! LaTeX Error: Something's wrong--perhaps a missing \item.
on the other hand:
the template I'm using (starting from) is the default LateX template of Pandoc found at: https://github.com/jgm/pandoc/blob/main/data/templates/default.latex
the bib file is containing just the following entry:
@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},
}
my question is:
how to get a correct listing of the references in the case of a user defined "template" (which later I'm planning to customise to my needs with other variables)?
Should I enter something in the template file? And eventually how-to?
Any help much appreciated
Upvotes: 4
Views: 253
Reputation: 303
the following seems to sort out the problem:
---
title: "pdf output by user defined tex template"
output:
pdf_document:
template: default.latex
citation_package: biblatex
bibliography: bib.bib
---
without even the need to touch the default.latex
template (!)
but there is a side effect...
...the reference to a specific citation style in the YAML header through the appropriate metadata i.e. csl: apa.csl
seems not to affect the bibliography format in any way;
and now I should probably customise the template... but that's a new problem! :-(
Upvotes: 2