删除 Beamer 伯克利班级中的一些幻灯片编号?

删除 Beamer 伯克利班级中的一些幻灯片编号?

使用此处提供的代码:投影机伯克利标题中的幻灯片编号? 我插入了幻灯片编号。但是,有些幻灯片(主要是备用幻灯片)我不需要它们:您能帮我吗?我尝试了但没有奏效的方法:

 \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}

答案1

您已重新定义 frametitle 以包含帧编号,但您尚未将其设置为选项的条件noframenumbering。要更改此设置,您可以重新定义frametitle以省略帧编号\ifbeamer@noframenumbering。在您的示例中尝试以下操作。

 \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

相关内容