Long figure caption causing footnote to skip a number in RMarkdown file (PDF/Latex)

205 views Asked by At

Having a long figure caption in an Rmarkdown file is causing the footnote numbering to skip a number:


---
title: "Untitled"
output: pdf_document
date: "2023-02-27"
---


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

This is a sentence with a footnote \footnote{Footnote 1}.

```{r fig1, echo=FALSE, warning=FALSE, message=FALSE,out.width="50%", fig.cap="This is a long figure caption. This is a long figure caption. This is a long figure caption. This is a long figure caption. \\protect\\footnotemark"}

plot(mtcars$mpg)
```

\footnotetext{Footnote 2}

This is a sentence with a third footnote \footnote{Footnote 3}.

This causes it to skip footnote 2:

Rmarkdown output displaying a skipped footnote number

Bottom of Rmarkdown file displaying a skipped footnote number

This does not happen with shorter figure captions. Is this a bug, or is there a way around this?

0

There are 0 answers