rpowerpointquarto

Force the title and subtitle to appear on the same slide of a pptx output in Quarto R


I want to be able to create a PowerPoint output in R (using quarto, qmd) but I've been having some difficulties in the actual format of the powerpoint.

When I execute the following code:

---
title: "My presentation"
subtitle: "January 2023"
author: "Me"
format: pptx
reference-doc: template6.pptx
mainfont: Open Sans
sansfont: Open Sans
---
 
# Title 
## Subtitle

I receive a pptx output with two separate slides, as shown:

pptx example1

What I am looking for is something like in the picture bellow:

pptx example2

A title, in a certain color (and larger size) and bellow a subtitle with another color (with a smaller size).

I've tried messing around with the template, but I didn't find anything close to it. I know adding it manually would solve the problem, but I'm really adamant about keeping this process as most "automatic" as possible.

Can anyone help?


Solution

  • You can use the slide-level option in your document's YAML header.

    So in your case, using:

    ---
    title: "My presentation"
    subtitle: "January 2023"
    author: "Me"
    format: pptx
    reference-doc: template6.pptx
    mainfont: Open Sans
    sansfont: Open Sans
    slide-level: 1
    ---
    

    ensures that new slides are created when a heading is level 1 but not for any subheadings. Alternatively, you can turn off new slide creation via headings by using slide-level: 0 and create new slides manually using horizontal rules (e.g. using three dashes ---).

    From the documentation:

    slide-level

    Specifies that headings with the specified level create slides. Headings above this level in the hierarchy are used to divide the slide show into sections; headings below this level create subheads within a slide. Valid values are 0-6. If a slide level of 0 is specified, slides will not be split automatically on headings, and horizontal rules must be used to indicate slide boundaries. If a slide level is not specified explicitly, the slide level will be set automatically based on the contents of the document.