0

I have a beamer slide with several code snippets formatted using tcblisting and displayed using tcb raster blocks. I would like to reveal the tcblisting blocks one at a time, but I haven't been able to get the overlay specification right.

Here's the Beamer frame:

\begin{frame}[fragile=singleslide]
  \begin{ccodeblock}{C Source}
    long plus(long x, long y);

    void sumstore(long x, long y, long *dest)
    {
      long t = plus(x, y);
      *dest = t;
    }
  \end{ccodeblock}
  \begin{tcbraster}[raster columns=2, raster equal height]
    \begin{gascodeblock}{Assembly Output (x86-64)}
      sumstore:
        pushq   %rbx
        movq    %rdx, %rbx
        call    plus
        movq    %rax, (%rbx)
        popq    %rbx
        ret
    \end{gascodeblock}
    \begin{verbatimcodeblock}{Machine Code}
      0x53 0x48 0x89 0xd3 0xe8
      0xf2 0xff 0xff 0xff 0x48
      0x89 0x03 0x5b 0xc3
    \end{verbatimcodeblock}
  \end{tcbraster}
\end{frame}

The ccodeblock, gascodeblock, and verbatimcodeblock are defined using \newtcblisting. I would like to have:

  • ccodeblock on all slides
  • gascodeblock on <2->
  • verbatimcodeblock on <3->

I have tried using \only, \onlyenv, etc., but end up with the overlay specifications (e.g., <2->) showing up in the typeset output.

thanks,
tom.

  • 1
    Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user36296 Feb 13 '17 at 14:41
  • 1
    tcolorbox provides an only key for use with beamer – user31729 Feb 13 '17 at 14:47
1

I don't want to guess how your custom tcblistings are defined, so I just took some random code from the tcolorbox manual.

Simply using \pause works fine if the frame option fragile=singleslide is replaced by fragile -- which makes sense, as you want to have fragile content on multiples slides.

\documentclass[11pt]{beamer}

\usepackage[listings]{tcolorbox}

\begin{document}
\begin{frame}[fragile]
  \begin{tcblisting}{colback=red!5!white,colframe=red!75!black}
    long plus(long x, long y);

    void sumstore(long x, long y, long *dest)
    {
      long t = plus(x, y);
      *dest = t;
    }
  \end{tcblisting}
  \pause
  \begin{tcblisting}{colback=red!5!white,colframe=red!75!black}
    sumstore:
      pushq   %rbx
      movq    %rdx, %rbx
      call    plus
      movq    %rax, (%rbx)
      popq    %rbx
      ret
  \end{tcblisting}
\end{frame}


\end{document}

enter image description here

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.