如何删除/更改主题.sty
文件中某些幻灯片的页脚?
我基本上想避免\setbeamertemplate{footline}{}
在我的幻灯片中使用.tex
。例如在标题幻灯片/目录/部分幻灯片上...
失败的尝试
使用\newif
\newif\ifbeamer@test@title
\beamer@test@titlefalse
\defbeamertemplate*{title page}{test}{
\beamer@test@titletrue
<...>
\beamer@test@titlefalse
}
\defbeamertemplate*{footline}{test}{
\ifbeamer@test@title
\else
<...>
\fi
}
最小工作示例
这里简化了 MWE,仅考虑了标题页,但该解决方案应该足够通用,以便也可以用于目录/部分幻灯片
cat beamerthemetest.sty
\mode<presentation>
%% goes to inner theme
\defbeamertemplate*{title page}{test}
{
\beamer@test@titletrue
{
\vspace{42pt}
\begin{beamercolorbox}{title}
\usebeamerfont{title}\inserttitle
\ifx\insertsubtitle\@empty
\else
\par\usebeamerfont{subtitle}\insertsubtitle
\fi
\end{beamercolorbox}
\begin{beamercolorbox}{author}
\usebeamerfont{author}\insertauthor
\end{beamercolorbox}
}
\beamer@test@titlefalse
}
%% goes to outer theme
\defbeamertemplate*{footline}{test}
{
\begin{beamercolorbox}[wd=\paperwidth, dp=1mm, ht=3.5mm
, leftskip=1mm, rightskip=1mm
]{footline}%
\usebeamerfont{title in head/foot}%
\makebox[240pt][l]{
\insertshorttitle\ - \insertsectionhead\ %
\ifx\insertsubsectionhead\@empty\relax\else%
- \insertsubsectionhead%
\fi
}
\hfill\makebox[20pt][r]{\insertframenumber/\inserttotalframenumber}%
\end{beamercolorbox}%
}
\mode<all>
与test.tex
\documentclass[aspectratio=169]{beamer}
\usetheme{test}
\author{whoami}
\title{title}
\begin{document}
\maketitle
\section{abc}
\begin{frame}{abc}
cde
\end{frame}
\end{document}
答案1
这似乎有效,但我并不确信这是最好的方法。
这.tex
\documentclass[aspectratio=169]{beamer}
\usetheme{test}
\author{whoami}
\title{title}
\begin{document}
\newmaketitle
\section{abc}
\begin{frame}{abc}
cde
\end{frame}
\section{def}
\begin{frame}{def}
fgf
\end{frame}
\end{document}
这.sty
\mode<presentation>
%% goes to inner theme
\defbeamertemplate*{title page}{test}
{
%\beamer@test@titletrue
{
\vspace{42pt}
\begin{beamercolorbox}{title}
\usebeamerfont{title}\inserttitle
\ifx\insertsubtitle\@empty
\else
\par\usebeamerfont{subtitle}\insertsubtitle
\fi
\end{beamercolorbox}
\begin{beamercolorbox}{author}
\usebeamerfont{author}\insertauthor
\end{beamercolorbox}
}
}
\newcommand{\newmaketitle}{
\setbeamertemplate{footline}[default]
\begin{frame}
\maketitle
\end{frame}
\setbeamertemplate{footline}[test]
}
%% goes to outer theme
\defbeamertemplate*{footline}{test}
{
\begin{beamercolorbox}[wd=\paperwidth, dp=1mm, ht=3.5mm
, leftskip=1mm, rightskip=1mm
]{footline}%
\usebeamerfont{title in head/foot}%
\makebox[240pt][l]{
\insertshorttitle\ - \insertsectionhead\ %
\ifx\insertsubsectionhead\@empty\relax\else%
- \insertsubsectionhead%
\fi
}
\hfill\makebox[20pt][r]{\insertframenumber/\inserttotalframenumber}%
\end{beamercolorbox}%
}
\AtBeginSection[]
{
\setbeamertemplate{footline}[default]
\addtocounter{framenumber}{-1}
\begin{frame}{Outline}
\tableofcontents
\end{frame}
\setbeamertemplate{footline}[test]
}
\mode<all>