Is anyone else having issues with \FloatBarrier in Rmarkdown

Viewed 1097

If I use \FloatBarrier to maintain the desired order of the document, I get the following error and can't knit the PDF (specifically happens with PDF). It worked probably six months ago.

! Undefined control sequence.
l.128 \FloatBarrier
                    \#\# Of Officer Initiated Stops, how does the race of the 

Error: LaTeX failed to compile more_effective_policing.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See more_effective_policing.log for more info.

A reproducible example: *Note: I just open up a default Rmarkdown, and then I add \FloatBarrier to it. Then I try to knit as a PDF.

---
title: "knit"
author: "James Ades"
date: "6/9/2021"
output:
  pdf_document: default
  html_document: default
---

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


## R Markdown

This is an R Markdown document...

{r cars}
summary(cars)


## Including Plots

You can also embed plots, for example:


{r pressure, echo=FALSE}
plot(pressure)

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.

\FloatBarrier

1 Answers

You have to load the placeins package if you want to use one of its macros:

---
title: "knit"
author: "James Ades"
date: "6/9/2021"
output:
  pdf_document: 
    keep_tex: true
  html_document: default
header-includes:
  \usepackage{placeins}
---

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


## R Markdown

This is an R Markdown document...

{r cars}
summary(cars)


## Including Plots

You can also embed plots, for example:


{r pressure, echo=FALSE}
plot(pressure)

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.

\FloatBarrier
Related