1

I am making a presentation with beamer using the Madrid theme. I am removing the specific frame titled Special Frame from the top navigation bar using the command \buttenoff. But it's hiding the frame number also.

teststyle.sty

\mode<presentation>{
\usetheme{Madrid}
\useinnertheme{circles} % https://tex.stackexchange.com/a/47373/114006
\usecolortheme{whale}
\usefonttheme{serif}
\usefonttheme{structuresmallcapsserif}
}

% https://tex.stackexchange.com/a/437578/114006
\makeatletter
% Remember the way beamer did it before
\let\beamer@old@writeslidentry\beamer@writeslidentry
% Tell it to do nothing with the slides entry
\newcommand\bulletoff{\let\beamer@writeslidentry\relax}
% Reset it to the old ways
\newcommand\bulleton{\let\beamer@writeslidentry\beamer@old@writeslidentry}
\makeatother

\setbeamercolor{section in head/foot}{fg=white,bg=black}           % https://tex.stackexchange.com/a/326553/114006
\makeatletter
\setbeamertemplate{headline}{%
    \begin{beamercolorbox}[ht=2.25ex,dp=3.75ex]{section in head/foot}
        \insertnavigation{\paperwidth}
    \end{beamercolorbox}%
}%
\makeatother

\usepackage{ragged2e}   
\addtobeamertemplate{block begin}{}{\justifying}  % https://tex.stackexchange.com/a/148696/114006
\apptocmd{\frame}{}{\justifying}{} % https://tex.stackexchange.com/a/55590/114006

% https://tex.stackexchange.com/a/401409/114006
\usepackage{environ}

