为Rmarkdown的YAML标题中的数字设置标题字体大小

mhw*_*hwh 3 yaml r rstudio knitr r-markdown

我正在使用Rstudios markdown编写一份报告,我想使用latex以及html编译为pdf ...

是否有可能调整![caption](figure.jpg)环境中包含的图像的字幕字体大小?目前,html中的标题看起来像文本的其余部分.

Joh*_*nny 7

这个答案显然已经被接受,但为了完整性我正在添加问题的PDF方面.

如果您希望更改PDF文档的标题字体大小,我建议您caption通过以下两种方法之一使用该包:

header-includes - 选项:

---
title: "Title"
author: "Jorge Luis Borges"
header-includes:
  - \usepackage[font={small}]{caption}
output:
  pdf_document
---
Run Code Online (Sandbox Code Playgroud)

这里的重点是font={<font options>}.

in_header - 选项:

---
title: "Title"
author: "Jorge Luis Borges"
output:
  pdf_document:
    includes:
      in_header: style.tex
---
Run Code Online (Sandbox Code Playgroud)

其中style.tex包括在包含.Rmd文件在同一目录.该style.tex文件需要包含\usepackage[font={small}]{caption}.

和以前一样,这里的重点是font={<font options>}.


有了这个caption包你有很多自定义选项,仅举几例,见下文:

  • scriptsize =非常小的尺寸
  • footnotesize =通常用于脚注的大小
  • small =小尺寸
  • large =大尺寸
  • it =斜体
  • bf =大胆的脸

如需完整参考,请访问官方文档.

此外,这里有一些交叉引用的文章在TexSE网站上:

更改图标题的字体

如何在RMarkdown中包含Latex包