使用 Google 字体生成 beamer PDF 时出现问题

Problem with using Google Font to produce beamer PDF

提前感谢您的友好评论。

我使用xelatex引擎生成Beamer的PDF,工作环境是R Markdown,我指定YAML如下:

---
title: Presentation for Research Planning - Literature Review and Academic Writing
subtitle: 
author: 
institute:
#titlegraphic: 
fontsize: 11pt
output:
 beamer_presentation:
    template: C:\Users\Desktop\R Files\svm-latex-beamer.tex
    keep_tex: true
    latex_engine: xelatex # pdflatex also works here
    dev: cairo_pdf # I typically comment this out  if latex_engine: pdflatex
    slide_level: 3
make149: true
mainfont: "Titillium Web"  # Try out some font options if xelatex
titlefont: "Palatino Linotype" # Try out some font options if xelatex
---

我使用的模板是从http://svmiller.com/blog/2019/08/r-markdown-template-beamer-presentations/

下载的

mainfont: "Titillium Web"这是我从Google下载并安装的

titlefont: "Palatino Linotype" 这个已经在我的系统中了,所以我不需要安装它。而且这个字体有效。

安装后和我post这里之前,我检查了新字体在我的本地系统中。我已经更新了我的 Tinytex 包并重新启动了我的电脑。但是还是不行,报错如下:

! Package fontspec Error: The font "Titillium Web" cannot be found.

! kpathsea:make_tex: Invalid filename `Titillium Web', contains ' '

error: LaTeX failed to compile presentation_sample.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See presentation_sample.log for more info.

我不知道,但我真的很想在我的幻灯片中添加一些很酷的字体!顺便说一句,我的 R 版本是:

sessionInfo()

R version 3.6.3 (2020-02-29)

Platform: x86_64-w64-mingw32/x64 (64-bit)

Running under: Windows 10 x64 (build 18363)

如果字体安装正确,您的文档应该可以正常工作。但是,您可以通过将 TitilliumWeb-Regular.ttf 放入与 .rmd 文件相同的文件夹中,然后通过

调用它来解决安装问题
mainfont: "TitilliumWeb-Regular.ttf"  # Try out some font options if xelatex