Here is a slide. The slide before was the one that we still see in the background. It then became blue and transparent, and the problem line showed up.

enter image description here

Is that possible to use tikZ to arrive at a similar result? If so, can you provide a minimal example so that I can build on it?

  • 1
    Maybe overlay-images-and-block-in-beamer can give you some hints
    – percusse
    Feb 24 '13 at 12:10
  • @percuße: Thank you for this interesting link. However, it is difficult for me to go through this long post and I cannot figure out which is the best solution for my purpose. I am pretty new to LaTeX, beamer, and tikZ... By the way, I'd like the whole slide to get 'transparent', not only a block. Is it still possible to adapt the solution from the other post. Would it be too much to ask a minimal example here?
    – user7064
    Feb 24 '13 at 15:22
  • One possibility is to typeset the code in the background using listings or minted package, convert the pdf output into png, then make the result as a background as tikz node.
    – hpesoj626
    Feb 24 '13 at 16:03

The following solution is based on TikZ. It provides a command \superimpose<overlay spec>[TikZ option for node]{node text} that draws a blue rectangle with 50 percent opacity over the complete slide and then typesets a TikZ node on top of it with the given text.




\tikzset{onslide/.code args={<#1>#2}{%
  \only<#1>{\pgfkeysalso{#2}} % \pgfkeysalso doesn't change the path

  \tikz[overlay, remember picture]{%
    \filldraw#3[blue!30,opacity=0.5](current page.north west) rectangle (current page.south east);
    \node#3[at=(current page),#1]{#2};


\begin{frame}[fragile]{A Listing}
  \lstset{language=C, gobble=4}
    #include <stdio.h>

    int main(void) {
       printf("Hello World!");  
       return 0;
  \superimpose<2>[draw=red, fill=white]{Problem: ugly syntax}%


enter image description here

  • Looks nice ! Let me read it carefully, and I will accept it thereafter (probably tomorrow morning)!
    – user7064
    Feb 24 '13 at 18:51
  • @user7064: It's absolutely okay to wait for a couple of days before accepting the answer that has helped you most. Not doing it too quickly often increases the chance of further answers that might help you even more :-)
    – Daniel
    Feb 24 '13 at 20:29
  • Ok, it exactly fits my purpose :-) (+1). One more question please: instead of a single text line, is it possible to include, for example, \begin{itmize} ... \end{itemize}?
    – user7064
    Feb 25 '13 at 6:00
  • @user7064: Sure. In this case you should give the node a defined width. Add something like text width=0.5\textwidth to the list of node options and then put your itemize environment in the curly braces of the node text. You may also put a beamer box there.
    – Daniel
    Feb 25 '13 at 9:02
  • Ok, nice that it looks simple. But, what node are you speaking about exactly?
    – user7064
    Feb 25 '13 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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