How to suppress automatic digital numbering in Rmarkdown / pandoc

I have the following Rmarkdown (.Rmd) document where I name existing .png images and create .pdf with captions. By default pandoc? automatically adds "Figure No.". before the title for each image. I see how it would be normal to do this, but in my case I would like to define it. I found variations on this topic, but didn't seem to find a solution. The following is an example of what my .Rmd file looks like:

--- title: "TITLE" author: "ME" date: "`r Sys.Date()`" output: pdf_document --- ```{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) 
+5
source share
1 answer

You can use caption package

Create a .tex file in which you specify the following: uncheck the entire label below and you can 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 in 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) 
+8
source

Source: https://habr.com/ru/post/1265601/


All Articles