I am trying to use Rmarkdown to automatically label Figure's caption, but instead of counting Figure 1
, I want it to be Figure S1
, i.e. just adding S
there. An example here and here suggests that this is not possible using pdf output. Ok, I am fine with .doc file, but still my figure caption is not print out? I wonder what could be wrong?
Minimal example for R markdown:
---
title: Supporting Information
subtitle: "Iron(I) etc"
author: "Some people here"
abstract: "Added the addresses here since there is no abstract in the SI"
output:
word_document:
fig_caption: yes
---
```{r, include=F}
library(captioner)
figS<- captioner(prefix = "Figure S", auto_space = TRUE, levels = 1, type = NULL, infix = ".")
figS("Figure S1", "Single-crystal X-ray structure of some text (1)", display=FALSE)
```
```{r Xray, fig.cap=figS("This is my figure description"), echo=FALSE}
plot(cars)
```
This prints correctly out Figure S1
. But, now my actual figure description is missing?
My desired output is pdf, but if not, I can do with word. Thanks for suggestion how to fix this!