RockScience RockScience - 1 year ago 426
R Question

knitr::kable is there a way to reduce the font size?

I am using this code chunk

```{r, echo = FALSE}

However I would like to reduce the size of all font inside this table so that the output looks nicer. Is there a way to do that with kable or is there another package which supports it?

Answer Source

When you are happy with a global setting, use css on .table. To set it for one table, the only method I am aware of uses a div. Both methods cannot be used for latex etc, but the global method looks cleaner to me, because formating is delegated to a separate css.

title: "Small kable"
    css: kable.css


# Global setting


# Local setting, not portable
<div class="verysmall">



CSS File

  font-size: 12px;

.verysmall .table{
  font-size: 8px;

I also use auto-formatting for kable-tables in most cases.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download