# Creating a custom Beamer theme

I'm trying to write a custom Beamer theme and I'm having trouble figuring out how to manage the title page to allow an arbitrary assignment of authors or titles.

I've managed to figure out how to place the title, date, and author information in relative position, but the text must be of a certain number of lines to make everything line up properly with the display boxes (i.e. the Title in the center of the blue box and the author and date information in the center of the green box.) If the title is more or less than 2 lines, it breaks the formatting. If the authors span more than 2 lines it breaks the formatting. I ultimately want the Title to resize within a certain bounding box within the blue area and the author and date to resize within a bounding box in the green box.

What is the best way to accomplish this?

My beamerinnerthemeUniversity.sty file contains the following:

\definecolor{UniversityGreen}{RGB}{0, 133, 66}
\definecolor{UniversityOrange}{RGB}{199, 91, 18}
\definecolor{UniversityBlue}{RGB}{0, 161, 222}

\setbeamertemplate{background}{
\begin{tikzpicture}
\useasboundingbox (0,0) rectangle(\the\paperwidth,\the\paperheight);
\fill[color=UniversityBlue] (0,2) rectangle (\the\paperwidth,\the\paperheight);
\fill[color=UniversityOrange] (0,0) rectangle(2.95,1.9);
\node[inner sep=0] at (1.475,0.95) {\includegraphics[width=.25\textwidth]{University_logo.pdf}};
\fill[color=UniversityGreen] (3.05,0) rectangle(\the\paperwidth,1.9);
\ifnum\thepage>1\relax%
\fill[white,opacity=1] (0,0) rectangle(\the\paperwidth,\the\paperheight);
\fi
\end{tikzpicture}
}

\defbeamertemplate*{title page}{university}[1][]
{
\vskip4cm%
\usebeamerfont{title}\inserttitle\par%
\end{beamercolorbox}%
\vskip1.75cm%
\begin{beamercolorbox}[wd=12cm,leftskip=3cm,#1]{author}
\usebeamerfont{author}\insertauthor%
\end{beamercolorbox}
\vskip0.2cm%
\begin{beamercolorbox}[wd=12cm,leftskip=3cm,#1]{date}
\usebeamerfont{author}\insertdate%
\end{beamercolorbox}
\vfill
}

\setbeamertemplate{items}[square]
\setbeamertemplate{sections/subsections in toc}[square]

\mode
<all>


Here is an example of the output when everything is lined up with a 2-line title and 2 authors with short names:

\documentclass[xcolor={table}]{beamer}
\usepackage[T1]{fontenc}

\usetheme{default}
\RequirePackage{tikz}
\useinnertheme{University}

\begin{document}
\title[A Presentation of Great Import]{A Presentation of Great Import:\\Important discoveries in science}
\author{Bob Smith \and  Sally Johnson}
\institute{State University}

\date{February 24, 2016}

\frame{\titlepage}
\end{document}


Here is an example of the overflow with a longer title and more authors

\documentclass[xcolor={table}]{beamer}
\usepackage[T1]{fontenc}

\usetheme{default}
\RequirePackage{tikz}
\useinnertheme{University}

\begin{document}
\title[A Presentation of Great Import]{A Presentation of Great Import:\\Important discoveries in science\\and a further digression on important things}
\author{Bob Smith \and  Sally Johnson \and Uma Thirugnanasampanthan}
\institute{State University}

\date{February 24, 2016}

\frame{\titlepage}
\end{document}


• Maybe \parbox[b][3ex][c]{.7\paperwidth}{\centering \insertframetitle} – Bobyandbob Feb 23 '17 at 20:47
• Can you make a compilable minimal working example (MWE)? – user36296 Feb 23 '17 at 20:52
• I tried to make the MWE as small as possible while still compiling and illustrating the basic question. – WildGunman Feb 23 '17 at 21:24

To keep the text inside it's respective boxes, I placed the text inside minipages, which means you can simply control the alignment via \begin{minipage}[c][.8\textheight][c]{\textwidth}, in this example the text is vertically centred.

\documentclass{beamer}

\usepackage{tikz}

\definecolor{UniversityGreen}{RGB}{0, 133, 66}
\definecolor{UniversityOrange}{RGB}{199, 91, 18}
\definecolor{UniversityBlue}{RGB}{0, 161, 222}

\setbeamertemplate{background}{
\begin{tikzpicture}
\useasboundingbox (0,0) rectangle(\the\paperwidth,\the\paperheight);
\fill[color=UniversityBlue] (0,2) rectangle (\the\paperwidth,\the\paperheight);
\fill[color=UniversityOrange] (0,0) rectangle(2.95,1.9);
\node[inner sep=0] at (1.475,0.95) {\includegraphics[width=.2\textwidth]{example-image}};
\fill[color=UniversityGreen] (3.05,0) rectangle(\the\paperwidth,1.9);
\end{tikzpicture}
}

\defbeamertemplate*{title page}{university}[1][]{%
\begin{minipage}[c][.8\textheight][c]{\textwidth}
\usebeamerfont{title}
\inserttitle\par
\end{minipage}
\vskip1pt
\hskip.2\paperwidth
\begin{minipage}[c][.2\textheight][c]{.75\textwidth}
\usebeamerfont{author}
\raggedright
\insertauthor\par
\insertdate\par
\end{minipage}
}

\setbeamertemplate{items}[square]
\setbeamertemplate{sections/subsections in toc}[square]

\mode
<all>

\title[A Presentation of Great Import]{A Presentation of Great Import:\\Important discoveries in science}
\author{Bob Smith \and  Sally Johnson}
\institute{State University}

\date{February 24, 2016}

\begin{document}

\begin{frame}[plain]
\titlepage
\end{frame}

\title[A Presentation of Great Import]{A Presentation of Great Import:\\Important discoveries in science\\and a further digression on important things}
\author{Bob~Smith \and  Sally~Johnson \and Uma~Thirugnanasampanthan}
\institute{State University}

\begin{frame}[plain]
\titlepage
\end{frame}

\end{document}


• This works great for properly bounding the location of the text. Thanks! I was wondering if there was any way to auto shrink the text if the text was going to be larger than the bounding box. So imagine that there was another line of authors. Could LaTeX auto-size the text to be small enough to fit into the green box? – WildGunman Feb 23 '17 at 22:30
• @WildGunman I would not do automatic resizing (although possible, for example \resizebox), but either replace the author list by one with initials for the first names or adjust the size with \setbeamerfont{author}{...} – user36296 Feb 23 '17 at 22:36