2

How do you suppress captions for a texreg table? I'm using Rmarkdown to generate a LaTeX file. Here's a simple example:

```{r, echo=FALSE, message=FALSE, results="asis"}
library(texreg)
data <- data.frame(a=c(1,2,3,4), b=c(6,3,4,4))
texreg(lm(a~b, data=data), caption="", custom.note="", float.pos="h!")
```

The table I get has a caption on the bottom that says "Table 1:". How do I get rid of it? Thanks.

Cyurmt
  • 101
  • 9
  • Adding a table=FALSE option to texreg gets rid of the caption but then how do I restore the table's centering? – Cyurmt Jun 06 '15 at 06:18

2 Answers2

2

In the YAML section where LaTeX packages can be included, add the caption package:

header-includes:
    - \usepackage{caption}

Then at the beginning of the RMarkdown document body add:

\captionsetup[table]{labelformat=empty}

This removes the caption labels for all tables.

Cyurmt
  • 101
  • 9
0

In case you have an external .tex file for additional formatting (i. e. I made a file for including a logo in the header of each page as described here) you should include \usepackage{caption} (just this line) in the external .tex file, not in the yaml header of the RMarkdown document.

OranWuTan
  • 21
  • 1
  • 5