7

When I use R Markdown to create slides for a beamer presentation, the text is vertically centered, which really looks odd if you only want to use 1-2 lines a slide. Is there anyway to align the text to the top of the slide (under the slide caption)?

Looking for answer, I found this post and tried to use it in R Markdown, but nothing I tried worked.

You can change the horizontal text alignment and font size for instance by using these commands

\begin{flushright}
\begin{tiny}

bla..

\end{tiny}
\end{flushright}

is there something similar for vertical text alignment? So far I've tried this:

Attempt 1:

---
title: "Untitled"
author: "Author"
date: "25 Januar 2017"
output: beamer_presentation
---
\documentclass[t]{beamer}

## Caption 1
test

Attempt 2:

---
title: "Untitled"
author: "Author"
date: "25 Januar 2017"
output: beamer_presentation
---

## Caption 1
\begin{frame}[t]
test
\end{frame}

Attempt 3:

---
title: "Untitled"
author: "Author"
date: "25 Januar 2017"
output: beamer_presentation
---

## Caption 1
\begin{flushleft}[t]
test
\end{flushleft}
Community
  • 1
  • 1
JAQuent
  • 1,137
  • 11
  • 25

1 Answers1

13

Include classoption: t with the title, author, etc. For example:

title: "Title"
author: "Author"
date: "Date"
output: beamer_presentation
classoption: t
darthbith
  • 18,484
  • 9
  • 60
  • 76
Ryan
  • 302
  • 3
  • 4
  • 7
    In case anyone else stumbles across this with a similar query, this answer works and applies the class option across the entire slide deck. However, if you want to only apply this to a particular slide, you can use `# New Slide {.t}`. I can't believe how long I've used Rmd/Beamer and not realized this was so straightforward! – Twitch_City May 21 '18 at 23:53
  • @Twitch_City Thank you so much for the very useful hint! If I would like a slide to be `plain` and its content top-aligned as well, how would this look alike? See my [SO Q here](https://stackoverflow.com/questions/66311999/passing-multiple-classoptions-to-a-single-slide-in-an-rmarkdownbeamer-presenta) – mavericks Feb 22 '21 at 08:05