如何为无头(无标题或标题(但不是纯文本))幻灯片定义新的框架选项?

如何为无头(无标题或标题(但不是纯文本))幻灯片定义新的框架选项?

我希望向框架添加一个选项,使其按预期运行,并生成没有标题或框架标题的幻灯片,但有脚注。

% main.tex
\documentclass{beamer}
\usetheme{headless}

\begin{document}

\begin{frame}[headless]{Headless Frame}
    This frame should not have a headline.
\end{frame}

\begin{frame}{Regular Frame}
    This frame retains its headline.
\end{frame}

\end{document}

这是我当前的代码,它不起作用:

% beamerthemeheadless.sty
\ProvidesPackage{beamerthemeheadless}

\mode<presentation>

\newif\ifbeamer@headless
\beamer@headlessfalse


\BeforeBeginEnvironment{frame}{
  \ifbeamer@headless
    \setbeamertemplate{headline}{} 
  \fi
}

\AfterEndEnvironment{frame}{
  \ifbeamer@headless
    \setbeamertemplate{headline}[default] 
    \beamer@headlessfalse 
  \fi
}

\define@key{beamerframe}{headless}[true]{%
  \beamer@headlesstrue
}

\mode<all>

根据焦点主题如何定义普通内容,我还尝试了以下操作。

% beamerthemeheadless.sty
\ProvidesPackage{beamerthemeheadless}

\providebool{beamer@headless}
\define@key{beamerframe}{headless}[true]{%
    \begingroup%
    \setbeamertemplate{frametitle}[plain]%
    \setbeamertemplate{headline}{}
    \setkeys{beamerframe}{c}%
    \centering%

}

答案1

基本与https://topanswers.xyz/tex?q=1162#a1369

\documentclass{beamer}

\makeatletter
\defbeamertemplate{frametitle}{headless}{}
\BeforeBeginEnvironment{frame}{\setbeamertemplate{frametitle}[default]}
\define@key{beamerframe}{headless}[true]{\setbeamertemplate{frametitle}[headless]}
\makeatother

\begin{document}

\begin{frame}
    \frametitle{Regular Frame}
    This frame retains its headline.
\end{frame}

\begin{frame}[headless]
    \frametitle{Headless Frame}
    This frame should not have a headline.
\end{frame}

\begin{frame}
    \frametitle{Regular Frame}
    This frame retains its headline.
\end{frame}

\end{document}

在此处输入图片描述

相关内容