[Tex/LaTex] In beamer, problem positioning images (logo and background) and text in a robust way when creating the own template (title frame and following frames)

beamerpositioningtemplates

I have now been struggling for a few days on what I thought should be fairly easy. I am trying to create a template resembling my university's powerpoint template.

  1. Title page: I am trying to import the title page from the powerpoint, that I converted in pdf. After struggling to centre it, I also tried to move the title up so that it doesn't overlap the darkest area of the image. As you can see in the attached code, this was probably done in a clumsy way, since the image easily gets off-centre depending on the size of the title.

  2. Frame template: Here I only want a simple rectangle on the left hand side, the logo of the university on the top left and the frame title to be right-justified. Again, I thought I succeeded in doing that (albeit in a clumsy way) but it proved extremely poorly robust when I tried to fill the slides: a simple bullet list makes the rectangle on the side disappear.

    Any suggestion for a more robust implementation for both slides?

I also attach the tex and sty files. As a new user, I cannot attach any picture, but a pdf giving an idea of what I am trying to achieve and what is going wrong can be found here: example with images

The problem with the front page manifests for example with a single line title, the problem with the following frame manifests with the bullet list when the rectangle on the left edge disappears.

tex file:

\documentclass{beamer}
\usepackage{tikz}
\usepackage{multimedia}
\usepackage[overlay]{textpos}

\usetheme{GUtemplate}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{helvet}

\title{\textbf{Thesis \\title}}
\subtitle{PhD examination \\ 12 November 2012}
\author{\textbf{My Name}}
\date{\today}
\institute{University of Glasgow}

\begin{document}

%% Title Frame %%
\begin{frame}
\titlepage
\end{frame}

%% Outline Frame %%
\begin{frame}
\frametitle{Outline}
This is the outline of the thesis:
\begin{itemize}
    \item<2-> Part 1
    \item<3-> Part 2
\end{itemize}
\end{frame}



\begin{frame}
\frametitle{Another Frame}
blablablblablllblablablaaaaaaaaaaaablablabla \ldots
\end{frame}

\end{document}

and the sty file:

\ProvidesPackage{beamerthemeGUtemplate}[2011/09/20]

%% Declare colors %%
\definecolor{DarkBlue}{RGB}{0,82,136}
\definecolor{USMPurple}{RGB}{50,35,109}
%%

%% Custom title page %%
\defbeamertemplate*{title page}{customized}[1][] {
  \begin{textblock*}{\paperwidth}(-1.02cm, -3.2cm)
    \includegraphics[width=\paperwidth, height=\paperheight]{titlepage}
  \end{textblock*} 
  \centering
  \vspace{-1.5cm}
  \usebeamerfont{title}\inserttitle\par 
  \bigskip \medskip
  \usebeamerfont{author}\insertauthor\par
  \usebeamerfont{institute}\insertinstitute\par
  \begin{textblock*}{\paperwidth}(-1.3cm,-4.7cm)
    \begin{flushright}
        \setbeamerfont{subtitle}{size=\fontsize{7}{8}}
    \usebeamercolor[DarkBlue]{subtitle}
        {\fontfamily{times}\selectfont \bf{\insertsubtitle}}
    \end{flushright}
  \end{textblock*}
}
%%

%% Custom slides %%
\setbeamertemplate{frametitle}[default][right]
\setbeamersize{text margin left=1cm, text margin right=1cm}
\setbeamerfont{frametitle}{size={\fontsize{15}{17}}}

\addtobeamertemplate{frametitle}{}{
  \begin{textblock*}{0cm}(-0.686cm,-0.828cm)
    \includegraphics[width=0.35\paperwidth, height=0.35\paperheight,keepaspectratio]{logo}
  \end{textblock*}
  \begin{textblock*}{0cm}(-1cm,-0.895cm)
    \begin{tikzpicture}
      \draw<1>[DarkBlue,fill] (0,-\paperheight) rectangle (0.3,\paperheight);
    \end{tikzpicture}
  \end{textblock*}
}
%%


\usecolortheme[named=DarkBlue]{structure}
\setbeamercolor{title page}{fg=DarkBlue}
\setbeamercolor{logo}{bg=white}
\setbeamercolor{frametitle}{fg=white,bg=DarkBlue}

Best Answer

A few ideas:

  • To prevent the height of the title moving everything on the title slide around, you could set the frame vertical alignment for that frame to top instead of the default of center, by adding [t] after the \begin{frame}.
  • You can align the background image at the top of the frame by using the techniques from http://www.tex.ac.uk/cgi-bin/texfaq2html?label=topgraph. An alternative approach is to use \usebackgroundtemplate, see eg How to insert a background image in a beamer frame?.
  • Your filled rectangle on the left side is only drawn on the first slide of each frame due to your use of the overlay specification <1> in the \draw command.
  • For some reason the position of the textblock*s appears to be affected by where they appear in the code. You might prefer to use tikz's remember picture,overlay options and current page node (and compile twice).

