R markdown 中参考文献的定位

问题描述 投票:0回答:1

我希望我的参考文献准确地放置在我想要的位置,我在 yaml 中使用参考书目命令: 我有 bibtex 格式的引文,并加载了 csl apa 格式。然而,参考文献在最后出现,我希望它们出现在我有标题#References的地方。

这是我的yaml

output:
  pdf_document: null
  latex_engine: xelatex
  word_document: default
toc: false
keep_tex: true
number_sections: false
mainfont: Times New Roman
fontsize: 12pt
header-includes:
- \usepackage{fancyhdr}
- \usepackage{booktabs}
- \usepackage{tabu}
- \pagestyle{fancy}
- \usepackage{titling}
- "\\definecolor{yellow-orange}{rgb}{1, 0.64, 0}"
- "\\pretitle{\\begin{flushleft}\\fontsize{40}{180}\\selectfont\\textcolor{yellow-orange}}"
- \posttitle{\end{flushleft}}
- \usepackage{xcolor}
- \usepackage{tcolorbox}
- \tcbuselibrary{skins}
- \usepackage{setspace}
- \setstretch{1.5}
- \usepackage{lmodern}
- \usepackage[T1]{fontenc}

always_allow_html: true

editor_options:

  markdown: null

  wrap: 72

bibliography: bibliografia.bib

csl: apa.csl

reference_section_title: "Referencias Bibliográficas"
r r-markdown rstudio bibtex bibliography
1个回答
0
投票

[Pandoc 用户指南}(https://pandoc.org/MANUAL.html#placement-of-the-bibliography) 中的相关部分:

如果样式需要引用的作品列表,它将被放置在带有 id refs 的 div 中(如果存在):

::: {#refs}
:::

否则,它将被放置在文档的末尾。

因此你的 R Markdown 可能看起来像这样

---
title: "Control Bibliography Placement"
output: pdf_document
date: "2024-05-06"
csl: "apa.csl"
bibliography: "mybib.bib"
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

# Before

This content comes before the bibliography.

# My Bibliography Header

::: {#refs}
:::

# After

This content comes after the bibliography.

注意,设置

reference-section-title
似乎仅在不移动参考书目位置时才起作用。相反,您可以在 refs div 块之前放置一个标头,如本例所示。

© www.soinside.com 2019 - 2024. All rights reserved.