[Tex/LaTex] Beamer custom template: Simple head- and footline and a title page

beamerthemes

I'm preparing a talk and i don't like the available beamer themes.
They all seem to bloated to me, the ones that are minimalistic are too "loose" in my opinion. I like to have a frame around the content, just like i would use a header and a footer in a article.

I took some custom themes made by other persons, combined them with the available themes and i got almost where i wanted.

My goal is to have a colored headline (a rectangle) with the frametitle in it. The headline should be always there, but since you shouldn't use a frame without a title that shoudn't be a problem.

For the footline should be nearly the same with the frame numbers at the lower right corner.

The titleframe should be half colored, half white.

Here is what i got:
Theme:

\usepackage{tikz}

\colorlet{sharky_main}{DodgerBlue3!80}
\colorlet{sharky_secondary}{white}
\definecolor{sharky_black}{RGB}{43,40,40}

\setbeamercolor{section in head/foot}{fg=white, bg=sharky_main}

\newdimen\sharky@titleheight
\sharky@titleheight=0.5\paperheight

\newdimen\sharky@authorheight
\sharky@authorheight=3cm

\newdimen\sharky@framebarheight
\sharky@framebarheight=1cm

\newdimen\sharky@frametitlespace
\sharky@frametitlespace=0.25cm

\newdimen\sharky@footbarheight
\sharky@footbarheight=0.35cm

% disable navigation
\setbeamertemplate{navigation symbols}{}

% custom draw the title page above
\setbeamertemplate{title page}{
    \begin{beamercolorbox}[wd=\paperwidth, ht=0.99\paperheight]{title page}
        \begin{tikzpicture}
            % set up the entire slide as the canvas
            \useasboundingbox (0,0) rectangle(\the\paperwidth,\the\paperheight);

            % the background
            \fill[color=sharky_secondary] (0,0) rectangle(\the\paperwidth,\the\paperheight);

            % draw the fills
            \fill[color=sharky_main] (\paperwidth,\paperheight) rectangle +(-\paperwidth,-\paperheight+\sharky@titleheight);

            % draw the actual text
            \node[above, text width=\paperwidth-0.5cm, align=center] at (0.5\paperwidth, \paperheight-\sharky@titleheight) {
                \color{sharky_secondary}\Huge\bfseries\inserttitle \par\vspace{0.5cm} \small\insertsubtitle };
            %\node[above] at(0.5\paperwidth,2.3cm) {\color{sharky_black}\tiny by};
            \node at (0.5\paperwidth, \sharky@authorheight) { \color{sharky_black}\LARGE\bfseries\insertauthor };

            % add the date in the corner
            \node[above] at(0.5\paperwidth,2cm) {\color{sharky_black}\small\insertdate};
        \end{tikzpicture}
    \end{beamercolorbox}
}

\setbeamertemplate{frametitle}
{
    \begin{beamercolorbox}[wd=\paperwidth, ht=0.95\sharky@framebarheight]{frametitle}
        \begin{tikzpicture}
            \path[fill=sharky_main] (0, \paperheight) rectangle (\paperwidth, \paperheight-\sharky@framebarheight);
            \node[right, color=sharky_secondary] at (0, \paperheight-0.5\sharky@framebarheight)
            {\hspace{\sharky@frametitlespace}\color{sharky_secondary}\LARGE\textbf{\insertframetitle}};
        \end{tikzpicture}
    \end{beamercolorbox}
}

\setbeamertemplate{footline}%
{
  \leavevmode%
  \begin{beamercolorbox}[wd=\paperwidth,ht=0.95\sharky@footbarheight]{section in head/foot}%
      \begin{tikzpicture}
          \path[fill=sharky_main] (0, 0) rectangle (\paperwidth, \sharky@footbarheight);
          \node[left=0.15cm, color=sharky_secondary] at (\paperwidth, 0.5*\sharky@footbarheight) { \scriptsize \insertframenumber/\inserttotalframenumber };
      \end{tikzpicture}
  \end{beamercolorbox}
}

Testfile:

\documentclass[x11names, svgnames]{beamer}

\usetheme{sharky}

\title{A nice beamer theme}
\subtitle{Some thoughts}
\author{Patrick Schulz}
\date{Today}

\begin{document}
\frame{\maketitle}
\begin{frame}
    \frametitle{A sample frame}
    Did we get what we wanted?
