R markdown / bookdown - 如何在摘要下方显示关键字?

mat*_*ked 4 r knitr bookdown

我在 .Rmd 文件中定义了关键字,但它们在输出 PDF 中不可见。


电流输出

没有关键字的输出


预期成绩

关键字的预期结果


当前 .Rmd

.Rmd 文件的第一行如下所示:

---
title: "No keywords within the output file"
abstract: "This is sample text for abstract. Generally speaking, I would like to show keywords list below an abstract (as in case of the linked example)"
keywords: "keywordA, keywordB"
author: "Mateusz K?dzior"
output: 
  bookdown::pdf_document2:
    keep_tex: true
    number_sections: yes
    toc: false
base_format: rticles::elsevier_article
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## Elsevier article

This is an R Markdown document.

I'm trying to prepare an Elsevier article. 
Run Code Online (Sandbox Code Playgroud)

Wei*_*ong 6

我想知道base_format在你的例子中是否真的在做任何工作(输出看起来和没有一样base_format)。由于base_format是 的参数pdf_book,请考虑将您的 YAML 标头更改为

---
title: "No keywords within the output file"
author: 
- name: "Mateusz K?dzior"
abstract: "This is sample text for abstract. Generally speaking, I would like to show keywords list below an abstract (as in case of the linked example)"
keywords: "keywordA, keywordB"
output: 
  bookdown::pdf_book:
    keep_tex: true
    number_sections: yes
    toc: false
    base_format: rticles::elsevier_article
---
Run Code Online (Sandbox Code Playgroud)

它为您提供以下输出:

在此处输入图片说明


或者,在摘要中添加关键字:

    abstract: "This is sample text for abstract. Generally speaking, I would like
 to show keywords list below an abstract (as in case of the linked example) \\par
 \\textbf{Keywords:} a, b"
Run Code Online (Sandbox Code Playgroud)

要得到

在此处输入图片说明