更改四开 pdf 文档中的字体

dze*_*gpi 11 pdf latex r quarto

如何在四开PDF文档中自定义字体?mainfont我意识到和选项的存在fontfamily,但文档没有提供如何使用它们以及哪些字体可用的示例。另外,有哪些字体可供使用monofont

这是文档:https://quarto.org/docs/reference/formats/pdf.html#fonts

sha*_*fee 14

正如文档中所述,您可以使用系统字体(即系统中安装的字体)。因此,在使用或作为时,将系统字体的字体系列指定为mainfont和/或monofontyaml 键的值。xelatexlualatexpdf-engine

现在,如果您想获取系统中安装的字体列表,您可以使用包system_fonts()中的函数{systemfonts}


---
title: "Fonts in Quarto"
format: pdf
pdf-engine: xelatex
mainfont: Lato
monofont: Roboto
---


## Fonts

- mainfont: For LaTeX output, the main font
family for use with xelatex or lualatex. 
Takes the name of any system font. 

- monofont: For LaTeX output, the monospace 
font family for use with xelatex or lualatex:
take the name of any system font.


## Fonts available in system

```{r}
# install.packages("systemfonts")
systemfonts::system_fonts()
```
Run Code Online (Sandbox Code Playgroud)

另请注意,如果您使用fontfamily设置 font-family,则需要使用pdflatexas pdf-engine

  • [这个](/sf/answers/5156875951/)和[这个](/sf/answers/5158240461/)答案可能会有帮助。 (5认同)