I found this slides on Internet with a very nice style.
http://www.eecs.harvard.edu/~tov/pubs/alms/alms-popl2011-slides.pdf
How can I overlay blocks and image as in this slides? Specially this effect:
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityI found this slides on Internet with a very nice style.
http://www.eecs.harvard.edu/~tov/pubs/alms/alms-popl2011-slides.pdf
How can I overlay blocks and image as in this slides? Specially this effect:
I can provide you a very basic solution: it is not perfect, but actually does what you wonder.
Initially I defined two tikzstyle
s to characterize whether the block is alerted or not:
\tikzset{visib/.style={rectangle,color=blue,fill=blue!10,text=black,draw,text opacity=0.4, text width=#1,align=flush center}}
\tikzset{invisib/.style={rectangle,color=gray,fill=gray!10,text=black,draw,text opacity=0.4, text width=#1,align=flush center}}
Then I defined an environment where to insert blocks:
\newenvironment{myfancyblock}%
{\begin{center}\begin{tikzpicture}}%
{\end{tikzpicture}\end{center}}%
and the key command:
\newcommand{\opaqueblock}[4]{
\node<#1>[#2=#3] (X) {#4};
}
where:
Look at this MWE:
\documentclass{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usetheme{CambridgeUS}
\useinnertheme{rounded}
\useoutertheme{infolines}
\usecolortheme{seahorse}
% command to highlight text in orange
\newcommand{\alertor}[1]{\textcolor{orange}{#1}}
\tikzset{visib/.style={rectangle,color=blue,fill=blue!10,text=black,draw,text opacity=0.4, text width=#1,align=flush center}}
\tikzset{invisib/.style={rectangle,color=gray,fill=gray!10,text=black,draw,text opacity=0.4, text width=#1,align=flush center}}
\newenvironment{myfancyblock}{\begin{center}
\begin{tikzpicture}}{\end{tikzpicture}
\end{center}}
\newcommand{\opaqueblock}[4]{
\node<#1>[#2=#3] (X) {#4};
}
\begin{document}
\begin{frame}{My frame with footnotes}
\begin{myfancyblock}
\opaqueblock{1}{visib}{\textwidth}{All you have to do to initialize a GLSurfaceView is call setRenderer().
However, if desired, you can modify the default behavior of GLSurfaceView
by calling \alertor{one or more} of these methods before \alertor{setRenderer}:
\begin{itemize}
\item setDebug()
\item setChooser()
\item setWrapper()
\end{itemize}
\begin{flushright}
(Android 2.2 API Reference)
\end{flushright}
}
\opaqueblock{2-}{invisib}{\textwidth}{All you have to do to initialize a GLSurfaceView is call setRenderer().
However, if desired, you can modify the default behavior of GLSurfaceView
by calling \alertor{one or more} of these methods before \alertor{setRenderer}:
\begin{itemize}
\item setDebug()
\item setChooser()
\item setWrapper()
\end{itemize}
\begin{flushright}
(Android 2.2 API Reference)
\end{flushright}
}
\opaqueblock{2}{visib}{0.6\textwidth}{You can optionally modify the behaviour of GLSurfaceView by calling one or more debugging methods \alertor{setDebug()}, and \alertor{setWrapper()}. These methods can be called \alertor{before and or after setRender}}
\opaqueblock{3-}{invisib}{0.6\textwidth}{You can optionally modify the behaviour of GLSurfaceView by calling one or more debugging methods \alertor{setDebug()}, and \alertor{setWrapper()}. These methods can be called \alertor{before and or after setRender}}
\opaqueblock{3}{visib}{0.7\textwidth}{Once the render is set, you can control whether the render draws continuously or on demand by calling \alertor{setRenderMode()}}
\end{myfancyblock}
\visible<3->{
This is stuff text:
\begin{itemize}
\item hello
\item hello
\item hello again
\end{itemize}
}
\end{frame}
\end{document}
Since it is a very basic solution, it has some drawbacks: first you need to specify twice the same text using both styles visib and invisib although I would have been able to let things happen automatically. Second the text alignment is always centered, but I thought that inserting a further argument would have been too much heavy.
The result is shown in the following frames:
IMPROVEMENT
To cope with issues mentioned above, here is an improvement to my solution. The basic idea is to store the text put in a visib block to subsequently recall it when using an invisib block. To do so I defined two commands:
\makeatletter
\newcounter{thistext}
\newcommand{\savetext}[2]{%
«#1»%
\addtocounter{thistext}{1}%
\@namedef{thistext\thethistext}{#2}}
\newcommand{\printthistext}[1]{\@nameuse{thistext#1}}
\makeatother
changed the previous \opaqueblock
into:
\newcommand{\opaqueblock}[3]{
\node<#1>[visib=#2] (X) {#3};
\savetext{mytext}{#3}
}
(no more need of the argument to select the type of block) and defined a new command just for invisib blocks:
\newcommand{\invblock}[2]{
\node<#1>[invisib=#2] (X) {\printthistext{\thethistext}};
}
Moreover I changed the text alignment
in the definition of blocks:
\tikzset{visib/.style={rectangle,color=blue,fill=blue!10,text=black,draw,text opacity=0.4, text width=#1,align=justify}}
\tikzset{invisib/.style={rectangle,color=gray,fill=gray!10,text=black,draw,text opacity=0.4, text width=#1,align=justify}}
Thus the MWE could be simplified into:
\documentclass{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usetheme{CambridgeUS}
\useinnertheme{rounded}
\useoutertheme{infolines}
\usecolortheme{seahorse}
% command to highlight text in orange
\newcommand{\alertor}[1]{\textcolor{orange}{#1}}
\tikzset{visib/.style={rectangle,color=blue,fill=blue!10,text=black,draw,text opacity=0.4, text width=#1,align=justify}}
\tikzset{invisib/.style={rectangle,color=gray,fill=gray!10,text=black,draw,text opacity=0.4, text width=#1,align=justify}}
\makeatletter
\newcounter{thistext}
\newcommand{\savetext}[2]{%
«#1»%
\addtocounter{thistext}{1}%
\@namedef{thistext\thethistext}{#2}}
\newcommand{\printthistext}[1]{\@nameuse{thistext#1}}
\makeatother
\newenvironment{myfancyblock}{\begin{center}
\begin{tikzpicture}}{\end{tikzpicture}
\end{center}}
\newcommand{\opaqueblock}[3]{
\node<#1>[visib=#2] (X) {#3};
\savetext{mytext}{#3}
}
\newcommand{\invblock}[2]{
\node<#1>[invisib=#2] (X) {\printthistext{\thethistext}};
}
\begin{document}
\begin{frame}{My frame with footnotes}
\begin{myfancyblock}
% First block
\opaqueblock{1}{\textwidth}{All you have to do to initialize a GLSurfaceView is call setRenderer().
However, if desired, you can modify the default behavior of GLSurfaceView
by calling \alertor{one or more} of these methods before \alertor{setRenderer}:
\begin{itemize}
\item setDebug()
\item setChooser()
\item setWrapper()
\end{itemize}
\begin{flushright}
(Android 2.2 API Reference)
\end{flushright}
}
\invblock{2-}{\textwidth}
% Second block
\opaqueblock{2}{0.6\textwidth}{You can optionally modify the behaviour of GLSurfaceView by calling one or more debugging methods \alertor{setDebug()}, and \alertor{setWrapper()}. These methods can be called \alertor{before and or after setRender}}
\invblock{3-}{0.6\textwidth}
% Third block
\opaqueblock{3}{0.7\textwidth}{Once the render is set, you can control whether the render draws continuously or on demand by calling \alertor{setRenderMode()}}
\end{myfancyblock}
\visible<3->{
This is stuff text:
\begin{itemize}
\item hello
\item hello
\item hello again
\end{itemize}
}
\end{frame}
\end{document}
Now the only requirement is to put \invblock
just after the definition of a \opaqueblock
to print the correct text. The graphical result is:
Implementation with the
dynblocks
package
Note: the version 0.2a
is required.
\documentclass{beamer}
\usepackage{lmodern}
\usepackage{dynblocks}
\usetheme{CambridgeUS}
\useinnertheme{rounded}
\useoutertheme{infolines}
\usecolortheme{seahorse}
% command to highlight text in orange
\newcommand{\alertor}[1]{\textcolor{orange}{#1}}
\begin{document}
\begin{frame}{My frame with footnotes}
\begin{dynblock}
% First block
\opaqueblock<1>{All you have to do to initialize a GLSurfaceView is call setRenderer().
However, if desired, you can modify the default behavior of GLSurfaceView
by calling \alertor{one or more} of these methods before \alertor{setRenderer}:
\begin{itemize}
\item setDebug()
\item setChooser()
\item setWrapper()
\end{itemize}
\begin{flushright}
(Android 2.2 API Reference)
\end{flushright}
}
\invblock<2->
% Second block
\opaqueblock<2>[0.6\textwidth]{You can optionally modify the behaviour of GLSurfaceView by calling one or more debugging methods \alertor{setDebug()}, and \alertor{setWrapper()}. These methods can be called \alertor{before and or after setRender}}
\invblock<3->
% Third block
\opaqueblock<3>[0.7\textwidth]{Once the render is set, you can control whether the render draws continuously or on demand by calling \alertor{setRenderMode()}}
\end{dynblock}
\visible<3->{
This is stuff text:
\begin{itemize}
\item hello
\item hello
\item hello again
\end{itemize}
}
\end{frame}
\end{document}
This answer, as already mentioned by Martin in his comment, demonstrates the general ways to approach absolute positioning by using textpos
or tikz
in beamer.
Warning: texpos
interacts badly on the shipout level with pgfpages
(the pgfpages
transformations are not applied to the content that has been inserted via textpos
). If you also need pgfpages
for two-screen-support or preparing n-up handouts, you should use tikz
or apply this trick from Andrew Stacey to prevent the problem.
However, in your specific case you might as well use a simple hack by inserting a negative \vskip
before the overlay block:
\documentclass{beamer}
\usecolortheme{rose} % for 'visible' blocks
\begin{document}
\newcommand{\mylist}{%
\begin{itemize}
\item Item
\begin{itemize}
\item Subitem
\item Subitem
\begin{itemize}
\item Subsubitem
\item Subsubitem
\end{itemize}
\item Subitem
\item Subitem
\end{itemize}
\item Item
\item Item
\begin{itemize}
\item Subitem
\item Subitem
\item Subitem
\end{itemize}
\end{itemize}
}
\begin{frame}[t]{Frame}
\mylist
\pause
\vskip-3cm
\begin{block}{The Overlay Block}
Block Text
\end{block}
\end{frame}
\end{document}
Seeing the remaining slides, I think there is a heavy use of TikZ in this document and I think everything is a TikZ node instead of blocks. So here is a quick stab at Beamer/PGF interplay. There might be easier ways in terms of the effect but PGF based commands are the shortest path for me so far. There is a remember picture,overlay
option in action so make sure you run it twice.
\documentclass[10pt]{beamer}
\usepackage{tikz}
\begin{document}
\newcommand{\opaqalert}[2]{\alt<#1>{\pgfsetfillopacity{1}\alert{#2}\pgfsetfillopacity{0.2}}{#2}}
\begin{frame}[t]{Example: OpenGL on Android}
\begin{tikzpicture}
\begin{scope}
\only<2->{\pgfsetfillopacity{0.2}\pgfsetstrokeopacity{0.2}}
\node[thick,draw=red,draw,text width=\textwidth,inner color=white,outer color=red!10] (n1) at (0,0) {
All you have to do to initialize a GLSurfaceView is call \texttt{setRenderer()}. However,
if desired, you can modify the default behavior of GLSurfaceView by calling
\opaqalert{2}{one or more} of these methods before \opaqalert{2}{\texttt{setRenderer}}:
\begin{itemize}
\item \opaqalert{2}{\texttt{setDebug()}}
\item \opaqalert{2}{\texttt{setChooser()}}
\item \opaqalert{2}{\texttt{setWrapper()}}.\hfill(Android 2.2 API Reference)
\end{itemize}
};
\end{scope}
\begin{scope}
\node<3->[thick,draw=red,draw,text width=0.9\textwidth,inner color=white,outer color=red!10] (n2) at (0,0) {
\only<3->{\pgfsetfillopacity{0.2}\pgfsetstrokeopacity{0.2}}
You can optionally modify the behavior of GLSurfaceView
by calling one or more of the debugging methods \opaqalert{3}{\texttt{setDebug()}},
and \opaqalert{3}{\texttt{setWrapper()}}. These methods may be called before
and/or after \opaqalert{3}{\texttt{setRenderer}},...};
\end{scope}
\begin{scope}
\node<4->[thick,draw=red,draw,text width=\textwidth,inner color=white,outer color=red!10] (n3) at (0,0) {
\only<4->{\pgfsetfillopacity{0.2}\pgfsetstrokeopacity{0.2}}
\opaqalert{4}{Once the renderer is set}, you can control whether the renderer draw continuously
or on demand by calling \opaqalert{4}{\texttt{setRenderMode()}}.};
\end{scope}
\end{tikzpicture}
\begin{tikzpicture}[remember picture,overlay]
\fill<5>[fill=white,opacity=0.8] (current page.north east) rectangle (current page.south west);
\node<5> at (current page.center){\huge Typestate};
\end{tikzpicture}
\end{frame}
\end{document}
I still think that it's not a good idea to overlay text as authors did. It doesn't convey the message and there is an excessive use of overlays. To be honest if I was in this talk I would be wondering about how the nodes are overlayed instead of the content. Especially frame 5 has the cardinal sin of presentation rules (maybe they deliberately wanted to give a confusion effect). I noticed a shading in the background quite later for example. I hate to sound like a stupid life coach but indeed less is more in this case.
By the way, I didn't try it but those boxes can be beamercolorbox
es inside the nodes.
beamer
s overlays together with How can I position an image in an arbitrary position in beamer?. I'm sure someone will write a solution for it. I would, but I don't have much time today.