帶有 smoothbar 主題的標題中的小節編號

帶有 smoothbar 主題的標題中的小節編號

使用 smoothbar 外部主題(達姆施塔特使用),我喜歡小節標題,但我想在之前列印小節和小節編號。

我嘗試透過添加\thesection.\thesubsection\行來​​修改標題模板\insertsubsectionhead,但數字也在標題頁或摘要中,這是我不想要的。

我也嘗試過使用\insertsubsectionheadnumber,但不起作用:(。

微量元素:

\documentclass{beamer}

\useoutertheme{smoothbars}

\makeatletter
\setbeamertemplate{headline}{%
\pgfuseshading{beamer@barshade}%
\ifbeamer@sb@subsection%
\vskip-9.75ex%
\else%
\vskip-7ex%
\fi%
\begin{beamercolorbox}[ignorebg,ht=2.25ex,dp=3.75ex]{section in head/foot}
    \insertnavigation{\paperwidth}
\end{beamercolorbox}%
\ifbeamer@sb@subsection%
\begin{beamercolorbox}[ignorebg,ht=2.125ex,dp=1.125ex,%
    leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
    \usebeamerfont{subsection in head/foot}\thesection.\thesubsection\ \insertsubsectionhead
\end{beamercolorbox}%
\fi%
}%
\makeatother

\AtBeginSection[]{
\begin{frame}
    \tableofcontents[currentsection]
\end{frame} 
}

\begin{document}
\begin{frame}{Summary}
\tableofcontents%[pausesections]
\end{frame}

\section{section 1}
\subsection{sub 1}
\frame{}
\end{document}

答案1

我不完全確定我正確理解了你的問題,但是你只是想用\thesection.\thesubsection\空的小節隱藏投影片上的內容嗎?

\documentclass{beamer}

\useoutertheme{smoothbars}
\usepackage{etoolbox}

\makeatletter
\setbeamertemplate{headline}{%
\pgfuseshading{beamer@barshade}%
\ifbeamer@sb@subsection%
\vskip-9.75ex%
\else%
\vskip-7ex%
\fi%
\begin{beamercolorbox}[ignorebg,ht=2.25ex,dp=3.75ex]{section in head/foot}
    \insertnavigation{\paperwidth}
\end{beamercolorbox}%
\ifbeamer@sb@subsection%
\begin{beamercolorbox}[ignorebg,ht=2.125ex,dp=1.125ex,%
    leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
    \usebeamerfont{subsection in head/foot}
    \ifx\insertsubsection\empty\else%
    \ifdefempty{\subsecname}{\relax}{%
        \thesection.\thesubsection\ \insertsubsectionhead%
    }%
    \fi
\end{beamercolorbox}%
\fi%
}%
\makeatother

\AtBeginSection[]{
\begin{frame}
    \tableofcontents[currentsection]
\end{frame} 
}

\begin{document}
\begin{frame}{Summary}
\tableofcontents%[pausesections]
\end{frame}

\section{section 1}
\subsection{sub 1}
\frame{}
\end{document}

在此輸入影像描述

相關內容