"Latex" text added to document knitted with bookdown to pdf

34 Views Asked by At

I am producing a pdf with bookdown. I want to create a landscape page for a wide table. When I do this I am getting some odd added text either side of my table: “‘=latex.

---
title: "PAV results"
header-includes: \usepackage{pdflscape}
date: "2023-06-19"
output:
  bookdown::pdf_document2:
    number_sections: no
    latex_engine: xelatex
    toc: no
---
  
```{r setup2, include=FALSE}
  library(knitr)
  knitr::opts_chunk$set(echo = FALSE, warning = F, message = F)
  library(dplyr)
  library(flextable)
    library(ftExtra)
```
Intro text


\begin{landscape}

```{r anthro, eval= T}
flextable(anthrotab)%>%autofit()%>%theme_booktabs(bold_header = T)%>%
  set_caption(as_paragraph("My table"))%>%
  align(align = "left", part = "body")%>%
  colformat_md()%>%
   add_footer_lines(as_paragraph("Abbreviations:"))

```

\end{landscape}

text

This is how it appears in my pdf:

enter image description here

This appears to be an issue with flextable.

This is another attempt using kable and including the flextable table on a portrait page:


Intro text


\begin{landscape}

```{r kable}
kbl(anthrotab)
```
\end{landscape}

text

```{r anthro, eval= T}
flextable(anthrotab)%>%autofit()%>%theme_booktabs(bold_header = T)%>%
  set_caption(as_paragraph("My table"))%>%
  align(align = "left", part = "body")%>%
  colformat_md()%>%
   add_footer_lines(as_paragraph("Abbreviations:"))

```

which produces this

0

There are 0 best solutions below