How do I remove / change the footer at certain slides in my theme `.sty` file?
I basically want to avoid using `\setbeamertemplate{footline}{}` in my `.tex`. E.g. on the title slide / toc / section slide...
# Failed attempts
## Using `\newif`
```latex
\newif\ifbeamer@test@title
\beamer@test@titlefalse
\defbeamertemplate*{title page}{test}{
\beamer@test@titletrue
<...>
\beamer@test@titlefalse
}
\defbeamertemplate*{footline}{test}{
\ifbeamer@test@title
\else
<...>
\fi
}
```
# Minimal Working Example
Here a reduced MWE only considering the title page, however the solution should be general enough such that it can also be used for the table of content / section slides
`cat beamerthemetest.sty`
```latex
\mode<presentation>
%% goes to inner theme
\defbeamertemplate*{title page}{test}
{
\beamer@test@titletrue
{
\vspace{42pt}
\begin{beamercolorbox}{title}
\usebeamerfont{title}\inserttitle
\ifx\insertsubtitle\@empty
\else
\par\usebeamerfont{subtitle}\insertsubtitle
\fi
\end{beamercolorbox}
\begin{beamercolorbox}{author}
\usebeamerfont{author}\insertauthor
\end{beamercolorbox}
}
\beamer@test@titlefalse
}
%% goes to outer theme
\defbeamertemplate*{footline}{test}
{
\begin{beamercolorbox}[wd=\paperwidth, dp=1mm, ht=3.5mm
, leftskip=1mm, rightskip=1mm
]{footline}%
\usebeamerfont{title in head/foot}%
\makebox[240pt][l]{
\insertshorttitle\ - \insertsectionhead\ %
\ifx\insertsubsectionhead\@empty\relax\else%
- \insertsubsectionhead%
\fi
}
\hfill\makebox[20pt][r]{\insertframenumber/\inserttotalframenumber}%
\end{beamercolorbox}%
\fi
}
\mode<all>
```
with the `test.tex`
```latex
\documentclass[aspectratio=169]{beamer}
\usetheme{test}
\author{whoami}
\title{title}
\begin{document}
\maketitle
\section{abc}
\begin{frame}{abc}
cde
\end{frame}
\end{document}
```
Top Answer
samcarter
There is a very nice little trick that allows you to use special footlines for title, toc and section pages from within your `.sty` file.
The basic idea is to define one (or more) new page styles which will set the desired footline and patch the titlepage and toc macros to use this page style:
```
\documentclass{beamer}
\defbeamertemplate{footline}{special footline}{%
special footline
}
\setbeamertemplate{footline}{%
normal footline
}
\makeatletter
\def\ps@navigation@titlepage{%
\setbeamertemplate{footline}[special footline]
\@nameuse{ps@navigation}
}
\addtobeamertemplate{title page}{\thispagestyle{navigation@titlepage}}{}
\makeatother
\AtBeginSection[]{%
\begingroup
\setbeamertemplate{footline}[special footline]
\begin{frame}
\sectionpage
\end{frame}
\endgroup
}
\pretocmd{\tableofcontents}{\thispagestyle{navigation@titlepage}}{}{}
\begin{document}
\maketitle
\begin{frame}
\tableofcontents
\end{frame}
\section{abc}
\begin{frame}
\frametitle{abc}
cde
\end{frame}
\end{document}
```