How to suppress automatic figure numbering in Rmarkdown / pandoc

主宰稳场 提交于 2019-12-03 03:25:59
ErrantBard

You could use the caption-package

Create a .tex-file that you specify the following in, this below remove the entire label and you are free to hardcode the labels.

\usepackage{caption}
\captionsetup[figure]{labelformat=empty}

Then your .rmd should look like this:

---
title: "TITLE"
author: "ME"
date: "`r Sys.Date()`"
output: 
  pdf_document:
    includes:
      in_header: YourName.tex
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

![Caption for figure 1](figures/plot1.png)

\newpage

![Caption for figure 2](figures/plot2.png)

Simplified: As suggested in the comments, we can achieve this within our .Rmd file, as shown below.

---
title: "TITLE"
author: "ME"
date: "`r Sys.Date()`"
output: 
  pdf_document:
header-includes:
- \usepackage{caption}
- \captionsetup[figure]{labelformat=empty}
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

![Caption for figure 1](figures/plot1.png)

\newpage

![Caption for figure 2](figures/plot2.png)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!