2017-02-16 98 views
1

我在.Rmd文件中定義了關鍵字,但它們在輸出PDF中不可見。R markdown/bookdown - 如何在摘要下方顯示關鍵字?


電流輸出

output without keywords


預期結果

expected results with keywords


當前.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. 
+1

這將是很好,如果你給了這個問題,而不是強迫讀者後,非可點擊鏈接追逐和導入項目模板背頁進裏面預期的示例輸出。一般而言,您應該將您的問題限制在必要的信息上,而不要用不相關的細節混淆它。 –

+0

對不起,我認爲提供完整的輸出會更容易,因此它可以完全重現。我修改了我的問題。 – matandked

+0

@matandked:以及你如何擺脫「0」。所有字幕/部分的主要編號? [因爲它是單個文檔] – FairMiles

回答

2

不知實際上是做任何工作在你的榜樣(輸出看起來相同與和沒有)。由於是一個參數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 
--- 

它給你以下的輸出:

enter image description here


或者,將關鍵字添加到抽象:

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" 

獲得

enter image description here

+0

謝謝,但是...一般來說我有更復雜的文件。一旦我根據您的建議更改標題,文檔無法編譯(因爲其中一個圖的標題中的波蘭語字母「ł」) – matandked

+0

一旦從標題中刪除「ł」,我也注意到在輸出.tex文件「\ citep {PositionInBibFile}」已被替換爲「(Someone,2012)」 – matandked

+0

而不是包含「\ bibliography {bibliography.bib}」的參考書目,它只包含輸出中的所有參考文獻位置.tex文件 – matandked

相關問題