R markdown / bookdown - how to display keywords below an abstract?

爷,独闯天下 提交于 2021-02-07 20:47:27

问题


I defined keywords in the .Rmd file, but they are not visible in the output PDF.


Current Output


Expected results


Current .Rmd

First lines of .Rmd file looks as follows:

---
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. 

回答1:


I wonder if base_format is actually doing any work in your example (the output looks the same with and without base_format). Since base_format is an argument to pdf_book, consider changing your YAML header to

---
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
---

which gives you the following output:


Alternatively, add keywords to the abstract:

    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"

to get



来源:https://stackoverflow.com/questions/42272048/r-markdown-bookdown-how-to-display-keywords-below-an-abstract

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!