我正在尝试将我的Rmarkdown文档中的字体与我报告的其余部分相匹配。基本上这会为我的地图创建图例。整个报告都是罗克韦尔,但我无法弄清楚如何更改pandoc.table输出中的字体。以下是我使用panderOptions的尝试,但它没有用。
---
tables: true
geometry: margin=1.0in
header-includes:
- \usepackage{lscape}
- \newcommand{\blandscape}{\begin{landscape}}
- \newcommand{\elandscape}{\end{landscape}}
- \newcommand{\bminione}{\begin{minipage}{0.75 \textwidth}}
- \newcommand{\bminitwo}{\begin{minipage}{0.25 \textwidth}}
- \newcommand{\emini}{\end{minipage}}
fig_caption: yes
mainfont: Rockwell
sansfont: Rockwell
---
\pagenumbering{gobble}
**`r paste(i)` Projects Legend**
```{r pdf,echo=FALSE,warning=FALSE,error=FALSE,results='asis'}
library(pander)
#Isolate Waterbody in loop
WaterBody <- Datasubset[Datasubset$SWIM.Waterbody == i,]
#Restoration Projects Only
WQProjects <- WaterBody
#Create column that corresponds to map shapefiles
WQProjects$rowname <- 1:nrow(WQProjects)
#Drop all columns except for the ones you want to print
WQProjects <- WQProjects[,c("rowname","Name","Status")]
#Name for columns
colnames(WQProjects) <- c("Map Number","Project Name", "Status")
#Numbers for rows
rownames(WQProjects) <- WQProjects$rowname
#Table format
panderOptions('graph.fontfamily','Rockwell')
panderOptions('graph.fontcolor','red')
pandoc.table(t = WQProjects,
split.tables = Inf,
split.cells = c(5,100,30),
justify = "left",
style = "multiline"
)
```
Test font
谢谢大家的帮助。