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.

Consider the following code:

\documentclass{beamer}
\usepackage{tcolorbox}

\begin{document}
\begin{frame}
  some text before
  \pause
  \begin{tcolorbox}
    \begin{tabular}{cc}
       cell1 & cell2\\\pause
       cell3 & cell4
    \end{tabular}
  \end{tcolorbox}
  \pause
  some text after
\end{frame}
\end{document}  

The expected result would be that "some text after" only appears on the fourth slide, but "some text after" is already visible on the second slide, then disappears on the third and then reappears in the fourth.

enter image description here

Any hint on what's going on?

Notes:

  • the same result occurs if the tabularx tcolorbox key is used instead of tabular
  • my actual workaround for this is to use \only or \uncover, but I'm more interested in the reason why this doesn't work.

edit: it seems that the tcolorbox environment interferes with the pause counter. If after the tcolorbox envirnoment you put

\setcounter{beamerpauses}{#}

where # is equal to the number of \pause issued before the tcolorbox environment everything works fine.

Uhm, actually that works only in a very specific scenario

share|improve this question
    
No problem if I replace tcolorbox with mdframed. So it is probably something inside the tcolorbox package. (+1) for the question, now I'm curious too. –  masu Nov 13 '13 at 23:30
    
And if you want the warnings to go away, use a more sizeable font like lmodern. \usepackage{lmodern} –  masu Nov 13 '13 at 23:35
    
@masu, of course, that's just the MWE, it's not code that I'm actually using somewhere... –  dcmst Nov 13 '13 at 23:39
    
I've suspected that of course, but who knows. Most people don't submit their MWE with warnings if they're avoidable with one line. But it seems legit to do that here and rule out the font change from the possible causes. –  masu Nov 13 '13 at 23:41
4  
@masu so let me tell you a funny story about most people: most people don't submit MWEs at all! No, wait, most people don't even use LaTeX! So let's just shut down the site and move on with our lives :) –  dcmst Nov 13 '13 at 23:53
show 1 more comment

1 Answer

You shouldn't use \pause inside tabular in the first place... as the beamer manual states:

This command does not work inside amsmath environments like align, since these do really wicked things.

Your main problem is independent from tabular, it's even independent from tcolorbox itself. It's bad interaction between setbeamercovered{invisible} mode of beamer and \endpgfpicture (tcolorbox uses TikZ/pgf as far as I know). The following example shows, that when there are more \pause-s inside the tikzpicture the interpreter fails to hide the upcoming pauses (note: even in another tikzpicture afterwards).

\documentclass{beamer}
\usepackage{tikz}

\begin{document}
\begin{frame}
  some text before
  \pause
  \begin{tikzpicture}
      \node at (0, 3) {Hello};
      \pause
      \node at (0, 2) {World};
      \pause
      \node at (0, 1) {and you};
      \pause
      \node at (0, 0) {and you};
  \end{tikzpicture}
  \pause
  some text after
\end{frame}

\end{document}

((As a workaround one could use \setbeamercovered{transparent=0}. But this still got issues with tabular... where you shouldn't use \pause... and some issues with the \tcolorbox coloring...))

So:

  • avoid using \pause inside tabular
  • avoid using \pause inside tikz therefore inside tcolorbox
  • avoid using any combination of the above
share|improve this answer
1  
the question linked seems to be about a different issue, this should be a comment, not an answer. -1 –  Lep Nov 14 '13 at 8:38
    
@Lep I didn't say, that the question is about the same issue. I would have marked it as a duplicate that case... and what you've just used as an argument for downvote, is flagging cause, not a downvoting one... And I've referred THE TOPIC, not the question. Check this answer and the second comment for example -- this case it would be \onslide<2->, but it practically solves and describes it. –  masu Nov 14 '13 at 8:53
    
I think you are not understanding the question. The OP said that he already has a workaround for the issue, the problem is why some tabular inside a tcolorbox breaks \pause. Since there is no tikz in the MWE, if the problem is some interaction with tikz than it is probably a bug that needs to be addressed. Also, you are pausing the tikz picture in the wrong way in your answer. You need to node<+->, not \pause. It works fine if you pause it correctly –  Lep Nov 14 '13 at 10:26
1  
@Lep tcolorbox draws with TikZ/pgf as far as I know. And you can't use the "correct" way here. I was writing about TikZ because this is the lower level stuff what causes the problem in the first place. –  masu Nov 14 '13 at 10:29
2  
unfortunately the new solution fails if you have nested tcolorbox –  Lep Nov 14 '13 at 17:34
show 3 more comments

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.