Render latex tables in xaringan presentation

89 views Asked by At

I am trying to include a Latex table in my xaringan presentation built in an rmarkdown. However, the table does not render. My code is the following, taken from the online example showing how to connect Latex with r (https://bookdown.org/yihui/rmarkdown-cookbook/raw-latex.html).

My document is set up with this:

---
title: "Presentation"
subtitle: ""
author: "author"
institute: "institute"
date: "`r Sys.Date()`"
output:
  
  xaringan::moon_reader:
    lib_dir: libs
    nature:
      highlightStyle: github
      highlightLines: true
      countIncrementalSlides: false
      keep_tex: yes
    css: xaringan-themer.css
    
---

```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
```


```{r xaringan-themer, include=FALSE, warning=FALSE}
library(xaringanthemer)
style_mono_accent(
  base_color = "blue",
  header_font_google = google_font("Lato"),
  text_font_google   = google_font("Lato", "300", "300i"),
  code_font_google   = google_font("Lato")
)

library(ggplot2)
library(tidyverse)
library(dplyr)
```

The table I want to create is then included in the following chunk:

\begin{tabular}{ll}
A & B \\
A & B \\
\end{tabular}

Yet when I look in the infinite moon reader or knit, the latex code does not render. Instead, it looks like the following:

enter image description here

Why does this not render and how can I fix it, so that the table renders on the slide of my xaringan presentation? Am I misunderstanding how markdown works? Or do I need to do something more with bookdown in order to render the latex?

0

There are 0 answers