% Custom font for a frame.
\newcommand{\customframefont}[1]{
\setbeamertemplate{itemize/enumerate body begin}{#1}
\setbeamertemplate{itemize/enumerate subbody begin}{#1}
}
\NewEnviron{framefont}[1]{
\customframefont{#1} % for itemize/enumerate
{#1 % For the text outside itemize/enumerate
\BODY
}
\customframefont{\normalsize}
}

\setbeamertemplate{caption}[numbered]

test.tex

\documentclass[aspectratio=43]{beamer}  

\usepackage{teststyle}
% \graphicspath{ {./img/} }

\title{Presentation Title}
\titlegraphic{\includegraphics[width=1cm]{example-image}}

\author{Presenter Name} 
\date{August, 2021} 

\logo{\includegraphics[height=0.5cm,keepaspectratio]{example-image}}

\begin{document}

{
\setbeamercolor{page number in head/foot}{fg=date in head/foot.bg} % https://tex.stackexchange.com/a/412733/114006
\begin{frame}[noframenumbering, plain]
\titlepage
\end{frame}

\begin{frame}[noframenumbering]
\frametitle{Outline} 
\tableofcontents %[pausesections,pausesubsections,subsectionstyle=shaded]
\end{frame}
}

%------------------------------------------------
\section{Section 1} 
\begin{frame}
\frametitle{Section One}
Sed iaculis dapibus gravida.
\end{frame}
%------------------------------------------------
\section{Section 2}
\begin{frame}
\frametitle{Section 2}
Sed iaculis dapibus gravida.
\end{frame}
%------------------------------------------------

\bulletoff\section*{}
\begin{frame}{Special Frame}     % The frame number is not visible!
Sed iaculis dapibus gravida.
\end{frame}

%------------------------------------------------

\setbeamercolor{page number in head/foot}{fg=date in head/foot.bg}
% \bulletoff\section*{}
\begin{frame}[noframenumbering]
\Huge{\centerline{Thank You.}} 
\huge{\centerline{Any Question?}}
\end{frame}

%------------------------------------------------

\end{document}

I like to make the hidden frame number visible on the specific frame titled Special Frame. Only the title frame, TOC frame, last frame should not be affected i.e., they shouldn't have frame numbers. How can I fix it?

2

If you look into the definition of the command \beamer@writeslidentry you redefine, you see

\def\beamer@writeslidentry{%
  \expandafter\ifblank\expandafter{\beamer@framestartpage}{}% does not happen normally
  {%else
    \addtocontents{nav}%
      {\protect\headcommand{%
          \protect\slideentry{\the\c@section}{\the\c@subsection}{\the\c@subsectionslide}%
          {\beamer@framestartpage/\beamer@frameendpage}{\lastsubsection}{\the\c@part}}}%
    \addtocontents{nav}%
      {\protect\headcommand{%
        \protect\beamer@framepages{\beamer@framestartpage}{\beamer@frameendpage}}}%
    \clearpage\beamer@notesactions%
  }%
}

So it only executes under some condition, then it writes some auxiliary information (probably to influence the top navigation) and finally ends with \clearpage and \beamer@notesactions. Since you only want to avoid influencing the top navigation, it seems like a good idea to remove only the \addtocontents calls.

This seems to have the intended effect:

\documentclass[aspectratio=43]{beamer}  

\mode<presentation>{
\usetheme{Madrid}
\useinnertheme{circles} % https://tex.stackexchange.com/a/47373/114006
\usecolortheme{whale}
\usefonttheme{serif}
\usefonttheme{structuresmallcapsserif}
}

% https://tex.stackexchange.com/a/437578/114006
\makeatletter
% Remember the way beamer did it before
\let\beamer@old@writeslidentry\beamer@writeslidentry
\def\beamer@new@writeslidentry{%
  \expandafter\ifblank\expandafter{\beamer@framestartpage}{}% does not happen normally
  {\clearpage\beamer@notesactions}%
}

% Tell it to do nothing with the slides entry
\newcommand\bulletoff{\let\beamer@writeslidentry\beamer@new@writeslidentry}
% Reset it to the old ways
\newcommand\bulleton{\let\beamer@writeslidentry\beamer@old@writeslidentry}
\makeatother

\setbeamercolor{section in head/foot}{fg=white,bg=black}           % https://tex.stackexchange.com/a/326553/114006
\makeatletter
\setbeamertemplate{headline}{%
    \begin{beamercolorbox}[ht=2.25ex,dp=3.75ex]{section in head/foot}
        \insertnavigation{\paperwidth}
    \end{beamercolorbox}%
}%
\makeatother

\usepackage{ragged2e}   
\addtobeamertemplate{block begin}{}{\justifying}  % https://tex.stackexchange.com/a/148696/114006
\apptocmd{\frame}{}{\justifying}{} % https://tex.stackexchange.com/a/55590/114006

% https://tex.stackexchange.com/a/401409/114006
\usepackage{environ}

% Custom font for a frame.
\newcommand{\customframefont}[1]{
\setbeamertemplate{itemize/enumerate body begin}{#1}
\setbeamertemplate{itemize/enumerate subbody begin}{#1}
}
\NewEnviron{framefont}[1]{
\customframefont{#1} % for itemize/enumerate
{#1 % For the text outside itemize/enumerate
\BODY
}
\customframefont{\normalsize}
}

\setbeamertemplate{caption}[numbered]

\title{Presentation Title}
\titlegraphic{\includegraphics[width=1cm]{example-image}}

\author{Presenter Name} 
\date{August, 2021} 

\logo{\includegraphics[height=0.5cm,keepaspectratio]{example-image}}

\begin{document}

{
\setbeamercolor{page number in head/foot}{fg=date in head/foot.bg} % https://tex.stackexchange.com/a/412733/114006
\begin{frame}[noframenumbering, plain]
\titlepage
\end{frame}

\begin{frame}[noframenumbering]
\frametitle{Outline} 
\tableofcontents %[pausesections,pausesubsections,subsectionstyle=shaded]
\end{frame}
}

%------------------------------------------------
\section{Section 1} 
\begin{frame}
\frametitle{Section One}
Sed iaculis dapibus gravida.
\end{frame}
%------------------------------------------------
\section{Section 2}
\begin{frame}
\frametitle{Section 2}
Sed iaculis dapibus gravida.
\end{frame}
%------------------------------------------------

\bulletoff\section*{}
\begin{frame}{Special Frame}     % The frame number is not visible!
Sed iaculis dapibus gravida.
\end{frame}

%------------------------------------------------

\setbeamercolor{page number in head/foot}{fg=date in head/foot.bg}
% \bulletoff\section*{}
\begin{frame}[noframenumbering]
\Huge{\centerline{Thank You.}} 
\huge{\centerline{Any Question?}}
\end{frame}

%------------------------------------------------

\end{document}

enter image description here

1
  • Thank you for the solution!
    – raf
    Aug 17 at 3:07

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.