r-markdownknitrpandoccslpandoc-citeproc

How to move superscript citation numbers inside of punctuation in Markdown file?


I am using Rmarkdown to write a paper with citations. When I use Nature's CSL (or any superscript numeric style) and render with Pandoc and pandoc-citeproc, the in line citations are outside of the punctuation. How can I move them inside the punctuation? Thanks!

Here is an example Rmd file:

---
title: "Test"
author: "Daijiang Li"
date: '`r format(Sys.time(), "%d %B, %Y")`'
output:
  bookdown::pdf_document2:
    keep_tex: yes
    latex_engine: xelatex
    number_sections: no
    toc: no
fontsize: 12pt
linestretch: 1.5
link-citations: yes
csl: https://raw.githubusercontent.com/citation-style-language/styles/master/nature.csl
bibliography: ref.bib
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
- id: fenner2012b
  title: Two-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
---

A sentence here [@fenner2012a; @fenner2012b]. How to move the subscript citation numbers before the period?

# References

Here is a screenshot of what I got when render it with rmarkdown.

enter image description here


Solution

  • It should be sufficient to add

    notes-after-punctuation: false
    

    to the YAML metadata block.