Search code examples
rr-markdownbeamer

Beamer presentation using R Markdown


I'm using R Markdown to make a beamer presentation and I have an issue with slide level.

I choose the Frankfurt theme. This theme allows to have a presentation's plan (bullets in header).

My issue :
When I put "slide_level: 2", I have the content but not the presentation's plan.
When I put "slide_level: 3", I have the presentation's plan but content disappears.

What am I doing wrong ?

Hereunder is the R Markdown

---
title: "Herding"  
author:   
  - Loana  
institute:   
  - Supervised by   
  - University  
date: Academic year 2017-2018  
output:   
  beamer_presentation:  
    incremental: false  
    theme: "Frankfurt"  
    colortheme: "beaver"  
    fonttheme: "structuresmallcapsserif"  
    toc: true   
    slide_level: 2  
    fig_width: 5  
    fig_height: 4  
    fig_caption: true  
    highlight: tango  
link-citations: yes  
urlcolor: red  
linkcolor: red  
citecolor: blue  
---

----

# Title1

## Subtitle1

Text

----

# Title2

## Subtitle2

- Text
- Text

----

Solution

  • To get your desired result, set slide_level: 3 and, correspondingly, use ### to denote frame titles, e.g. ### Slide 1-1. It appears that # represents sections and ## subsections. If you do not wish to have subsections, create dummy subsections (see examples below) and set \AtBeginSubsection{} in your YAML header to suppress subsection title frames.

    ---
    title: "Herding"  
    author:   
      - Loana  
    institute:   
      - Supervised by   
      - University  
    date: Academic year 2017-2018  
    output:   
      beamer_presentation:  
        incremental: false  
        theme: "Frankfurt"  
        colortheme: "beaver"  
        toc: true   
        slide_level: 3
        keep_tex: true
    header-includes: 
    - \AtBeginSubsection{}    
    ---
    
    # Section 1
    ##
    
    ### Slide 1-1
    
    - Text
    
    ### Slide 1-2
    
    - Text
    
    # Section 2
    ##
    
    ### Slide 2-1
    
    - Text
    - Text
    
    ### Slide 2-2
    
    - Test
    

    would give you

    enter image description here enter image description here