【问题标题】:R Markdown: Citation parsingR Markdown:引文解析
【发布时间】:2015-12-15 13:03:22
【问题描述】:

我正在尝试在我的 R Markdown 文档中排版引文,但在某些情况下似乎没有正确解析引文,特别是当引文出现 : 时,例如 [@ref1]: 和后面的一些文本.

这是一个 MWE:

---
title: Citations Parsing
references:
- id: fenner2012a
  title: One-click science marketing
  author:
  - family: Fenner
    given: Martin
  container-title: Nature Materials
  volume: 11
  URL: 'http://dx.doi.org/10.1038/nmat3283'
  DOI: 10.1038/nmat3283
  issue: 4
  publisher: Nature Publishing Group
  page: 261-263
  type: article-journal
  issued:
    year: 2012
    month: 3
---

1. [@fenner2012a]: Here is some text. **This does not work.**
2. [@fenner2012a]:
3. [@fenner2012a] : Here is some text. **This works.**

我使用的是来自 CRAN (0.8.1) 的最新版本的 rmarkdown。请注意,在上面的示例中,#2 也有效。正是当您使用文本追赶: 时,引用停止呈现。

编辑:

这也很可能是knitr 问题。我正在使用 CRAN (1.11) 的最新版本 knitr。

【问题讨论】:

    标签: r knitr r-markdown


    【解决方案1】:

    看起来knitr 正在尝试解析整个引用,包括分号。要停止它,请使用 \ 转义冒号:

    [@fenner2012a]\: Here is some text. **This works now.**
    

    【讨论】:

    • 确实出乎意料,但我不确定我会称之为错误
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多