2

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

James
  • 459
  • 2
  • 14
  • [See here](https://stackoverflow.com/q/5963269/5325862) on making a reproducible example that is easier for folks to help with. There isn't very much information here – camille Jun 09 '21 at 20:01
  • Thanks, Camille, totally aware of what a reproducible example is. One could essentially create a markdown, put \FloatBarrier in it and try to knit that as a PDF, and get a reproducible example. – James Jun 09 '21 at 20:27
  • 1
    @James Then please add such a small document, including a header, in your question. – samcarter_is_at_topanswers.xyz Jun 09 '21 at 20:36
  • Okay, added to question. – James Jun 09 '21 at 20:47
  • 1
    Latex can be hard to debug, especially when you might have packages loaded in the header (or need to have them loaded, but don't). Without an example, there was no way to know how you were using this command, whether you'd called it explicitly or it was called by something else, or whether there was a package that you might need to have loaded. That's why I asked – camille Jun 09 '21 at 21:24
  • I get it...then the OP realizes he/she forgot to add something and you're identifying something that wasn't even in the issue. Will remember for future posts. – James Jun 11 '21 at 19:02

1 Answers1

2

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