我正在努力复制研究所在 Beamer 中使用的 PowerPoint 主题。此主题的主要内容、标题和部分幻灯片以及页眉和页脚中出现的文本具有不同的背景图像。我想根据框架的当前主题自动切换背景图像。我知道可以通过封闭框架来更改背景里面A团体,但我更希望主题处理图片。我知道我也可以明确设置图片在适当的主题中;但是,这会阻挡全局设置的标题文本的视图。基于这个问题,这似乎与 Beamer 完成工作所必须进行的分层(我本质上想要报告问题的反向)直接相关。这似乎意味着无法将文本提升到本地设置的背景图像之上。我也知道可以使用\AtBeginSection
和朋友来创建分组,但我更希望不必总是有标题/部分/部分幻灯片。
我的问题是:如何根据当前投影仪框架的主题更改背景图像?或者,如何将标题置于标题主题中本地设置的背景图像上方?
作为最低限度的工作示例:
\documentclass{beamer}
\usepackage{mwe}
\usepackage{tikz}
\usetikzlibrary{positioning}
\setbeamercolor{page number in head/foot}{fg=red}
\setbeamertemplate{title page}{%
\begin{tikzpicture}[remember picture, overlay]
\node [anchor=center] at (current page.center) {%
\includegraphics[width=\paperwidth,
height=\paperheight]{example-image-a}
};
% The following does not respect the font selection in the
% template
%\node [below=0pt of current page.north,
%text width=\paperwidth] {
%\usebeamertemplate{headline}
%};
\end{tikzpicture}
}
\setbeamertemplate{headline}{%
\vspace{0.5em}
\usebeamercolor[fg]{page number in head/foot}
\hspace*{\fill}
TEXT
\hspace*{\fill}
}
\setbeamertemplate{sidebar right}{}
\setbeamertemplate{footline}{%
\usebeamercolor[fg]{page number in head/foot}
\usebeamerfont{page number in head/foot}
\hspace*{\fill}
TEXT
\hspace*{\fill}
\vspace{0.5em}
}
\setbeamertemplate{background}{%
\includegraphics[width=\paperwidth,
height=\paperheight]{example-image}
}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}{Example}
Stuff
\end{frame}
\end{document}
答案1
一个可能的解决方案:在模板中放置不同的背景图像headline
。
\documentclass{beamer}
\usepackage{mwe}
\usepackage{tikz}
\usetikzlibrary{positioning}
\setbeamertemplate{title page}{%
\Huge Huge Title Huge Title Huge Title Huge Title Huge Title
}
\defbeamertemplate*{headline}{zero}{%
\begin{tikzpicture}[remember picture, overlay,opacity=0.3]
\node [anchor=center] at (current page.center) {%
\includegraphics[width=\paperwidth,
height=\paperheight]{example-image}
};
\end{tikzpicture}
\vspace{0.5em}
\usebeamercolor[fg]{page number in head/foot}
\hspace*{\fill}
\Large Title Head
\hspace*{\fill}
}
\defbeamertemplate{headline}{first}{%
\begin{tikzpicture}[remember picture, overlay,opacity=0.3]
\node [anchor=center] at (current page.center) {%
\includegraphics[width=\paperwidth,
height=\paperheight]{example-image-a}
};
\end{tikzpicture}
\vspace{0.5em}
\usebeamercolor[fg]{page number in head/foot}
\hspace*{\fill}
\Large Section Head
\hspace*{\fill}
}
\defbeamertemplate{headline}{second}{%
\begin{tikzpicture}[remember picture, overlay,opacity=0.3]
\node [anchor=center] at (current page.center) {%
\includegraphics[width=\paperwidth,
height=\paperheight]{example-image-b}
};
\end{tikzpicture}
\vspace{0.5em}
\usebeamercolor[fg]{page number in head/foot}
\hspace*{\fill}
\Large Normal Head
\hspace*{\fill}
}
\defbeamertemplate*{footline}{zero}{
\usebeamercolor[fg]{page number in head/foot}
\usebeamerfont{page number in head/foot}
\hspace*{\fill}
\Large Title Foot
\hspace*{\fill}
\vspace{1.5em}
}
\defbeamertemplate{footline}{first}{
\usebeamercolor[fg]{page number in head/foot}
\usebeamerfont{page number in head/foot}
\hspace*{\fill}
\Large Section Foot
\hspace*{\fill}
\vspace{1em}
}
\defbeamertemplate{footline}{second}{
\usebeamercolor[fg]{page number in head/foot}
\usebeamerfont{page number in head/foot}
\hspace*{\fill}
\Large Normal Foot
\hspace*{\fill}
\vspace{0.5em}
}
\AtBeginSection{%
{
\setbeamertemplate{headline}[first]
\setbeamertemplate{footline}[first]
\begin{frame}\sectionpage\end{frame}
}
\setbeamertemplate{headline}[second]
\setbeamertemplate{footline}[second]
}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\section{First Section}
\begin{frame}{Example One}
Stuff Stuff Stuff Stuff Stuff Stuff Stuff Stuff
\end{frame}
\begin{frame}{Example Two}
Stuff Stuff Stuff Stuff Stuff Stuff Stuff Stuff
\end{frame}
\end{document}