\end{frame}
\end{document}

Title Frame
Sample Frame

So this doesn't look too bad, but i have some concerns:

  1. The footline is visible on the title page. I read an answer to a question here, they suggested using a \ifnum\thepage=1\else. Using this, the footline gets shifted down and is only half visible. Why is this happening?

  2. I tried out a lot and i don't understand how the beamer boxes are placed.
    Why do i need the beamercolorbox in the frametitle? As i understand it, i can use it to get the font and the color of this specific item. But it also helps the placement of the frametitle. Without it, the hole blue rectangle of the frametitle gets shifted to the right.

    1. I have the feeling i'm using beamer wrong. I would much prefer to use the builtin templates and only adjust the colors, the dimentions and the fonts, but i tried some things and didn't succeed (very vage, i know. I'm sorry). I don't feel that "my" theme is so complicated, but it seems like it.

I would be happy to get a general description how beamer places the templates. I use tikz a lot, here my intuition on how things work and how i can change them is mostly right. If not, i can consult the manual. In beamer i feel very lost.
Thank you very much for reading this long text.

P.s. The theme is called sharky because i like sharks.

Best Answer

I would just put the title page into a plain frame.

\frame[plain]{\titlepage}

Personally I redefine make title like this:

\def\maketitle{%
  \ifbeamer@inframe
    \titlepage
  \else
    \frame[plain]{\titlepage}
  \fi
}

This way I can use \maketitle directly in my presentations without having to put it into a frame.

I don't really understand your second question.

To answer your third question. Yes your implementation is not very "beamer-like". For example you don't use \setbeamerfont{•}{•}. And imho you overcomplicate things with using tikz everywhere. So here is an implementation which is I think a bit more how beamer was intended to be used.

\colorlet{sharky_main}{DodgerBlue3!80}
\colorlet{sharky_secondary}{white}
\definecolor{sharky_black}{RGB}{43,40,40}

\setbeamercolor{section in head/foot}{fg=white, bg=sharky_main}
\setbeamercolor{frametitle}{fg=white, bg=sharky_main}
\setbeamercolor{title page top}{fg=sharky_secondary, bg=sharky_main}
\setbeamercolor{title page bottom}{fg=sharky_black, bg=sharky_secondary}

\setbeamerfont{frametitle}{size=\Large, series=\bfseries}
\setbeamerfont{title}{size=\Huge, series=\bfseries}
\setbeamerfont{subtitle}{size=\small}
\setbeamerfont{author}{size=\LARGE, series=\bfseries}
\setbeamerfont{date}{size=\small}

\newdimen\sharky@frametitlesep
\sharky@frametitlesep=1.5ex
\newdimen\sharky@footbarsep
\sharky@footbarsep=1ex

% disable navigation
\setbeamertemplate{navigation symbols}{}

\def\maketitle{%
  \ifbeamer@inframe
    \titlepage
  \else
    \frame[plain]{\titlepage}
  \fi
}

% custom draw the title page above
\setbeamertemplate{title page}{%
    \begin{beamercolorbox}[wd=\paperwidth, ht=0.5\paperheight, center, sep=0pt]{title page top}
        \usebeamerfont{title}\inserttitle\par
        \vspace{0.5em}%
        \usebeamerfont{subtitle}\insertsubtitle\par
        \vspace{1em}%
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=\paperwidth, ht=0.5\paperheight, center]{title page bottom}
    \vbox to 0.5\paperheight{%
        \vfil%
        \usebeamerfont{author}\insertauthor\par%
        \vspace{0.5em}%
        \usebeamerfont{date}\insertdate\par%
        \vfil%
    }%
    \end{beamercolorbox}
}

\setbeamertemplate{frametitle}{%
    \nointerlineskip%
    \usebeamerfont{frametitle}%
    \begin{beamercolorbox}[wd=\paperwidth,sep=\sharky@frametitlesep]{frametitle}
        \usebeamerfont{frametitle}\insertframetitle%
    \end{beamercolorbox}
}

\setbeamertemplate{footline}{
    \nointerlineskip%
    \usebeamerfont{frametitle}%
    \begin{beamercolorbox}[wd=\paperwidth, sep=\sharky@footbarsep]{section in head/foot}
        \hfill\scriptsize\insertframenumber/\inserttotalframenumber%
    \end{beamercolorbox}
}
Related Question