I am not entirely sure what you want the resulting document to look like, and I do not have the logo and titlepage graphic files you used to compile your example.

I have created an example illustrating some of the above points, but this is just for ideas and I do not expect the output to be as you wish directly, and the coding is still clumsy in places. I have replaced the images with example images from the mwe package.

  • beamerthemeGUtemplate.sty:

    \ProvidesPackage{beamerthemeGUtemplate}[2011/09/20]
    
    %% Declare colors %%
    \definecolor{DarkBlue}{RGB}{0,82,136}
    \definecolor{USMPurple}{RGB}{50,35,109}
    %%
    
    %% Custom title page %%
    \defbeamertemplate*{title page}{customized}[1][] {%
      \begin{textblock*}{\paperwidth}(-\beamer@leftmargin,0cm)%(-1.02cm, -3.2cm)
        \vtop{%
          \vskip-1ex\hbox{\includegraphics[width=\paperwidth, height=\paperheight]{example-image-a}}%
        }%
      \end{textblock*}
      \begin{textblock*}{\dimexpr\paperwidth-\beamer@rightmargin\relax}(-\beamer@leftmargin,0cm)
        \begin{flushright}
            \setbeamerfont{subtitle}{size=\fontsize{7}{8}}
        \usebeamercolor[DarkBlue]{subtitle}
            {\fontfamily{times}\selectfont \bf{\insertsubtitle}}
        \end{flushright}
      \end{textblock*}
      \centering
      \usebeamerfont{title}\vskip3em\inserttitle\par 
      \bigskip \medskip
      \usebeamerfont{author}\insertauthor\par
      \usebeamerfont{institute}\insertinstitute\par
    }
    %%
    
    \usetikzlibrary{calc}
    
    %% Custom slides %%
    \setbeamertemplate{frametitle}[default][right]
    \setbeamersize{text margin left=1cm, text margin right=1cm}
    \setbeamerfont{frametitle}{size={\fontsize{15}{17}}}
    
    \addtobeamertemplate{frametitle}{}{
    %  \begin{textblock*}{0cm}(-0.686cm,-0.828cm)
      \tikz[remember picture,overlay] {%
        \node[anchor=north west,inner sep=0pt] at ($(current page.north west)+(0.3cm,0cm)$) {
        \includegraphics[width=0.35\paperwidth, height=0.35\paperheight,keepaspectratio]{example-image-b}
        };
      }
    %  \end{textblock*}
      \tikz[remember picture,overlay] {%
        \draw[DarkBlue,fill]
            (current page.north west) rectangle ($(current page.south west)+(0.3cm,0cm)$);
      }
    %  \begin{textblock*}{0cm}(-\beamer@leftmargin,-0.895cm)
    %    \begin{tikzpicture}
    %      \draw[DarkBlue,fill] (0,-\paperheight) rectangle (0.3,\paperheight);
    %    \end{tikzpicture}
    %  \end{textblock*}
    }
    %%
    
    
    \usecolortheme[named=DarkBlue]{structure}
    \setbeamercolor{title page}{fg=DarkBlue}
    \setbeamercolor{logo}{bg=white}
    \setbeamercolor{frametitle}{fg=white,bg=DarkBlue}
    
  • tex file:

    \documentclass{beamer}
    \usepackage{tikz}
    \usepackage{multimedia}
    \usepackage[overlay]{textpos}
    
    \usetheme{GUtemplate}
    \usepackage{mwe}
    
    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{helvet}
    
    \setcounter{errorcontextlines}{50}
    \title{\textbf{Thesis \\title}}
    \subtitle{PhD examination \\ 12 November 2012}
    \author{\textbf{My Name}}
    \date{\today}
    \institute{University of Glasgow}
    
    \begin{document}
    
    %% Title Frame %%
    \begin{frame}[t]
    \titlepage
    \end{frame}
    
    %% Outline Frame %%
    \begin{frame}
    \frametitle{Outline}
    This is the outline of the thesis:
    \begin{itemize}
        \item<2-> Part 1
        \item<3-> Part 2
    \end{itemize}
    \end{frame}
    
    
    
    \begin{frame}
    \frametitle{Another Frame}
    blablablblablllblablablaaaaaaaaaaaablablabla \ldots
    \end{frame}
    
    \end{document}