[Tex/LaTex] Overlay an Entire Slide with a Semitransparent Rectangle in Beamer

beamertikz-pgf

Using tikz to overlay an entire slide with a semitransparent rectangle is a nice gimmick in presentations. There is only one drawback: If the theme that has a footer, the footer is not covered by the rectangle which looks kinda ulgy as you can see here:

enter image description here

Using a theme without a footer is obviously a workaround, but it would be even nicer if the rectangle would cover the whole slide. Any ideas how this could be done?

Here is the code:

\documentclass{beamer}
\usepackage{tikz}
\usetheme{Copenhagen}

\newcommand<>{\overlay}[1]{\uncover#2{%
  \begin{tikzpicture}[remember picture,overlay]%
  \draw[fill=black,opacity=0.70] 
  (current page.north east) rectangle (current page.south west);
  \node at (current page.center) {#1};
  \end{tikzpicture}}
}

\begin{document}
\section{Beamer}
  \begin{frame}{Beamer}
   Some text
  \overlay<2>{
   \huge \textcolor{white}{
     \begin{minipage}{.8\linewidth}  
       \begin{block}{Really Important}
       Some thing one should always KEEP in mind.
       \end{block}
     \end{minipage}
    } 
  }
  \end{frame}
\end{document}

Best Answer

This is possible by hooking in to the footline template. Fortunately, beamer provides the \addtobeamertemplate command so once the theme has been loaded it is straightforward to add some extra code there. With the mechanics sorted, the next question is as to how to make it easy to use. What I decided to do (though there may well be other methods) was to use the \addtobeamertemplate to place an overlaid tikzpicture as the last thing on the page. Then I provide a macro which can place things in this picture. This is cleared every slide, so using overlay specifications it is to control what appears on each slide. Here's an example (hopefully it's clear from the pictures that the overlay really does cover everything. Setting the fill colour to something like pink makes it even clearer):

\documentclass{beamer}
%\url{http://tex.stackexchange.com/q/45420/86}
\usepackage{tikz}
\usetheme{Copenhagen}

\makeatletter
\def\ft@overlay{}

\addtobeamertemplate{footline}{}%
{%
  \lineskiplimit0pt
  \begin{tikzpicture}[remember picture,overlay]%
  \ft@overlay
  \end{tikzpicture}%
  \gdef\ft@overlay{}%
}

\newcommand<>{\addtooverlay}[1]{%
  \only#2{%
  \expandafter\gdef\expandafter\ft@overlay\expandafter{\ft@overlay #1}%
  }%
}

\makeatother

\begin{document}
\section{Beamer}
  \begin{frame}{Beamer}
   Some text
   \pause
   \addtooverlay<.(1)>{%
     \draw[fill=black,opacity=0.70] 
     (current page.north east) rectangle (current page.south west);
     \node[text=white,font=\Huge] at (current page.center) {Overlaid};
   }
   \pause
   And yet more text
  \end{frame}
\end{document}

Slide one, no overlay Slide two, with overlay Slide three, no overlay