我最近打开了一个标准的Rmd文件而没有编辑任何内容.默认文件如下所示:
Untitled.rmd
---
title: "myfile"
author: "Me"
date: "May 25, 2015"
output: html_document
fontsize: 12pt
---
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code …Run Code Online (Sandbox Code Playgroud) 我正在尝试获取一些R代码以适应我的beamer幻灯片.似乎不可能通过size代码块的参数更改字体大小,就像对其他knitr类型文档一样.唯一的方法似乎是\footnotesize在每个代码块之前.这是令人沮丧的,因为我有很多代码块,在许多情况下,我必须使用\normalsize之后我的LaTeX项目符号点.
---
title: "Untitled"
output:
beamer_presentation:
includes:
in_header: header.txt
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, size = "footnotesize")
```
## R Markdown
```{r}
summary(cars)
```
\footnotesize
```{r}
summary(cars)
```
Run Code Online (Sandbox Code Playgroud)
在我header.txt(下面)中,我已经尝试了一些来自http://yihui.name/knitr/demo/beamer/的代码,但没有运气.
\ifdefined\knitrout
\renewenvironment{knitrout}{\begin{footnotesize}}{\end{footnotesize}}
\else
\fi
\makeatletter
\let\oldalltt\alltt
\def\alltt{\@ifnextchar[\alltt@i \alltt@ii}
\def\alltt@i[#1]{\oldalltt[#1]\footnotesize}
\def\alltt@ii{\oldalltt\footnotesize}
\makeatother
Run Code Online (Sandbox Code Playgroud)
......但真的超出我的深度\def.