仅在 RMarkdown 中引用作者/在文本引用中添加所有格

Cite author only in RMarkdown / add possessive 's to in-text citation

我想引用 RMarkdown 中的一位作者在他的名字中添加所有格。但是,我找不到没有出版年份的方法来引用作者或直接添加所有格 's.

它应该是这样的:

In Fenner's (2012) book ...

最小工作示例(针对 R Notebook):

---
title: "R Notebook"
output: html_notebook
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
---

In @fenner2012a 's book ...

# References

当然,我可以手动添加名称 (In Fenner's [-@fenner2012a] book ...),但这是一个草率的解决方法。

还有其他方法吗?

我不知道 RMarkdown,但在标准的 pandoc 中,我直接在 pandoc-citeproc 之后添加了以下过滤器。

#!/bin/bash

sed -s 's/\({"t":"Space"}\),\({"t":"Str","c":"(2013)"}]]}\),\({"t":"Str","c":"\x27s"}\)/,,/g'

这太可怕了,而且可能非常微妙(如果你在 Windows 上就不好),但它可能会让你走上正轨。

您的引文将变为 "in @fenner2012a's book"。