3

I'm trying to create a custom theme for beamer. However, when I tried to patch the navigation circles to be automatically included without subsections (using the solution of Beamer navigation circles without subsections?) the title page appears in the navigation circles.

I tried to remove all parts, but I can't find why it keeps adding the title page to the navigation bar. I tried my best to reduce the source to a MWE, and this code (below) produces the wrong circle. If you need more information I can provide the full or needed files.

enter image description here

\documentclass{beamer}
\usepackage{etoolbox}
\usepackage{tikz}

\makeatletter

\colorlet{firstColor}{gray!50}
\colorlet{secondColor}{red!80!black}

\beamer@compresstrue

\defbeamertemplate*{headline}{}
{%
\leavevmode
\ifnum\insertframenumber>0\relax%remove it for the title page
\begin{beamercolorbox}[wd=\the\paperwidth,ht=0.6cm]{section in head/foot}
  \begin{tikzpicture}
    \useasboundingbox[fill=white](0,0) rectangle(\the\paperwidth,0.6);
    \fill[secondColor] (0,0) rectangle(0.3,0.6);
    \fill[firstColor] (0.35,0) rectangle(\the\paperwidth,0.6);
    \node[anchor= west, white] at (0.3,0.3){\insertnavigation{0.85\paperwidth}};%
  \end{tikzpicture}
\end{beamercolorbox}
\fi
}%


\defbeamertemplate*{frametitle}{}
{%
\vskip-1pt%skip after the begginning of the slide
  \begin{beamercolorbox}[wd=\paperwidth,ht=1.2cm]{frametitle} 
  \begin{tikzpicture}
  \useasboundingbox[fill=white](0,0) rectangle(\the\paperwidth,0.6);
  \fill[secondColor] (0,0) rectangle(0.3,1);
  \fill[firstColor] (0.35,0) rectangle(\the\paperwidth,0.6);
  \node[anchor=west, white,font=\large] at (0.4,0.25){\insertframetitle};
  \end{tikzpicture}
  \end{beamercolorbox}
}

% fix the title page navigation bar
\let\oldtitlepage\titlepage
\renewcommand{\titlepage}{%
  \addtocounter{framenumber}{-1}%ensure that title page has 0 number
  \oldtitlepage%
}

% Patches beamer so that "subsections numbered 0" show their slide entries.
% Solution from: https://tex.stackexchange.com/questions/2072/beamer-navigation-circles-without-subsections
\patchcmd{\slideentry}{\ifnum#2>0}{\ifnum2>0}{}{\@error{unable to patch}}% replace the subsection number test with a test that always returns true

\makeatother

\title{Test}
\subtitle{test}
\author{Doe}

\begin{document}

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

\section{section name}
\begin{frame}
content...
\end{frame}

\end{document}
1

In your case, the title slide sits outside of any sections, so you could change the \slideentry conditions to require that the section number be strictly positive. i.e. change the \patchcmd{\slideentry} line to the following:

\patchcmd{\slideentry}{\ifnum#2>0}{\ifnum#1>0}{}{\@error{unable to patch}}% require section number to be strictly positive

Would that be good enough?

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.