Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
Maybe, adding some extra offset just to make sure you cover it? –  percusse Feb 22 '12 at 16:48
    
After some experiment, I think the footline is printed over the slide contents. So it's not a positioning but an order of drawing problem. –  percusse Feb 22 '12 at 17:04
    
@percusse, I think so too. It seems as if beamer draws the footer after the main content. –  maetra Feb 22 '12 at 17:13
    
This might be useful on understanding how a frame is built up: tex.stackexchange.com/q/26299/86, though I notice that it doesn't quite explain what's going on here. The footline stuff is in the footer, which is placed after the content of the page, whence on top. So if you want a transparent rectangle over the whole lot, it'll have to go in the footer. This is definitely possible. Exactly how easy depends on what templates beamer has for the footer. –  Loop Space Feb 22 '12 at 19:02

1 Answer 1

up vote 9 down vote accepted

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

share|improve this answer
    
Ah, so it is called \addtobeamertemplate! I was searching for an append command. –  percusse Feb 22 '12 at 19:31
    
@percusse This one was new for me this time: previously I've done similar things by overwriting the template, but adding to it is much neater. (The mysteries of beamer templates are still mysteries to me.) –  Loop Space Feb 22 '12 at 20:00
    
@AndrewStacey, I just found out that if I add some more text in the overlayed slide, linespacing doesn't seem to be correct. See for example this \begin{minipage}{.8\linewidth} \begin{block}{Really Important} Some thing one should always KEEP in mind.\end{block} The \linespread command does not have any effect. Adding \\ \vspace{} does work, but it is kinda annoying to add it after each line. –  maetra Feb 25 '12 at 10:02
    
@maetra Can you edit a full example into your question? I'm not clear as to where you are adding this. –  Loop Space Feb 25 '12 at 11:07
    
@AndrewStacey, I hope everything is clear now. If you compare the layout of the minipage using the code from my MWE and your MWE, you see that in the latter the g from thing almost touches the second E in KEEP. –  maetra Feb 25 '12 at 13:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.