r - 使用 "rticles"包时如何更改 RMarkdown 中的字体?

标签 r latex yaml r-markdown

我最近在 R 中安装了“文章”包,以在 RMarkdown 中自动设置期刊文章模板。到目前为止,我对它印象深刻,但我希望能够更改字体。当然,这在某种程度上是可能的,但我一直无法找到任何解释如何做到这一点的在线资源。

我对编织成 PDF 很感兴趣。

这是我的 RMarkdown 脚本顶部的 YAML:

---
title: This title
author:
  - name: This author
    email: t.author@thisPlace.com
    affiliation: This institute
address:
  - code: This institute
    address: Street, City, State, etc.
abstract: |
  This is the abstract.

  It consists of two paragraphs.
keywords: "fun, happiness"
journal: "This Elsevier Journal"
date: "`r Sys.Date()`"
output: rticles::elsevier_article
---

我是通过在 R 中运行以下代码行生成的:

rmarkdown::draft("Test.Rmd", template = "elsevier_article", package = "rticles")

那么我可以在哪里控制字体呢?在使用“文章”之前,我曾经通过更改 latex 引擎来更改字体,然后按如下方式指定字体:

---
title: This title
author: "This author"
date: "`r Sys.Date()`"
output:
  pdf_document:
    toc: yes
    toc_depth: 4
    fig_caption: TRUE
    df_print: kable
    latex_engine: xelatex
mainfont: Calibri Light
---

是否可以在“文章”中做类似的事情?

最佳答案

您控制字体的方式与您之前所做的类似:

---
title: This title
author:
  - name: This author
    email: t.author@thisPlace.com
    affiliation: This institute
address:
  - code: This institute
    address: Street, City, State, etc.
abstract: |
  This is the abstract.

  It consists of two paragraphs.
keywords: "fun, happiness"
journal: "This Elsevier Journal"
date: "`r Sys.Date()`"
output:
  rticles::elsevier_article:
    latex_engine: xelatex
mainfont: Calibri Light        
---

关于r - 使用 "rticles"包时如何更改 RMarkdown 中的字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58120216/

相关文章:

javascript - 将 R dygraphs 用于分数时间点?

r - 使用 ggplot2 在 R 中绘制条形图

latex - URL Latex 换行符

latex - Knitr:在投影仪覆盖中显示波浪号〜

python - Google App Engine URL 处理程序运行时出错

r - 如何在给定纬度和经度/坐标的情况下自动确定状态?

r - 如何使用ggplot2在R中制作具有透明背景的图形?

latex - Latex中添加图片时忽略边距和换行

git - Azure DevOps - 条件/表达式允许我跳过阶段内的任务

dart - Flutter "Mapping values are not allowed here"包获取时报错