在 R Markdown 上指定字体类型

Specify Font type on R Markdown

如何在 R Markdown 上指定字体类型,即 Tahoma。我正在使用以下内容来定义我的文档

---
bibliography: bibliography.bib
csl: nature.csl
documentclass: article
fontsize: 12pt
linkcolor: blue
mainfont: Arial
output: 
  pdf_document:
    fig_caption: Yes

---

如何同时指定图片说明的字体大小 -- 如下图所示

![Figure 2: The impact of malaria disease the factors within the bednet that in turn affect infections and other health issues](climate_change.png)

这里是一个使用 LaTeX-code 的例子。您需要在 R markdown 文件的同一文件夹中有一个单独的 style-file,您可以在其中定义 font-family.

在 style-file (mystyle.sty) 中,您可以定义 LaTeX Font Catalogue 中的任何字体,例如Palatino 无衬线字体:

\usepackage{palatino}
\renewcommand{\familydefault}{\sfdefault} % sans serif
\fontfamily{ppl}\selectfont

有关通过 LaTeX 使用 Tahoma 的方法,请查看 here, or here

R markdown 文件如下所示,您还可以使用 LaTeX fontsize 命令更改标题的大小:

---
output: 
pdf_document:
    includes:
        in_header: mystyle.sty 
---

\begin{huge}
![Figure 2: the caption of the picture](picture.png)
\end{huge}