仅在RMarkdown中引用作者/在文本引用中添加所有格 [英] Cite author only in RMarkdown / add possessive 's to in-text citation

查看:79
本文介绍了仅在RMarkdown中引用作者/在文本引用中添加所有格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想引用RMarkdown中的一位作者,在他的名字前添加一个所有格.但是,在找不到出版年份或直接添加所有格的情况下,我找不到找到作者的方法.

I'd like to cite an author in RMarkdown adding a possessive 's to his name. However, I cannot find a way to cite the author without the year of publication or to directly add a possessive 's.

它应该看起来像这样:

在芬纳(2012)的书中...

In Fenner's (2012) book ...

最小工作示例(用于R笔记本):

Minimal Working Example (for a 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

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

Of course, I could add the name manually (In Fenner's [-@fenner2012a] book ...) but this is a sloppy workaround.

还有其他方法吗?

推荐答案

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

I don't know about RMarkdown, but in standard pandoc I've added the following filter directly after pandoc-citeproc.

#!/bin/bash

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

这太可怕了,而且可能非常微妙(如果在Windows上也不是一件好事),但它可能会使您走上正轨.

It is horrible, and probably very delicate (and no good if you're on Windows), but it might put you on the right track.

您的引用将变成在@ fenner2012a的书中".

Your citation would become "in @fenner2012a's book".

这篇关于仅在RMarkdown中引用作者/在文本引用中添加所有格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