rmarkdown and font size
You can change the style, modifying a variety of things. E.g,
---
title: Test
---
<style type="text/css">
body{ /* Normal */
font-size: 12px;
}
td { /* Table */
font-size: 8px;
}
h1.title {
font-size: 38px;
color: DarkRed;
}
h1 { /* Header 1 */
font-size: 28px;
color: DarkBlue;
}
h2 { /* Header 2 */
font-size: 22px;
color: DarkBlue;
}
h3 { /* Header 3 */
font-size: 18px;
font-family: "Times New Roman", Times, serif;
color: DarkBlue;
}
code.r{ /* Code block */
font-size: 12px;
}
pre { /* Code block - determines code spacing between lines */
font-size: 14px;
}
</style>
Here is some normal text. It is a 12-point font. The table is in 8-point .
```{r example, echo=FALSE, results='asis'}
tmp <- data.frame(a=1:5, b=letters[1:5])
print( knitr::kable(tmp, row.names=FALSE))
```
Hope this is helpful,
Dan
Daniel Nordlund, PhD
Research and Data Analysis Division
Services & Enterprise Support Administration
Washington State Department of Social and Health Services
-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of
MacQueen, Don
Sent: Wednesday, June 07, 2017 4:58 PM
To: r-help at r-project.org
Subject: [R] rmarkdown and font size
Suppose I have a file (named "tmp.rmd") containing:
---
title: Test
---
```{r example, echo=FALSE, results='asis'}
tmp <- data.frame(a=1:5, b=letters[1:5])
print( knitr::kable(tmp, row.names=FALSE))
```
And I render it with:
rmarkdown::render('tmp.rmd',
output_format=c('html_document','pdf_document'))
I get two files:
tmp.pdf
tmp.html
Is there a way to control (change or specify) the font size of the table in the
pdf output?
(or of the entire document, if it can't be changed for just the table)
With my actual data, the table is too wide to fit on a page in the pdf output;
perhaps if I reduce the font size I can get it to fit.
I would like the html version to still look decent, but I don't care very much
what happens to its font size.
Thanks!
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code.