![\newfontfamily 未定义控制序列](https://linux22.com/image/440974/%5Cnewfontfamily%20%E6%9C%AA%E5%AE%9A%E4%B9%89%E6%8E%A7%E5%88%B6%E5%BA%8F%E5%88%97%20.png)
我正在 rmarkdown 中制作一份 latex 文档。我想更改表格中使用的字体。我正在关注 stack overflow 上的这个答案:https://stackoverflow.com/questions/54720299/rmarkdown-different-font-types-in-table-using-kable
但是,我甚至无法让第一部分工作。我收到错误:
! Undefined control sequence.
<recently read> \newfontfamily
这是我的 YAML:
---
title: "Queries"
header-includes:
- \usepackage{pdflscape}
- \usepackage{longtable}
- \usepackage{xcolor}
- \newfontfamily\helvetica[Path= Fonts/, ItalicFont = {Helvetica italic}, BoldFont = {Helvetica bold}]{Helvetica}
- \newenvironment{ctable}{\helvetica }{}
- \newenvironment{capctable}[1][t]{\begin{table}[#1]\centering\helvetica}{\end{table}}
output:
pdf_document:
toc: false
---
我对 \newfontfamily 做错了什么?我也尝试过删除,, ItalicFont = {Helvetica italic}, BoldFont = {Helvetica bold}
但出现同样的错误
header-includes
如果我按如下方式重新排列参数的顺序
---
title: "Queries"
header-includes:
- \newfontfamily\helvetica[Path= Fonts/ ]{Helvetica}
- \newenvironment{ctable}{\helvetica }{}
- \newenvironment{capctable}[1][t]{\begin{table}[#1]\centering\helvetica}{\end{table}}
- \usepackage{pdflscape}
- \usepackage{longtable}
- \usepackage{xcolor}
output:
pdf_document:
toc: false
---
我收到类似但不同的错误:
! Undefined control sequence.
l.61 \newfontfamily
\helvetica[Path= Fonts/ ]{Helvetica}