2

Using exactlay the code provided here: Slide number in beamer Berkeley header? I inserted slide numbers. However, I do not want them for some slides (mostly back-up slides): Could you please help me? What I tried but did not work:

 \documentclass{beamer}
 \usepackage[english]{babel}
 \usepackage[ansinew]{inputenc}
 \usepackage[T1]{fontenc}
 \usepackage{amsmath,amsfonts,amssymb}
 \usepackage{mathptmx}
 \usepackage{booktabs}
 \usepackage{dcolumn}
 \usepackage{tikz}
 \usetikzlibrary{spy}


 \usetheme{Berkeley}
 \makeatletter
 \setbeamertemplate{frametitle}{%
    \nointerlineskip%
    \vskip-\beamer@headheight%
    \vbox to \beamer@headheight{%
        \vfil
        \leftskip=-\beamer@leftmargin%
        \advance\leftskip by0.3cm%
        \rightskip=-\beamer@rightmargin%
        \advance\rightskip by0.3cm plus1fil%
        {\usebeamercolor[fg]{frametitle}
            \usebeamerfont{frametitle}\insertframetitle\hfill\insertframenumber\par}% added number
        {\usebeamercolor[fg]{framesubtitle}
            \usebeamerfont{framesubtitle}\insertframesubtitle\par}%
        \vbox{}%
        \vskip-1em%
        \vfil
    }%
 }
 \makeatother
 \usefonttheme{professionalfonts}
 \setbeamertemplate{bibliography item}[triangle]



 \begin{document}



\begin{frame}{Numbered slide}

I am a slide that wants a number. 

\end{frame}



\begin{frame}[noframenumbering]{No Number}
Here should be no number. 
\end{frame}

\end{document}
2
  • Please don't post code fragments. Instead, put your fragments into a complete compilable document that shows the problem.
    – erik
    May 23, 2019 at 20:52
  • thank you @erik May 29, 2019 at 16:49

1 Answer 1

1

You've redefined frametitle to include the frame number, but you haven't made that conditional on the noframenumbering option. To change this, you can redefine frametitle to omit the frame number for \ifbeamer@noframenumbering. Try the following in your example.

 \makeatletter
 \setbeamertemplate{frametitle}{%
    \nointerlineskip%
    \vskip-\beamer@headheight%
    \vbox to \beamer@headheight{%
        \vfil
        \leftskip=-\beamer@leftmargin%
        \advance\leftskip by0.3cm%
        \rightskip=-\beamer@rightmargin%
        \advance\rightskip by0.3cm plus1fil%
        {\usebeamercolor[fg]{frametitle}
            \usebeamerfont{frametitle}
            \ifbeamer@noframenumbering%
            \insertframetitle\par% added number
            \else
            \insertframetitle\hfill\insertframenumber\par% added number
            \fi}
        {\usebeamercolor[fg]{framesubtitle}
            \usebeamerfont{framesubtitle}\insertframesubtitle\par}%
        \vbox{}%
        \vskip-1em%
        \vfil
    }%
 }
 \makeatother

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .