In knitr, the size option works fine in a .Rnw
file, the following code generates:
\documentclass{article}
\begin{document}
<<chunk1, size="huge">>=
summary(mtcars)
@
\end{document}
However, I can't get it to work in Rmarkdown. The following code does not change the font size, as it did in .rnw
file. The same thing happens when trying to set options with opts_chunk$set(size="huge")
.
Is this the expected behavior? How does one change the chunk code font size? (I mean using knitr options, not by adding \huge
before the code)
---
title: "Untitled"
output: pdf_document
---
```{r, size="huge"}
summary(mtcars)
```
I am using RStudio Version 0.98.987, knitr 1.6 and rmarkdown 0.2.68.
size
option only works for Rnw. For R Markdown (v2), I think the only way is to redefine the code environments for Pandoc/LaTeX (see the section "Includes" at rmarkdown.rstudio.com/pdf_document_format.html).\begin{huge}
and\end{huge}
around a chunk, but then you will be stuck in LaTeX unless you do not want other document formats such as HTML, Word, ... A side comment: tweaking styles is like this kitten bothering you: i.imgur.com/17B4U.gif It is tempting to tweak the style while you work, and it is very distractive and endless work as well :)