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

1

4

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.

It should look like this:

In Fenner's (2012) book ...

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

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

Is there another way?

Edp answered 4/7, 2017 at 8:50 Comment(0)
M
2

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'

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

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

Mossgrown answered 23/7, 2017 at 10:2 Comment(1)
Doesn't seem to work for me. Am I in the wrong or did something change?Characharabanc

© 2022 - 2024 — McMap. All rights reserved.