Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R knitr markown: Setting HTML page width

Tags:

css

r

knitr

I am using knitr to create a HTML webpage. The default setting seems to be 800px but I need a larger page size of 1100px

body {
    max-width: 800px;
    margin: auto;
    padding: 1em;
    line-height: 20px ; 
}   

I have tried:

library("markdown")
library("knitr")
knit2html("test.Rmd",options = c(width=1100))

But this still gives me the smaller page size of 800px

How can I set the code for the HTML page width?

like image 839
adam.888 Avatar asked Feb 12 '15 14:02

adam.888


1 Answers

Add a css element to your document, e.g.

---
title: "test"

output:
  html_document:
    css: "test.css"
---

and then put your new css information in that file, e.g.

body {
  max-width: 1100px;
  margin: auto;
 padding: 1em;
 line-height: 20px ; 
}   
like image 111
csgillespie Avatar answered Sep 23 '22 11:09

csgillespie