在R Markdown上指定字体类型

Ken*_*jin 8 r knitr r-markdown

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

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

---
Run Code Online (Sandbox Code Playgroud)

如何指定图标的字体大小 - 如下图所示

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

jmj*_*mjr 4

这是一个使用 LaTeX 代码的示例。您需要在 R markdown 文件的同一文件夹中放置一个单独的样式文件,您可以在其中定义字体系列。

在样式文件(mystyle.sty)中,您可以定义LaTeX 字体目录中的任何字体,例如 Palatino Sans Serif:

\usepackage{palatino}
\renewcommand{\familydefault}{\sfdefault} % sans serif
\fontfamily{ppl}\selectfont
Run Code Online (Sandbox Code Playgroud)

有关通过 LaTeX 使用 Tahoma 的方法,请查看此处此处

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}
Run Code Online (Sandbox Code Playgroud)