1

It seems I am missing something while defining my title page in beamer. This was my first attempt (of course more sophisticated visually):

\documentclass[aspectratio=169]{beamer}
\usepackage{tikz}

\mode<presentation>
\defbeamertemplate*{title page}{mydefault}{%
\begin{tikzpicture}
\useasboundingbox (0,0) rectangle (\the\paperwidth,\the\paperheight);
\fill[fill=red] (0,0) rectangle (\the\paperwidth,\the\paperheight);
\node[anchor=north west,inner sep=0pt,outer sep=0pt] at (0,\the\paperheight) {This text should be in the upper left corner};
\end{tikzpicture}
}
\mode<all>

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

enter image description here

The issue was, that my red box with the text is not aligned to the upper left corner. If I put the same code into \defbeamertemplate*{background}{mydefault} the positioning is absolute to the upper left corner, but I need to have different backgrounds available for the user to select before he outputs a \titlepage. And just for reference, I want to avoid using [remember picture,overlay] and current page-nodes to avoid multiple compilations.


I then realized, that maybe there is an alternate approach to reach my goal, which is to have 5 different backgrounds, 2 for titles, 1 for section title, one for regular pages and one for the presentation end page.

I read Different backgrounds for title and "normal" frames in beamer before, but it has the exact same issue with a non-absolute position. Then I came across setbackgroundtemplate on title page within custom theme file and Theme with a different footline for the titlepage so I continued to implement:

\documentclass[aspectratio=169]{beamer}
\usepackage{tikz}

\makeatletter
\def\ps@navigation@titlepage{%
    \setbeamertemplate{background}[color][green]
    \@nameuse{ps@navigation}}
\addtobeamertemplate{title page}{\thispagestyle{navigation@titlepage}}{}
\makeatother

\mode<presentation>
\defbeamertemplate*{background}{color}[1][red]{%
\begin{tikzpicture}
\useasboundingbox (0,0) rectangle (\the\paperwidth,\the\paperheight);
\fill[fill=#1] (0,0) rectangle (\the\paperwidth,\the\paperheight);
\node[anchor=north west,inner sep=0pt,outer sep=0pt] at (0,\the\paperheight) {This text should be in the upper left corner};
\end{tikzpicture}
}
\mode<all>

\setbeamertemplate{background}[color][red]

\begin{document}

\title{This shall be a green title}
\begin{frame}
\titlepage
\end{frame}

\begin{frame}
This shall be a regular red content page
\end{frame}

\title{This shall be a blue title}
\begin{frame}
\setbeamertemplate{background}[color][blue]
\titlepage
\end{frame}

\begin{frame}
This shall be a regular red content page
\end{frame}
\end{document}

My problem is now that I don't get how to set another background for another title page, as my understanding is I can only pass one pagestyle to the title page with this way, any ideas? And would it be possible to do something like \begin{frame}[red/blue/green]\titlepage\end{frame} to pass the information into my template?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.