更改部分页面的标题和脚注

更改部分页面的标题和脚注

我已经开始编写自己的 beamer 主题。现在,我想为部分页面和子部分页面设置彩色背景,而其余页面则使用白色背景。“普通幻灯片”上的标题和脚注使用灰色文本。为了使设计更具可读性,我希望它们在(子)部分页面的彩色背景上使用白色文本。但不知何故,我无法弄清楚如何专门为(子)部分页面更改标题和脚注样式。

我尝试使用 设置布尔值\newif\ifbeamer@logogrey,然后在部分页面模板中将其更改为 false,并在标题和页脚模板中检查它。但即使在部分页面上它是 false,页眉和页脚也会被编译为 true。因此,在我看来,页眉和页脚是在部分页面模板之前编译的,这就是布尔值被忽略的原因。

有没有办法提示重新编译标题和页脚模板?还是我必须更改更改布尔值的位置?或者是否有完全不同的方法可以在(子)部分页面中为标题和页脚设置特定样式?

编辑

根据 samcarter_is_at_topanswers.xyz 的回答,我现在使用我引入的条件变量并在 内进行更改\def\ps@navigation@sectionpage{。这使我能够在标题和脚注模板内本地调整颜色和徽标。更新后的 MWE:

beamercolorthemeUM.sty

\mode<presentation>
\setbeamercolor{frame head} {fg=black!65}
\setbeamercolor{footline}   {fg=black!65}
\setbeamercolor{bright}     {fg=white}

\mode
<all>

beamerthemeUM.sty

\RequirePackage{tikz}
\RequirePackage[absolute, overlay]{textpos} %somehow in my real template it works fine without overlay

\mode<presentation>

\usecolortheme{UM}

%Remove Navigation Symbols
\setbeamertemplate{navigation symbols}{}

%Condition if logo is white or graphite
\newif\ifbeamer@logogrey
\beamer@logogreytrue %default is graphite

\setbeamertemplate{headline}{
%If first page = title slide: leave empty
\ifnum \theframenumber=1
%for all other pages
\else
%see if content should be grey or white (for coloured frames)
{
    %###################################
    %on normal slides grey logo and text
    \ifbeamer@logogrey
        \def\col{frame head}
        \def\imgpath{assets/Logo.pdf}
    \else
    %on colored slides white
        \def\col{bright}
        \def\imgpath{assets/Logo-Negativ.pdf}
    \fi
    %###################################
    
    \begin{beamercolorbox}[wd=\beamer@paperwidth, ht=1.3cm]{\col}%
        %Uni Logo in upper left corner
        \includegraphics[height=.6cm,keepaspectratio]{\imgpath}
        \hfill
        %shorttitle of presentation in upper right corner
        \makebox[8cm][r]{\usebeamerfont{frame head} \insertshorttitle}
    \end{beamercolorbox}
    
}
\fi
}

\setbeamertemplate{footline}
{
%If first page = title slide: leave empty
\ifnum \theframenumber=1
%for all other pages
\else
{
    %################################################
    %on white (normal) slides: coloured line and text
    \ifbeamer@logogrey
        \def\col{footline}
        \def\colline{col1!30}
    \else
    %on coloured slides: white
        \def\col{bright}
        \def\colline{white!30}
    \fi
    %################################################
    
    \begin{beamercolorbox}[wd=\beamer@paperwidth, ht=1.3cm]{\col}
        %Line
        \textcolor{\colline}{\hrule}
        %Author in the left corner
        \makebox[8cm][l]{\usebeamerfont{footline} \insertauthor}
        \hfill
        %slide number in right corner
        \makebox[2cm][r]{\usebeamerfont{page number in head/foot} \insertframenumber}%
    \end{beamercolorbox}
}
\fi
}

%Section page
%hacking to trigger the right footline
%#####################################
\def\ps@navigation@sectionpage{%
    \beamer@logogreyfalse
    \@nameuse{ps@navigation}
}
%#####################################

\setbeamertemplate{section page}{

    %#####################################
    \thispagestyle{navigation@sectionpage}
    %#####################################
    
    %Bakground
    \begin{textblock*}{\beamer@paperwidth}(0cm,0cm)
        \begin{tikzpicture}
            \fill[col1] (0,0) rectangle (\beamer@paperwidth, \beamer@paperheight);
        \end{tikzpicture}
    \end{textblock*}
    
    \begin{beamercolorbox}{bright}%
        \huge\textbf{\insertsection}
    \end{beamercolorbox}
    
}

%Subsection page
%hacking to trigger the right footline
\def\ps@navigation@subsectionpage{%
    \beamer@logogreyfalse
    \@nameuse{ps@navigation}
}

\setbeamertemplate{subsection page}{
    
    \thispagestyle{navigation@subsectionpage}
    %Bakground
    \begin{textblock*}{\beamer@paperwidth}(0cm,0cm)
        \begin{tikzpicture}
            \fill[col2] (0,0) rectangle (\beamer@paperwidth, \beamer@paperheight);
        \end{tikzpicture}
    \end{textblock*}
    
    \begin{beamercolorbox}{bright}%
        \huge\textbf{\insertsection}
    \end{beamercolorbox}
    
}

\mode
<all>

普雷西特克斯

\documentclass[aspectratio=169]{beamer}

\usetheme{UM}

\author{My Name}
\title[Exp. Presi]{Exemplary Presentation}
\date{2nd Jan 2024}
\institute{Conference Name for Title Slide}

%------------------------------------------------

\begin{document}
    
    \begin{frame}
        \titlepage
    \end{frame}
    
    \section{Fruits}
    \begin{frame}
        \sectionpage
    \end{frame}
    
    \subsection{Citrus}
    \begin{frame}
        \frametitle{\insertsection}
        \framesubtitle{\insertsubsection}
        
        \begin{itemize}
            \item Lemon
            \item Orange
        \end{itemize}
    \end{frame}
    
    \subsection{Apples}

    \begin{frame}
        \subsectionpage
    \end{frame}

    \begin{frame}
        \frametitle{\insertsection}
        \framesubtitle{\insertsubsection}
        
        \begin{itemize}
            \item Boskop
            \item Gala
        \end{itemize}
    \end{frame}

\end{document}

答案1

您可以使用与以下相同的方法https://topanswers.xyz/tex?q=1004#a1198

替换整个脚注的示例:

\documentclass{beamer}


\defbeamertemplate{footline}{white footline}{white footline} 
\setbeamertemplate{footline}{normal footline} 

\makeatletter
\def\ps@navigation@sectionpage{%
  \setbeamertemplate{footline}[white footline]
  \@nameuse{ps@navigation}
}
\addtobeamertemplate{section page}{\thispagestyle{navigation@sectionpage}}{}
\makeatother

\AtBeginSection{
  \begin{frame}
    \usebeamertemplate{section page}
  \end{frame} 
}

\begin{document}

\section{title}
\begin{frame}
  abc
\end{frame}

\end{document}

只需替换一种颜色:

\documentclass{beamer}

\makeatletter
\setbeamertemplate{footline}{\usebeamercolor[fg]{test}footline} 
\setbeamercolor{test}{fg=red}

\def\ps@navigation@sectionpage{%
  \setbeamercolor{test}{fg=green}
  \@nameuse{ps@navigation}
}
\addtobeamertemplate{section page}{\thispagestyle{navigation@sectionpage}}{}
\makeatother

\begin{document}

\section{title}
\begin{frame}
  \usebeamertemplate{section page}
\end{frame} 

\begin{frame}
  abc
\end{frame}

\end{document}

相关内容