R笔记本字体大小

R notebook font size

在呈现为 PDF 时,我可以通过哪些选项更改动态生成的输出的字体大小?我的文档目前看起来像这样:

---
title: "Foo"
author: "Bar"
date: "`r format(Sys.time(), '%B %e, %Y')`"
output:
  pdf_document: default
  html_document:
    df_print: paged
header-includes: \usepackage{amsmath} \usepackage{color}
---

# Introduction

```{bash echo=FALSE}
perl -le 'print for 1..50'
```

我想减小字体大小以帮助更多输出适合 PDF 的单个页面。我目前还没有输出到 HTML,因此跨格式解决方案会很酷,但不是真正必要的。

它就像fontsize: 12pt一样简单(或者当然是我们在pinp中使用的fontsize: 9pt

修改文件:

---
title: "Foo"
author: "Bar"
date: "`r format(Sys.time(), '%B %e, %Y')`"
fontsize: 12pt
output:
  pdf_document: default
  html_document:
    df_print: paged
header-includes: \usepackage{amsmath} \usepackage{color}
---

# Introduction

```{bash echo=FALSE}
perl -le 'print for 1..50'
```

如果您只想要代码/结果片段,我建议您在其周围放置适当的 \begin{Large}\end{Large}。我 过去自定义这里使用的默认环境 --- 我记得这里的 knitr 或多或少遵循 Sweave。看看生成的 .tex 文件。