# LaTeX Beamer: Remove Frame Header when new Section starts

I want to remove the frame header line every time a new section starts.

I created my own command to do that but I have some problems with the \ifnum command.

I tried to use \ifnum\insertframenumber=\insertsectionstartpage as a condition to check if a new section starts an then remove the header (like frame 2). LaTeX always seems to execute the else branch, although the condition should evaluate to true... I also tried the \ifthenelse command, but it didn't work either.

Does anybody have an explanation for that?

Here my minimal working example:

\documentclass[t,8pt]{beamer}
\usepackage{ifthen}

\usetheme{Warsaw}

{
\makeatletter
\makeatother
\begin{frame}{#1}
#2
\end{frame}
}
\else
\begin{frame}{#1}
\end{frame}
\fi
}

\begin{document}

\section{Test1}

That is a test
}

\section{Test2}

{
\makeatletter
\makeatother
\begin{frame}{New Frame}
Test
\end{frame}
}

\section{Test3}

\end{document}

• Sounds like you are comparing apples to oranges. If you want to compare to the framenumber you have to use the section start frame and not page. See tex.stackexchange.com/a/302320/36296 how to get the section start frame. – user36296 Feb 8 '17 at 13:42
• Btw: In the long run, creating a wrapper command for a frame creates more problems then it solves. Just image you need to use some frame options like fragile or plain. – user36296 Feb 8 '17 at 13:55

\documentclass{beamer}
\usetheme{Warsaw}

\usepackage{etoolbox}
\makeatletter
\newcount\beamer@sectionstartframe
\beamer@sectionstartframe=1
\AtEndDocument{\immediate\write\@auxout{\string\@writefile{nav}%
\def\beamer@startframeofsection{1}
\def\beamer@endframeofsection{1}
\def\beamer@sectionframes#1#2{%
\else%
\else%
\gdef\beamer@startframeofsection{#1}%
\gdef\beamer@endframeofsection{#2}%
\fi%
\fi%
}
\newcommand\insertsectionstartframe{\beamer@startframeofsection}
\newcommand\insertsectionendframe{\beamer@endframeofsection}

\else%
\leavevmode%
\@tempdimb=2.4375ex%
\ifnum\beamer@subsectionmax<\beamer@sectionmax%
\multiply\@tempdimb by\beamer@sectionmax%
\else%
\multiply\@tempdimb by\beamer@subsectionmax%
\fi%
\ifdim\@tempdimb>0pt%
\end{beamercolorbox}%
\end{beamercolorbox}%
\fi%
\vskip-0.2pt
\vskip-2pt
\fi%
}
\makeatother

\begin{document}

\section{The First}

\begin{frame}
First slide
\end{frame}

\begin{frame}
Second slide
\end{frame}

\begin{frame}
Third slide
\end{frame}

\begin{frame}
Fourth slide
\end{frame}

\section{The Second}

\begin{frame}
First slide
\end{frame}

\begin{frame}
Second slide
\end{frame}

\begin{frame}
Third slide
\end{frame}

\end{document}