R笔记本字体大小

时间:2018-02-15 21:38:31

标签: r markdown knitr font-size rnotebook

在渲染为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,因此交叉格式的解决方案很酷但不是必需的。

1 个答案:

答案 0 :(得分:3)

就像我们在https://www.iviewui.com/docs/guide/iview-loader-en中使用的那样简单fontsize: 12pt(当然还有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文件即可。