簡體   English   中英

R Markdown 關鍵字未出現在文檔中

[英]R Markdown keywords don't appear in the document

我想編織一個 pdf 文檔,但關鍵字沒有出現在最終文檔中。 有人可以告訴我我做錯了什么嗎?

---
title: "title"
subtitle: "subtitle"
author: "author"
date: "09 04 2019"
output:
  pdf_document:
keywords: "word1, word2, word3"
footerdate: yes
abstract: 'Insert abstract here'
---

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

# Introduction

在此處輸入圖片說明

編織為PDF時,關鍵字將發送到文件元數據,但實際上在文件中不可見。 資源

您可以使用base_format: rticles::elsevier_article自定義 PDF 生成template渲染 Rmd 文件 但是,還有另一種方法可以通過在 Rmd 文件中添加一些代碼來在 PDF 上顯示關鍵字:

  1. 添加 LaTeX 代碼以將\\keyword命令( \\providecommand{\\keywords}[1]{\\textbf{\\textit{Keywords---}} #1} )提供到 YAML 的header-includes鍵中;
  2. 使用 LaTeX 命令在文本部分添加關鍵字
---
title: "title"
subtitle: "subtitle"
author: "author"
date: "09 04 2019"
output:
  pdf_document:
# keywords: "word1, word2, word3" # <- You don't have to add your keywords here since they only appear as the 'invisible' metadata of PDF
footerdate: yes
abstract: 'Insert abstract here'
header-includes:
  - |
    ```{=latex}
    \providecommand{\keywords}[1]{\textbf{\textit{Keywords---}} #1}
    ```
---

```{=latex}
\keywords{word1, word2, word3}
```

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

# Introduction

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM