![如何为无头(无标题或标题(但不是纯文本))幻灯片定义新的框架选项?](https://linux22.com/image/475007/%E5%A6%82%E4%BD%95%E4%B8%BA%E6%97%A0%E5%A4%B4%EF%BC%88%E6%97%A0%E6%A0%87%E9%A2%98%E6%88%96%E6%A0%87%E9%A2%98%EF%BC%88%E4%BD%86%E4%B8%8D%E6%98%AF%E7%BA%AF%E6%96%87%E6%9C%AC%EF%BC%89%EF%BC%89%E5%B9%BB%E7%81%AF%E7%89%87%E5%AE%9A%E4%B9%89%E6%96%B0%E7%9A%84%E6%A1%86%E6%9E%B6%E9%80%89%E9%A1%B9%EF%BC%9F.png)
我希望向框架添加一个选项,使其按预期运行,并生成没有标题或框架标题的幻灯片,但有脚注。
% 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}