[Tex/LaTex] Beamer title page to show subtitle on click

beamertitles

How can I make a title page in beamer start with just a main title line then on each successive click add a subtitle line and a second subtitle line? And it is important that the already-visible lines will not move, meaning that they should be displayed to their final position initially.

Here is a hack that nearly accomplishes what I am going for:

\documentclass{beamer}
\usetheme{default}
\begin{document}
\title{Title Line}
\subtitle{\vspace{\baselineskip} \vspace{\baselineskip}}
\maketitle
\title{Title Line}
\subtitle{Subtitle Line 1 \vspace{\baselineskip}}
\maketitle
\title{Title Line}
\subtitle{Subtitle Line 1 \\ Subtitle Line 2}
\maketitle
\end{document}

However, notice that (at least in my render of the document) the middle title slide (that has only one of the two subtitles) does not have the middle subtitle line in the same position and size precisely as it ends up in on the third slide, so this looks awkward when transferring between these.

Note that I am using a blank \subtitle with \vspace{\baselineskip} so that the first slide shows the title line in a correct final position. (Although this is an issue sometimes, not in this particular code but when I plug in the actual text I want the title line 'jumps' a few pixels between the slides… this is my main issue, and can be seen in this example on the subtitle between slides 2 and 3)

Best Answer

By replacing \insertsubtitle with \visible<2>{\insertsubtitle} in the default definition of the titlepage, the subtitle gets only visible on the second slide, but its space is already reserved on the first slide.

For more information, I recommend the the section about overlays in the beameruserguide.

\documentclass{beamer}
\usetheme{default}

\title{bla}
\subtitle{blub}

\makeatletter
\setbeamertemplate{title page}
{
    \vbox{}
    \vfill
    \begingroup
    \centering
    \begin{beamercolorbox}[sep=8pt,center]{title}
        \usebeamerfont{title}\inserttitle\par%
        \ifx\insertsubtitle\@empty%
        \else%
        \vskip0.25em%
        {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\visible<2>{\insertsubtitle}\par}%
        \fi%     
    \end{beamercolorbox}%
    \vskip1em\par
    \begin{beamercolorbox}[sep=8pt,center]{author}
        \usebeamerfont{author}\insertauthor
    \end{beamercolorbox}
    \begin{beamercolorbox}[sep=8pt,center]{institute}
        \usebeamerfont{institute}\insertinstitute
    \end{beamercolorbox}
    \begin{beamercolorbox}[sep=8pt,center]{date}
        \usebeamerfont{date}\insertdate
    \end{beamercolorbox}\vskip0.5em
    {\usebeamercolor[fg]{titlegraphic}\inserttitlegraphic\par}
    \endgroup
    \vfill
}
\makeatother

\begin{document}
\begin{frame}
    \titlepage
\end{frame}
\end{document}

enter image description here


EDIT:

A quick hack to get a second line:

\documentclass{beamer}
\usetheme{default}

\title{bla}
\subtitle{blub}

\makeatletter
\setbeamertemplate{title page}
{
    \vbox{}
    \vfill
    \begingroup
    \centering
    \begin{beamercolorbox}[sep=8pt,center]{title}
        \usebeamerfont{title}\inserttitle\par%
        \ifx\insertsubtitle\@empty%
        \else%
        \vskip0.25em%
        {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}%
            \visible<2->{\insertsubtitle}

            \visible<3>{I am a second line}\par}%
        \fi%     
    \end{beamercolorbox}%
    \vskip1em\par
    \begin{beamercolorbox}[sep=8pt,center]{author}
        \usebeamerfont{author}\insertauthor
    \end{beamercolorbox}
    \begin{beamercolorbox}[sep=8pt,center]{institute}
        \usebeamerfont{institute}\insertinstitute
    \end{beamercolorbox}
    \begin{beamercolorbox}[sep=8pt,center]{date}
        \usebeamerfont{date}\insertdate
    \end{beamercolorbox}\vskip0.5em
    {\usebeamercolor[fg]{titlegraphic}\inserttitlegraphic\par}
    \endgroup
    \vfill
}
\makeatother

\begin{document}
\begin{frame}
    \titlepage
\end{frame}
\end{document}