3

I'm trying to include kableExtra table in my ioslides in RStudio. I get the tables correctly, however simple formatting from the vignette examples seems to be gone.

---
title: "Tables"
output:
  ioslides_presentation: default
---

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

dt <- mtcars[1:5, 1:6]    
```

## No styling

```{r t1}
dt %>%
  kable("html")   
```

## Styling

```{r t2}
dt %>%
  kable("html") %>%
  kable_styling(bootstrap_options = c("striped", "condensed", full_width = F, position = "center"))
```

Any ideas what I'm missing?

3
  • 2
    The presentation output formats have default pandoc templates, which are overriding the style applied to your slides. You could build your own ioslides template to suit your needs or just the CSS you require for your tables. Dec 18, 2017 at 3:41
  • 2
    You could use webshot as in this approach to make your table an image if building the CSS or pandoc template are too involved for you. Dec 18, 2017 at 4:46
  • Thanks @KevinArseneau could be a solution. Having troubles running webshot example but will report back if I have some progress.
    – radek
    Dec 18, 2017 at 6:10

2 Answers 2

Reset to default

Trending sort

Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.

It falls back to sorting by highest score if no posts are trending.

6

You need to update the kableextra to 0.9.0 or above. Starting from this version, it will automatically load required css into the slides environment.

Update: If it still doesn't work, you can force kableExtra to load the css for you by

options("kableExtra.html.bsTable" = T)

See https://cran.r-project.org/web/packages/kableExtra/news/news.html under kableExtra 0.9.0

1
  • I have the same problem. Your solution doesn't work for me, though. Can you help?
    – Georgery
    Jul 12, 2018 at 12:43
3

I solved this issue by including the bootstrap CSS, which are used by kableExtra:

output:
  ioslides_presentation: 
    css: https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.