multiple authors and subtitles in Rmarkdown yaml
I just found out that it is possible to add subtitles to R markdown PDF output. I am using R 3.2.2 and RStudio 0.99.473 in Ubuntu 14.04.
---
title: 'This is the title: it contains a colon'
subtitle: 'This is the subtitle'
output: pdf_document
---
The default latex template in rmarkdown does not support author affiliations or subtitles. It does support multiple authors however, the correct yaml syntax is
---
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
---
If you want to customize your header, the best approach is to modify the latex template, found here to suit your needs. Then copy it to your local directory and pass it to the header in the template
field.
As explained in the main answer, the default R Markdown template does not support author affiliations. While users can edit the template file to add their own custom YAML fields, there are easier some workarounds you can use for PDF or HTML outputs.
HTML Outputs
You can use the recently released radix template. First you must install the package:
install.packages("radix")
Once installed, you must set the
---
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
PDF Outputs
You can use premade templates, and there are some good examples within the rticles package. First we must install the package:
install.packages("rticles")
Once Installed, you can use one of the templates, such as the Journal of Statistical Software:
---
author:
- name: FirstName LastName
affiliation: University/Company
address: >
First line
Second line
email: \email{[email protected]}
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
---
If you render a pdf, LaTex use authors' footnote for affiliations (i.e. converting numbering in symbles). Try
---
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
---