簡體   English   中英

在 RMarkdown 中更改字體大小 PDF

[英]Change font size in RMarkdown PDF

如何在 RMarkdown 中更改 PDF output 的字體大小? 要更改的字體不在塊中。 例子:

---
title: "Example"
author: "Tales Martins"
output:
   pdf_document:
    toc: TRUE
    number_sections: TRUE
---
\newpage

```{r, include=FALSE, echo=FALSE}
library(knitr)

```
# Introduction
This is my introduction

如何更改“這是我的介紹”的字體大小? PDF output 默認字體很小。

提前致謝

你試過這個嗎?:

---
title: "Example"
author: "Tales Martins"
output:
   pdf_document:
    toc: true
    number_sections: yes
linestretch: 1.5
---

在 YAML linestretch: 1.5添加,然后將此toc: TRUE更改為此toc: true並將number_sections: TRUE更改為number_sections: yes

這里有一個例子

https://i.stack.imgur.com/VEdLL.png

您也可以選擇 linestretch: 2 和其他

PDF 是通過 TeX 引擎格式化的,因此您可以使用通常的 TeX 字體大小命令開始您的文檔(在{r setup}塊之后),即:

\tiny
\scriptsize
\footnotesize
\small
\normalsize
\large
\Large
\LARGE
\huge
\Huge

並在整個文檔中來回切換到默認文檔大小(例如\normalsize )。

答案在於 TeX 格式,而不是 RMarkdown 本身。 許多問題通過將 arguments 傳遞給 TeX 序言(Rstudio 稱為“header”)來解決,例如:

header-includes:
  \setmonofont{Menlo for Powerline}[Scale=0.65,Color=darkgray]

許多問題是通過使用制表符而不是空格創建的,使用默認的 RMarkdown 引擎 knitr。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM