You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

R Markdown中参考文献位置自定义设置问题

解决方法

1. 修正YAML配置的语法错误

你当前的YAML里pdf_document的参数写法有误,会导致部分设置不生效。需要把latex_engine、keep_tex等参数缩进,放到pdf_document的子项里,同时调整参考文献标题相关设置:

output:
  pdf_document:
    latex_engine: xelatex
    keep_tex: true
  word_document: default
toc: false
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"

2. 在指定位置插入参考文献容器

在你希望显示参考文献的位置,先手动添加自定义标题,然后插入::: {#refs}代码块(无需填写内容):

# Referencias Bibliográficas
::: {#refs}
:::

这样pandoc会自动把APA格式的参考文献渲染到这个容器位置,而非默认的文档末尾。


内容的提问来源于stack exchange,提问作者david garcia sanchez

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 01:45:09