latexr-markdownbeamer

How to customize the title page of beamer presentation?


It is very often one needs to customize the title page of presenation.

For example, we want to :

Base look:

---
title: "My beautiful presentation"
author: "John Doe"
institute: "New Town University"

output: 
  beamer_presentation:
     latex_engine: lualatex

keep_tex: true
header-includes: |
  \usepackage{tikz}
  \usepackage[absolute,overlay]{textpos}       
  \usetheme{metropolis}       
---

enter image description here

Then comes the strange, when I want to add something via (title: etc. were removed):

  \setbeamertemplate{title page}{
    \insertsubtitle{My new presentation}
  } 

... my title page disappears (now toc is the 1st page).

enter image description here

Same situation when I try to add new label via \begin{textblock*} ... \end{textblock*} or \includegraphics[trim= ...]{pic.png}

When title etc. were retained - we see only subtitle/textblock/pic:

enter image description here

Where is a problem?


An update.

Under label I supposed a text in the desired position. Sorry for the mispresentation.

Look to this pic, how to do this?

enter image description here

Also I want to ask, how to combine this solution with rmarkdown? Adding frame by frame in header-includes is ok, but how to add frames with R-code via #, ## etc.?


Solution

  • If you use

    \setbeamertemplate{title page}{
      ...
    } 
    

    you instruct latex to throw away the existing title page and replace it with whatever code you write inside this template.

    Furthermore the syntax \insertsubtitle{My new presentation} is wrong. To set the subtitle, you should use \subtitle{...} (not inside the title page!) and if you'd like to insert the subtitle in a custom title page, you can use \insertsubtitle (this macro does not have any arguments!)


    • remove title page number;

    use a plain frame

    • add logo or banner;

    use \titlegraphic{...}

    • move title, subtitle etc.;

    If you only need minor modifications, you can adjust the respective templates which get used on the title page. For example to centre the title graphic and add some text above it, adjust the title graphic template.

    If you need to completely overhaul the title page, copy the definition from the theme you use and then make the changes you like.

    Start with the definition from the metropolis theme and modify it to whatever layout you like

    • add a label;

    like in any other frame with the label=... option


    \documentclass{beamer}
    
    \title{text}
    \author{names}
    
    \usetheme{moloch}
    \addtobeamertemplate{title graphic}{\centering some text here\par}{}
    \titlegraphic{\includegraphics[width=3cm]{example-image-duck}}
    
    \begin{document}
        
    \begin{frame}[plain,label=whatever]
        \titlepage
    \end{frame} 
        
    \end{document}
    

    ---
    output: 
      beamer_presentation:
         latex_engine: lualatex
    
    keep_tex: true
    header-includes: |
      \usetheme{moloch}  
      \addtobeamertemplate{title graphic}{\centering some text here\par}{}
      \titlegraphic{\includegraphics[width=3cm]{example-image-duck}}
      \AfterBeginDocument{\title{text}\author{names}}   
    ---
    
    ##  {.plain}
    \titlepage
    
    ##
    
    \tableofcontents
    
    # a new section
    
    ## next frame
    

    enter image description here