Daniel
Daniel

Reputation: 63

R Markdown (Pandoc) beamer presentation with short title

I am trying to use beamer_presentation in RMarkdown and in the YAML header I include, say, title: "Long title". This title appears on the first title page of my slides but also at the bottom of all slides. However, at the bottom of all slides I would like a shorter title to appear. I wonder if something like short-title: "Short title" could be used. I know that there is uiucthemes that allows that, but I don't want to use the uiuc style. Thanks!

Upvotes: 6

Views: 3186

Answers (2)

robertspierre
robertspierre

Reputation: 4441

pandoc ≥ 3.5

pandoc versions ≥ 3.5 support this feature natively through the YAML fields shorttitle, shortsubtitle, shortauthor, shortinstitute and shortdate.

Here is a MWE:

---
title: "Title"
shorttitle: "Short Title"
subtitle: "Subtitle"
shortsubtitle: "Short Subtitle"
author: "Author"
shortauthor: "Short Author"
institute: "Inst."
shortinstitute: "Short Inst."
theme: Madrid
date: \today
shortdate: "Short Date"
---

# Section 1

## Slide 1

Lorem ipsum

Compile it with:

pandoc --from markdown --to beamer --slide-level 2 --output main.pdf main.md

See the bug report and the changelog.

pandoc < 3.5

Building on samcarter_is_at_topanswers.xyz's answer, here is a hack which includes all entries.

As far as I can tell, the short version of subtitle is useless, but the other ones are all displayed in the footer bar.

title: "Placeholder, otherwise the title page would not be rendered."
header-includes:
  - \AtBeginDocument{\title[ShortTitle]{LongTitle}}
  - \AtBeginDocument{\subtitle[ShortSubTitle]{LongSubTitle}}
  - \AtBeginDocument{\author[ShortAuthor]{LongAuthor}}
  - \AtBeginDocument{\institute[ShortInstitute]{LongInstitute}}
  - \usepackage[english]{datetime2}
  - \newcommand{\mydate}{\DTMdisplaydate{2024}{10}{09}{-1}}
  - \AtBeginDocument{\date[\DTMsetdatestyle{iso}\mydate]{\mydate}}

Upvotes: -1

You can pass an optional argument to the \title macro which will be used in the footline:

---
title: "Long title"
output: 
  beamer_presentation:
    theme: "CambridgeUS"
    keep_tex: true
header-includes:
  - \AtBeginDocument{\title[short title for footline]{long title for title page}}

---



text

enter image description here

Upvotes: 13

Related Questions