---
title: "xtable & kableExtra"
author: "Hao"
date: "2/13/2019"
output: pdf_document
---

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

Recent versions of kableExtra (since 1.0) offers a function `xtable2kable`, which, as suggested by its name, turns a `xtable` object to a `kable` object so you can use functions in kableExtra after that. I tested some basic examples and it seem to work. 

```{r}
library(xtable)
library(kableExtra)

xtable(mtcars[1:5, 1:5]) %>%
  xtable2kable() %>%
  column_spec(1, width = "5cm")
```

```{r}
xtable(mtcars[1:5, 1:5], caption = "Some long caption") %>%
  xtable2kable(caption.width = "10em") %>%
  column_spec(1, color = "red")
```



