Rmarkdown和带有圆形括号的Latex格式引用

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

我觉得这是直截了当的事情,但是我发现的一切并不能完全满足我的需求。我正在使用并编织到 .pdf。我想在本文中引文的括号为round (),而不是括号。下面的使用references.bib文件正确导入引用。我可以做些什么来轻松地将圆括号更改为圆形吗?

---
title: "Title"
author: "Author"
date: "16/03/2020"
output: 
  pdf_document:
    fig_caption: yes
    citation_package: natbib
  bibliography: references.bib  
editor_options: 
  chunk_output_type: console
---

我已使用方法here,但它返回错误:

Error in yaml::yaml.load(..., eval.expr = TRUE) : 
  Parser error: while parsing a block mapping at line 6, column 5 did not 
  find expected key at line 7, column 30`

    ---
    title: "Title"
    author: "Author"
    date: "16/03/2020"
    output: 
      pdf_document:
        fig_caption: yes
      bibliography: references.bib  
    editor_options: 
      chunk_output_type: console
    \usepackage[round]{natbib}
    ---

有什么想法吗?感谢您的建议/想法...

r latex r-markdown citations
1个回答
0
投票

您试图在rmarkdown标头中包含\usepackage[round]{natbib}的问题是rmarkdown似乎不够灵巧,无法解析带有可选参数的命令。可以通过将命令隐藏在.tex文件中来欺骗它

---
title: "Title"
author: "Author"
date: "16/03/2020"
output: 
  pdf_document:
    fig_caption: yes
    includes:
      in_header: preamble.tex
bibliography: references.bib  
---

test [@knuth]

带有preamble.tex

\usepackage[round]{natbib}

enter image description here

https://rstudio.cloud/project/1061588

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