1

I use a custom LaTex beamer theme in an rmarkdown::beamer_presentation.

The custom theme contains a title frame. As per this SO post markdown can be tricked to use the new title frame using header-includes: - \AtBeginDocument{\titleframe}.

My title contains a colon and ideally a linebreak: First line of title:\n second line of title. However, if I include the colon, the compilation of the presentation fails.

How can I escape the colon and, if feasible, force a linebreak right after it?

MWE (YAML header)

---
# do not add title here, else markdown generates a second title page
# ==> add title manually below with header-includes
subtitle: "Beamer presentation with R-markdown"
institute: "some place"
date: "`r format(Sys.time(), '%B %d, %Y')`"
author: "Donald Duck"
output:
  bookdown::pdf_book:
    base_format: rmarkdown::beamer_presentation
    theme: "THEMENAME"
    latex_engine: xelatex
    toc: false
    slide_level: 2
    keep_tex: true 
header-includes:
  - \title{First line of the title: second line of the title}
  - \AtBeginDocument{\titleframe}   
---

For remainder of MWE, i.e. the beamertheme*.sty files, see the mentioned SO post.

jay.sf
  • 60,139
  • 8
  • 53
  • 110
mavericks
  • 1,005
  • 17
  • 42

1 Answers1

2

You can hide the title from markdown in a .tex file:

---
# do not add title here, else markdown generates a second title page
# ==> add title manually below with header-includes
subtitle: "Beamer presentation with R-markdown"
institute: "some place"
date: "`r format(Sys.time(), '%B %d, %Y')`"
author: "Donald Duck"
output:
  bookdown::pdf_book:
    base_format: rmarkdown::beamer_presentation
    theme: "THEMENAME"
    latex_engine: xelatex
    toc: false
    slide_level: 2
    keep_tex: true 
header-includes:
  - \input{preamble}
  - \AfterBeginDocument{\titleframe}   
---

test

preamble.tex:

\title[short version]{First line of the title: second line of the title}
  • For me, the title frame becomes emptied if I use any `includes` while using the `custom beamer theme`. Thus I already had to move all my additions previously in the `preamble.tex` into the theme itself. – mavericks Feb 17 '21 at 15:45
  • 1
    @mavericks missing `-` from your previous question – samcarter_is_at_topanswers.xyz Feb 17 '21 at 15:51
  • Thank you for the hint, my bad. `Preamble.tex` now works fine, but `\AtBeginDocument{\titleframe}` seems to be executed before `Preamble.tex` is called and thus the title frame has no title. – mavericks Feb 17 '21 at 16:05
  • @mavericks updated to not using this annoying rmarkdown interface... – samcarter_is_at_topanswers.xyz Feb 17 '21 at 16:37
  • Thanks so much – works like a charm! Would you have any suggestions on how to resolve the remaining issues mentioned in the [comments to the previous question](https://stackoverflow.com/questions/66230673/how-to-adapt-a-latex-beamer-theme-to-apply-it-in-an-rmarkdownbeamer-present) regarding the linked logo and the additional obsolete white pages before and after the ToC? – mavericks Feb 17 '21 at 16:45
  • @mavericks Can you make a [mre] that allows me tp reproduce your problems without having to guess what you might or might not have in your code? – samcarter_is_at_topanswers.xyz Feb 17 '21 at 16:49
  • just added two new SO posts with MWE for the [redundant blank pages](https://stackoverflow.com/questions/66258624/remove-additional-blank-slides-after-toc-and-insert-black-slides-in-rmarkdownb) and the [linked logo](https://stackoverflow.com/questions/66258762/create-a-hyperlink-from-the-logo-to-the-table-of-contents-slide-in-an-rmarkdown). Thanks a lot in advance for any help you can offer! – mavericks Feb 18 '21 at 11:12