R Markdown pdf document: outputs is to wide and extends beyond the page

42 Views Asked by At

I am creating a markdown document to provide the supervisors of my thesis with my R script. Everything is working fine, except for one detail:

I include the outputs of a regression by using 'texreg':

### 2.4 Output
```{r output}
texreg(list(M1aR,M1bR,M1cR,M1dR), dcolumn = TRUE, booktabs = TRUE, 
       stars = c(0.01, 0.05, 0.1),
       include.adjrs = FALSE, caption = "Lifetime CO2", digits = 4, 
       reorder.coef = c(2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,1))
```

In the PDF file, the generated Latex code exceeds the page width and the last few words can not be seen. I tried using different options such as

  pdf_document:
    latex_engine: pdflatex
    geometry: "left=2cm, right=2cm, top=2cm, bottom=2cm"

in the header. I also tried options in the chunk:

knitr::opts_chunk$set(out.width="80%")  
texreg(list(M1aR,M1bR,M1cR,M1dR), dcolumn = TRUE, booktabs = TRUE, 
       stars = c(0.01, 0.05, 0.1),
       include.adjrs = FALSE, caption = "Lifetime CO2", digits = 4, 
       reorder.coef = c(2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,1))

But nothing worked. The formatR package is installed and called. Any suggestions anyone? Would be highly appreciated!

0

There are 0 best solutions below