我正在尝试按照此pandoc示例将多个作者添加到yaml元数据块中的Rmarkdown文件.pdf将在RStudio(版本0.98.932)中生成,但没有作者信息.
--- title: 'This is the title: it contains a colon' author: - name: Author One affiliation: University of Somewhere - name: Author Two affiliation: University of Nowhere date: "`r format(Sys.time(), '%d %B %Y')`" tags: [nothing, nothingness] abstract: | This is the abstract. It consists of two paragraphs. output: pdf_document ---
我还想更多地定制标题并添加一个副标题.可能?
rmarkdown中的默认乳胶模板不支持作者从属关系或字幕.它确实支持多个作者,但正确的yaml语法是
--- title: 'This is the title: it contains a colon' author: - Author One - Author Two date: "`r format(Sys.time(), '%d %B %Y')`" tags: [nothing, nothingness] abstract: | This is the abstract. It consists of two paragraphs. output: pdf_document: template: NULL ---
如果您想自定义标题,最好的方法是修改乳胶模板,在此处找到以满足您的需求.然后将其复制到本地目录并将其传递到template
字段中的标题.
我刚刚发现可以在R markdown PDF输出中添加字幕.我在Ubuntu 14.04中使用R 3.2.2和RStudio 0.99.473.
--- title: 'This is the title: it contains a colon' subtitle: 'This is the subtitle' output: pdf_document ---
如果你渲染一个pdf,LaTex使用作者的脚注来表示隶属关系(即转换symbles中的编号).尝试
--- title: 'This is the title: it contains a colon' subtitle: 'This is the subtitle' author: - Author One^[University of Somewhere] - Author Two^[University of Nowhere] date: "`r format(Sys.time(), '%d %B %Y')`" tags: [nothing, nothingness] abstract: | This is the abstract. It consists of two paragraphs. output: pdf_document ---
我也遇到过这个问题.根据@ tmpname12345的建议,我修改了乳胶模板(default.tex)和html模板(default.html)来渲染字幕.如果你想快速获得代码,这个拉取请求就在github rstudio/rmarkdown上,看起来它们在下次推送到CRAN时将成为rmarkdown的标准.
在Ze Grisi的回答中,我刚刚发现在yaml作品中添加了html标题标签,以调整标题和副标题中的字体。请注意,不再需要引号。
--- title: 'This is the title: it contains a colon' subtitle: <h1>This is the subtitle</h1> output: pdf_document ---
为了获得更生动的效果,请在字幕上添加下划线
--- title: 'This is the title: it contains a colon' subtitle: <h1><u>This is the subtitle</u></h1> output: pdf_document ---
如主要答案中所述,默认的R Markdown模板不支持作者隶属关系。尽管用户可以编辑模板文件以添加自己的自定义YAML字段,但可以将一些变通方法用于PDF或HTML输出。
您可以使用最近发布的基数模板。首先,您必须安装该软件包:
install.packages("radix")
安装完成后,您必须设置
--- title: "Radix for R Markdown" description: | Scientific and technical writing, native to the web date: May 4, 2018 author: - name: "JJ Allaire" url: https://github.com/jjallaire affiliation: RStudio affiliation_url: https://www.rstudio.com - name: "Rich Iannone" url: https://github.com/rich-iannone affiliation: RStudio affiliation_url: https://www.rstudio.com output: radix::radix_article --- Your content
您可以使用预制模板,并且在rticles包中有一些很好的示例。首先,我们必须安装该软件包:
install.packages("rticles")
安装后,您可以使用其中一个模板,例如Journal of Statistics Software:
--- author: - name: FirstName LastName affiliation: University/Company address: > First line Second line email: \email{name@company.com} url: http://rstudio.com - name: Second Author affiliation: Affiliation title: formatted: "A Capitalized Title: Something about a Package \\pkg{foo}" # If you use tex in the formatted title, also supply version without plain: "A Capitalized Title: Something about a Package foo" # For running headers, if needed short: "\\pkg{foo}: A Capitalized Title" abstract: > The abstract of the article. keywords: # at least one keyword must be supplied formatted: [keywords, not capitalized, "\\proglang{Java}"] plain: [keywords, not capitalized, Java] preamble: > \usepackage{amsmath} output: rticles::jss_article ---