我需要在 Beamer 中创建视觉效果,其中幻灯片的内容“变灰”(或被白色半透明框覆盖),并在幻灯片内容上显示一个强调的项目符号。此效果应与使用itemize
或overprint
功能的任何动画兼容。我正在使用Rochester
主题。到目前为止,似乎应该有一种方法可以使用来实现这一点textblock
,但我愿意接受任何能够实现所需效果的简洁解决方案。
有一个答案部分解决了这个问题这里。但是,接受的答案不适用于我的用例,因为 (1)examplebox
即使我将标题留空(错误?),beamer 也会在 上插入彩色标题栏。(2) 我需要框是半透明的(在此解决),以及(3)我需要块覆盖除标题之外的整个幻灯片内容。
我很难理解其他地方发布的类似问题的解决方案,因为它们使用了TikZ
。对我来说,TikZ
太晦涩和冗长,无法维护,所以我强烈建议使用textblock
(类似本例)。如果出于某种原因TikZ
有必要,最好TikZ
将源代码包装在一些宏/函数中并隔离在单独的文件中,以避免可维护性问题。我将无法修改或调试TikZ
代码。我需要一个“开箱即用”的解决方案。如果这不可能,我将直接放弃获得所需的效果。
这是我所举的一个例子:
\documentclass[svgnames,professionalfont,13pt]{beamer}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usetheme{Rochester}
% https://tex.stackexchange.com/questions/59826/position-an-exampleblock-in-front-of-content
% for overlays
\usepackage{lipsum} % <= to insert dummy text
\usepackage[absolute,overlay]{textpos}
% get translucent block
\addtobeamertemplate{block begin}{\pgfsetfillopacity{0.5}}{\pgfsetfillopacity{1}}
\addtobeamertemplate{block alerted begin}{\pgfsetfillopacity{0.5}}{\pgfsetfillopacity{1}}
\addtobeamertemplate{block example begin}{\pgfsetfillopacity{0.5}}{\pgfsetfillopacity{1}}
\begin{document}
% Begin example slide
\setbeamercolor{background canvas}{bg=red}
\begin{frame}{title}
\begin{itemize}
\item<1->Point 1
\item<2->Point 2
\item<3->Point 3
\item<4->Point 4
\item<5->Point 5
\item<6->Point 6
\end{itemize}
\begin{exampleblock}{}
\begin{itemize}
\item The block needs to overlap the slide text
\item The colored title bar needs to be gone
\item I need this box to pop up only at the end
\item The block needs to be horizontally and vertically centered
\item The block needs to be as wide as the page
\item The block needs to be as tall as the slide, excluding the title area
\end{itemize}
\end{exampleblock}
\end{frame}
\end{document}
编辑:Mike Renfro 的答案几乎完成了。我设法将其整理成与我想要的非常接近的形式,发布如下。最后一个技巧是让覆盖层与幻灯片主体的高度和位置相匹配,并在覆盖层内重现幻灯片边距。我担心我不是一位经验丰富的 LaTeX 程序员,所以我的修改很马虎。但是,我认为这说明了我想要实现的目标:
\documentclass[svgnames,professionalfont,13pt]{beamer}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usetheme{Rochester}
\usepackage[absolute,overlay]{textpos}
\newcommand{\fadeslide}[1]{%https://tex.stackexchange.com/a/80496
\setlength{\TPHorizModule}{\paperwidth}\setlength{\TPVertModule}{\paperheight}
\begin{textblock*}{\paperwidth}[0.5,0.5](0.5\paperwidth,0.5\paperheight)
\setbeamercolor{postit}{bg=yellow}
\pgfsetfillopacity{0.8}
\begin{beamercolorbox}[sep=1em,wd=\textwidth]{postit}
\strut\vspace{13em}\strut% somehow fill the required vertical space?
\end{beamercolorbox}
\end{textblock*}
\pgfsetfillopacity{1}
% Simply repeating the solution again with opaque text
\begin{textblock*}{\paperwidth}[.5,0.5](0.5\paperwidth,0.5\paperheight)
\setbeamercolor{postit}{fg=black}
\pgfsetfillopacity{1}
\begin{beamercolorbox}[sep=1em,wd=\textwidth]{postit}
#1%CONTENT HERE
\end{beamercolorbox}
\end{textblock*}
}
\begin{document}
\setbeamercolor{background canvas}{bg=green}
\begin{frame}{title}
This is some content, we should show it first, and then occlude it.
\only<2->{
\fadeslide{
\begin{itemize}
\item This is almost correct! ( :
\item But it would be even better if the faded region covered the whole slide
\item And if this content were aligned similar to the slide content
\item I fear I don't really understand the solution code enough to achieve this
\end{itemize}
}}
\end{frame}
\setbeamercolor{background canvas}{bg=yellow}
\begin{frame}{title}
The overlay should shade the whole slide, like this.
(also showing the slide content below via transparency).
The overlaid text should be aligned like this text.
\end{frame}
\end{document}
答案1
这很接近,但不是你想要的。我担心如果你让最后一个块完全透明,底层文本可能会与最后一个块的文本混杂在一起。但无论如何:
\documentclass[svgnames,professionalfont,13pt]{beamer}
\usetheme{Rochester}
% http://tex.stackexchange.com/questions/59826/position-an-exampleblock-in-front-of-content
% for overlays
\usepackage[absolute,overlay]{textpos}
\begin{document}
% Begin example slide
%\setbeamercolor{background canvas}{bg=red}
\begin{frame}{title}
\begin{itemize}[<+->]
\item Point 1
\item Point 2
\item Point 3
\item Point 4
\item Point 5
\item Point 6
\end{itemize}
\only<+->{ %http://tex.stackexchange.com/a/80496
\setlength{\TPHorizModule}{\paperwidth}\setlength{\TPVertModule}{\paperheight}
\begin{textblock*}{\paperwidth}[0.5,0.5](0.5\paperwidth,0.5\paperheight)
\setbeamercolor{postit}{fg=black,bg=yellow} % http://tex.stackexchange.com/a/26284/3345
%\pgfsetfillopacity{0.5}
\begin{beamercolorbox}[sep=1em,wd=\textwidth]{postit}
\begin{itemize}
\item The block needs to overlap the slide text
\item The colored title bar needs to be gone
\item I need this box to pop up only at the end
\item The block needs to be horizontally and vertically centered
\item The block needs to be as wide as the page
\item The block needs to be as tall as the slide, excluding the title area
\end{itemize}
\end{beamercolorbox}
\end{textblock*}
%\pgfsetfillopacity{1}
}
\end{frame}
\end{document}