The following is the least TeXy way I know of to create a beamer slide with a subtitle:
---
output: beamer_presentation
---
### Title of Slide
\framesubtitle{Subtitle of Slide}
Frame content.
Is there a way using no LaTeX, or does R Markdown not directly support slide subtitles?
Markdown doesn't support \framesubtitle
s. It assumes you'll use the regular markdown #
's to denote sectional units, and a specific (highest) level is used for frame titles. Anything lower than that will only create headers within the frame, but not a subtitle. From the Pandoc Manual (based on a specified --slide-level
or the default):
The document is carved up into slides according to the following rules:
A horizontal rule always starts a new slide.
A header at the slide level always starts a new slide.
Headers below the slide level in the hierarchy create headers within a slide.
Headers above the slide level in the hierarchy create "title slides," which just contain the section title and help to break the slide show into sections.
Content above the slide level will not appear in the slide show.
Of specific interest here is that "headers below the slide level in the hierarchy creates headers within a slide." These headers are actually block
environments, since the following minimal markdown
---
title: A title
output:
beamer_presentation:
keep_tex: true
slide_level: 1
---
# Title of Slide
## Subtitle of Slide
Frame content.
creates a .tex
file:
\title{A title}
\date{}
\begin{document}
\frame{\titlepage}
\begin{frame}{Title of Slide}
\begin{block}{Subtitle of Slide}
Frame content.
\end{block}
\end{frame}
\end{document}
If your presentation is fairly simple, you can trick LaTeX into converting a block
environment into the \framesubtitle
. Add the following file (call it block-to-framesubtitle.tex
) in your working folder:
\usepackage{environ}
\RenewEnviron{block}[1]{\framesubtitle{#1}\BODY}
Now you can use
---
title: A title
output:
beamer_presentation:
slide_level: 1
header-includes:
- \input{block-to-framesubtitle}
---
# Title of Slide
## Subtitle of Slide
Frame content.