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:
This does not happen with shorter figure captions. Is this a bug, or is there a way around this?