chengvt
chengvt

Reputation: 553

How to make a pander table keep to the left

I have searched many places on how to place the whole table to the left but couldn't find a way except to set floating = FALSE. The reproducible rmd file is as follows.

---
title: "test"
output: pdf_document
---

```{r}
library(pander)
panderOptions('table.alignment.default', 'left')
panderOptions('table.alignment.rownames', 'left')
pander(mtcars[1:4], caption = "a table")
```

The desired output is something like this:

enter image description here

Upvotes: 3

Views: 1249

Answers (1)

Poza
Poza

Reputation: 395

With a small adjustment in the YAML header, your code should work (see daroczig's link):

---
title: "test"
output: pdf_document
header-includes:
- \usepackage[margins=raggedright]{floatrow}
---

```{r}
library(pander)
panderOptions('table.alignment.default', 'left')
panderOptions('table.alignment.rownames', 'left')
pander(mtcars[1:4], caption = "a table")
```

Upvotes: 0

Related Questions