rmarkdown: how can you show the title and the content of a two column slide in the same slide?

Hi,

As part of our LIBD rstats club, we recently attended (virtually) Nathan Stephen's webinar on using R Markdown for creating PowerPoint presentations (on 2018-11-28) (should appear here soon, raw files). We were able to play around with using templates and could do most of the things Nathan showcased. We however ran into an issue where we couldn't get the title of a slide to show up in the same slide as a two column slide. Here's our Rmd file PowerPoint presentations with R Markdown - LIBD rstats club meeting 2018-11-30 ยท GitHub that uses the template from powerpoint/vignettes/template.potx at main ยท sol-eng/powerpoint ยท GitHub and as far as we can see, we are following the same mark up as in powerpoint/vignettes/2c-columns-and-notes.Rmd at main ยท sol-eng/powerpoint ยท GitHub that does render the title in the same slide as you can see at powerpoint/vignettes/2c-columns-and-notes.pptx at main ยท sol-eng/powerpoint ยท GitHub.

### Two column

:::::::::::::: {.columns}
::: {.column}
hello
:::
::: {.column}
bye
:::
::::::::::::::

We get the same result even if we don't use the template file.

Thanks,
Leo

> options(width = 120)
> sessioninfo::session_info()
โ”€ Session info โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
 setting  value                                      
 version  R version 3.5.1 Patched (2018-10-14 r75439)
 os       macOS Mojave 10.14.1                       
 system   x86_64, darwin15.6.0                       
 ui       RStudio                                    
 language (EN)                                       
 collate  en_US.UTF-8                                
 ctype    en_US.UTF-8                                
 tz       America/New_York                           
 date     2018-11-30                                 

โ”€ Packages โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
 package     * version date       lib source                            
 assertthat    0.2.0   2017-04-11 [1] CRAN (R 3.5.0)                    
 backports     1.1.2   2017-12-13 [1] CRAN (R 3.5.0)                    
 cli           1.0.1   2018-09-25 [1] CRAN (R 3.5.0)                    
 colorout    * 1.2-0   2018-05-03 [1] Github (jalvesaq/colorout@c42088d)
 crayon        1.3.4   2017-09-16 [1] CRAN (R 3.5.0)                    
 digest        0.6.18  2018-10-10 [1] CRAN (R 3.5.0)                    
 evaluate      0.12    2018-10-09 [1] CRAN (R 3.5.0)                    
 htmltools     0.3.6   2017-04-28 [1] CRAN (R 3.5.0)                    
 knitr         1.20    2018-02-20 [1] CRAN (R 3.5.0)                    
 Rcpp          1.0.0   2018-11-07 [1] CRAN (R 3.5.0)                    
 rmarkdown   * 1.10    2018-06-11 [1] CRAN (R 3.5.0)                    
 rprojroot     1.3-2   2018-01-03 [1] CRAN (R 3.5.0)                    
 rstudioapi    0.8     2018-10-02 [1] CRAN (R 3.5.0)                    
 sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 3.5.0)                    
 withr         2.1.2   2018-03-15 [1] CRAN (R 3.5.0)                    
 yaml          2.2.0   2018-07-25 [1] CRAN (R 3.5.0)                    

[1] /Library/Frameworks/R.framework/Versions/3.5devel/Resources/library

Using RStudio:

Version 1.2.1153

ยฉ 2009-2018 RStudio, Inc.

Build 1161 (116a3b35)

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.11.1 Chrome/65.0.3325.230 Safari/537.36

So, I haven't actually made one of these before, but I was able to get a two column layout with title working by playing around with some things:

Since it uses a template (as you're doing), I modified from the 2d example in the sol-eng GitHub repo.

The section that references two-columns wasn't actually using two columns. So, I modified it to follow the pattern from the 2c vignette you referenced:

### 4. Two Content
:::::::::::::: {.columns}
::: {.column}
* This layout has a placeholder for a title and two placeholders for content. 
* This layout is used when you specify two columns for a content slides at the slide level.
:::
::: {.column}
```

:::::::::::::: {.columns}
::: {.column}
contents...
:::
::: {.column}
contents...
:::
::::::::::::::
```
:::
::::::::::::::

which got me this:

Here's the same with the content from your Rmd:

### Two-column
:::::::::::::: {.columns}
::: {.column}
hello
:::
::: {.column}
bye
:::
::::::::::::::
2 Likes

Hi Mara,

Thanks for looking into this!

Initially, pasting your code didn't resolve our issue (the title was still in a different slide). That's until I noticed that your code has 3 ### (just like the one in the gist I posted) while the rest of the slides had only 2 ##. This immediately reminded me of powerpoint/vignettes/3-structuring-the-presentation.Rmd at main ยท sol-eng/powerpoint ยท GitHub that Nathan mention in his webinar. Looking at file again, the answer lies in this rule: powerpoint/vignettes/3-structuring-the-presentation.Rmd at main ยท sol-eng/powerpoint ยท GitHub

**By default, Pandoc sets the slide level to the highest header level in the hierarchy that is followed immediately by content somewhere in the document.**

Since the first slide has only 2 ##:

## R Markdown

This is an R Markdown presentation. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.

We needed to use 2 ## instead of 3 ### for the slide title. So changing our code to:

## Two column

:::::::::::::: {.columns}
::: {.column}
hello
:::
::: {.column}
bye
:::
::::::::::::::

or your code to

    ## 4. Two Content
    :::::::::::::: {.columns}
    ::: {.column}
    * This layout has a placeholder for a title and two placeholders for content. 
    * This layout is used when you specify two columns for a content slides at the slide level.
    :::
    ::: {.column}
    ```

    :::::::::::::: {.columns}
    ::: {.column}
    contents...
    :::
    ::: {.column}
    contents...
    :::
    ::::::::::::::
    ```
    :::
    ::::::::::::::

Now both slides work!

Here's the corrected gist: (fixed) PowerPoint presentations with R Markdown - LIBD rstats club meeting 2018-11-30 ยท GitHub

Thanks,
Leo

3 Likes

:tada: Nice detective work! I'm gonna mark your solution asโ€ฆwell, the solution, so it's easier for others to find in the future! :male_detective:โ€โ™‚

1 Like

Hehe, thanks Mara ^^

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.