【问题标题】:R Markdown: place an Appendix after the "References" section?R Markdown:在“参考”部分之后放置一个附录?
【发布时间】:2020-01-30 21:45:29
【问题描述】:

我正在使用 R Markdown 编写一份报告,其中包含参考资料。问题是 R markdown 会自动将引用放在报告的末尾。我想在参考文献后面加一个附录,有什么办法吗?我看到a child document 可以实现,但我希望将所有内容都放在一个独特的.Rmd 文件中。

下面是一个可重现的例子:

---
title:
author:
date: 
abstract: 

output: 
  pdf_document:
    template: NULL
    number_sections: true
    citation_package: biblatex
bibliography: references.bib
biblio-style: bwl-FU
---

# Partie 1

\cite{greenwood_financial_1989}

<!-- where I would like the references to be -->

# Appendix

bla bla 

这是references.bib文件的内容:

@article{greenwood_financial_1989,
  title = {Financial Development, Growth and the Distribution of Income},
  url = {https://www.nber.org/papers/w3189},
  number = {3189},
  journaltitle = {NBER Working Paper Series},
  date = {1989},
  author = {Greenwood, Jeremy and Jovanovic, Boyan}
}

有什么想法吗?

【问题讨论】:

    标签: r r-markdown


    【解决方案1】:

    R Markdown Cookbook(第 3.5.4 节)对此进行了解释。我们可以强制参考书目在特定位置打印:

    # References
    
    <div id="refs"></div>
    
    # Appendix
    

    注意:

    • 如果我们用@id_of_paper(这是R Markdown 中推荐的方式)引用论文,但不能用\cite{id_of_paper} 引用论文,则此方法有效。
    • 如果我们在 YAML 中使用 citation_package: biblatex,这将不起作用

    这是我改编的例子:

    ---
    title:
    author:
    date: 
    abstract: 
    output: 
      pdf_document:
        template: NULL
        number_sections: true
    bibliography: references.bib
    biblio-style: bwl-FU
    ---
    
    # Partie 1
    
    @greenwood_financial_1989
    
    
    # References
    
    <div id="refs"></div>
    
    
    # Appendix
    
    bla bla 
    

    【讨论】:

      【解决方案2】:

      如果使用

      citation_package: biblatex
      

      您可以在任意点使用参考书目

      \printbibliography
      

      这本身并不会阻止 pandoc 添加(进一步的)文档结尾参考书目,但由于 pandoc 在非乳胶输出中忽略乳胶,我们可以通过重新定义 \printbibliography 来抑制它。

      所以试试这个,对于附录之前的参考部分:

      # References
      
      <div id="refs"></div>
      \printbibliography[heading=none]
      \def\printbibliography{}
      
      # Appendix 1
      
      Appendix goes here, and is not followed by a bibliography.
      

      【讨论】:

        猜你喜欢
        • 2023-03-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-08-02
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多