Add author affiliation in R markdown beamer presentation
If you use pipes |
you can break the author line into multiple lines:
---
title: "The title"
author: |
| The author
| The affiliation
date: "9 April 2015"
output: beamer_presentation
---
Output:
Edit (can we play with the title and author/affiliation fonts?):
If you want to change the different font sizes, I recommend playing with the includes: in_header
option of your presentation's header (check this RStudio link for specifics).
This points to a simple .tex
file on your computer where you can add LaTeX commands specifically for your presentation's preamble. You could therefore have a file called preamble.tex
in your Desktop, and use the \setbeamerfont{XX}{size={\fontsize{YY}{ZZ}}}
command, where XX is the specific thing you want to change (title, author); YY is the font size to apply; and ZZ is the skip line (in pt) (also see this link for more details).
So for your example, we have:
preamble.tex
file at your Desktop (or wherever you want) containing just two lines:
\setbeamerfont{title}{size={\fontsize{30}{25}}}
\setbeamerfont{author}{size={\fontsize{5}{20}}}
Your foo.Rmd
file:
---
title: "The title"
author: |
| The author
| The affiliation
output:
beamer_presentation:
includes:
in_header: ~/Desktop/preamble.tex
---
## R Markdown
This is an R Markdown presentation.
Markdown is a simple formatting syntax for
authoring HTML, PDF, and MS Word documents.
And the output will be:
Authors and affiliations in the YAML of RMarkdown
There is, to the best of my knowledge, no one-size-fits-it-all solution as of now.
If the target was only PDF, I'd suggest rticles by RStudio. It's great.
A solution which also works with docx is more difficult. One possibility is to use pandoc Lua filters. The repository collecting useful filters contains two filters which will help you: scholarly-metadata and author-info-blocks. (Disclosure: I wrote these.)
Place the .lua
files in your directory, change the YAML structure a bit, and instruct pandoc to run the filters:
---
title: "My title"
author:
- Mario Modesto-Mata:
email: paleomariomm@gmail.com
institute: [astro, med]
correspondence: true
- name: Christopher
institute: astro
- name: Seaghán Mhartain
institute: med
- name: Rita Yuri Ynoue
institute: astro
institute:
- astro: Instituto de Astronomía, Geofísica e Ciências Atmosféricas, Universidade de São Paulo
- med: Faculdade de Medicina, Universidade de São Paulo
date: "1 October 2018"
output:
word_document:
toc: yes
pandoc_args:
- '--lua-filter=scholarly-metadata.lua'
- '--lua-filter=author-info-blocks.lua'
pdf_document:
number_sections: yes
toc: yes
toc_depth: 4
pandoc_args:
- '--lua-filter=scholarly-metadata.lua'
- '--lua-filter=author-info-blocks.lua'
---
This will be the PDF output:
while this is what it looks like in Word:
The affiliation and contact information is added to the body text, which is why the toc is displayed above it.
R Markdown beamer presentation apalike citation
R Markdown uses a citeproc processor to handle citations unless you set the citation_package
in your output config. The easiest method (and most portable, because it will also work with other output formats) is to not use bibtex but to download the apa.csl citation style definition, e.g., here, and use it with
csl: apa.csl
multiple authors and subtitles in Rmarkdown yaml
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.
Author affiliations in Rmarkdown YAML header, using rticles
As detailed in the documentation you can combine the bookdown
features with other formats. In your case, you have to replace
output: rticles::elsevier_article
with
output:
bookdown::pdf_book:
base_format: rticles::elsevier_article
How to add email under author in pandoc markdown to pdf?
Assuming that the default pandoc template for LaTeX is used for the conversion,
this worked for me:
---
title: My title
subtitle: My subtitle
date: \today
author: |
| My Name
| my.name@email.com
---
Related Topics
Change Level of Multiple Factor Variables
R: Expand and Fill Data Frame by Date in Series
Hyperlinking Text in a Ggplot2 Visualization
Kruskal-Wallis Test with Details on Pairwise Comparisons
Extract Random Effect Variances from Lme4 Mer Model Object
Understanding Color Scales in Ggplot2
How to Know If R Is Running on 64 Bits Versus 32
Boxplot Schmoxplot: How to Plot Means and Standard Errors Conditioned by a Factor in R
Replace Two Dots in a String with Gsub
Using If Else Conditions on Vectors
Fill Area Between Multiple Lines in Plot
Relationship Between R Markdown, Knitr, Pandoc, and Bookdown
Circular Heatmap That Looks Like a Donut
Fastest Way to Detect If Vector Has at Least 1 Na
Difference Between Paste() and Paste0()