R Markdown (Pandoc) beamer presentation with short title
Asked Answered
S

2

6

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!

Scoter answered 8/5, 2018 at 4:22 Comment(3)
You'd probably have to use a custom template, see pandoc.org/MANUAL.html#templatesVelma
There is a PR which will allow to specify short titles in the header: github.com/jgm/pandoc/pull/10244Lebel
The PR has been merged. See my answer.Sorilda
L
13

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

Lebel answered 30/10, 2019 at 13:17 Comment(0)
S
-1

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}}
Sorilda answered 1/10, 2024 at 22:19 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.