1

I have issues with my beamer presentation: I want to have 3 boxes next to each other, they should first appear all at the same time and then I would specify when the boxes should appear. Without \onslide everything works well, but when I include \overlay, things get messed up:

\documentclass[mathserif]{beamer}
\usetheme{Madrid} 

\usepackage{tcolorbox}
\tcbuselibrary{raster}

\begin{document}




\begin{frame}
\begin{tcbraster}[raster columns=3,raster column skip=0.05cm, size=small, raster force size=false,size=fbox]
        \begin{tcolorbox}[halign=center, valign=center, colframe=blue!80!black, colback=blue!10!lightgray!30, width=3.9cm]
            bla 
    \end{tcolorbox}
        \begin{tcolorbox}[halign=center, colframe=blue!80!black,colback=blue!10!lightgray!30, width=4cm]
            bla 
    \end{tcolorbox}
        \begin{tcolorbox}[halign=center, colframe=blue!80!black,colback=blue!10!lightgray!30, width=4.1cm]
        bla 
    \end{tcolorbox}
\end{tcbraster}
\end{frame}

\begin{frame}
\begin{tcbraster}[raster columns=3,raster column skip=0.05cm, size=small, raster force size=false,size=fbox]
    \onslide<1->{
        \begin{tcolorbox}[halign=center, valign=center, colframe=blue!80!black, colback=blue!10!lightgray!30, width=3.9cm]
            bla 
    \end{tcolorbox}}
    \onslide<1,2->{
        \begin{tcolorbox}[halign=center, colframe=blue!80!black,colback=blue!10!lightgray!30, width=4cm]
            bla 
    \end{tcolorbox}}
    \onslide<1,3->{
        \begin{tcolorbox}[halign=center, colframe=blue!80!black,colback=blue!10!lightgray!30, width=4.1cm]
            bla 
    \end{tcolorbox}}
\end{tcbraster}

\end{frame}

\end{document}

The first two slides which this code produces are the following: enter image description here

As you can see, the alignment in the second slide isn't like I wanted, I don't want a linebreak here. What goes wrong?

1

tcolorbox v4.20 introduced some beamer support options. With them you can apply specific options every slide or hide boxes in particular slides.

Following code adapts OP's second frame to tcbitemize and shows how to use hide and alert options to show every new box one after the other:

\documentclass[mathserif]{beamer}
\usetheme{Madrid} 
\usepackage[most]{tcolorbox}

\begin{document}


\tcbset{beamer alerted/.style={}}

\begin{frame}
\begin{tcbraster}[raster columns=3,raster column skip=0.05cm, size=small, raster force size=false,size=fbox]
        \begin{tcolorbox}[halign=center, valign=center, colframe=blue!80!black, colback=blue!10!lightgray!30, width=3.9cm]
            bla 
    \end{tcolorbox}
        \begin{tcolorbox}[halign=center, colframe=blue!80!black,colback=blue!10!lightgray!30, width=4cm]
            bla 
    \end{tcolorbox}
        \begin{tcolorbox}[halign=center, colframe=blue!80!black,colback=blue!10!lightgray!30, width=4.1cm]
        bla 
    \end{tcolorbox}
\end{tcbraster}
\end{frame}

\begin{frame}
\begin{tcbitemize}[raster columns=3, raster column skip=0.05cm, size=small, 
    raster force size=false, 
    size=fbox, enhanced,
    halign=center, valign=center, colframe=blue!80!black, colback=blue!10!lightgray!30, ]
   \tcbitem[width=3.9cm]
            bla 1
   \tcbitem[width=4cm, hide=<-1>, alert=<2>]
            bla 2
   \tcbitem[width=4.1cm, hide=<-2>, alert=<3>]
            bla 3
\end{tcbitemize}

\end{frame}

\end{document}

enter image description here

Note: In previous code I had to use a forced combination of hide and alert options to show the third box. I think hide should be enough. I will update the answer if I find a better solution.

0

I found out two solutions: If I change the width of the boxes (I was not respecting \textwidth before) and make them smaller, everything works well. But my text is a bit too long for that and the possibly nicer way to do it is inspired by a comment from @samcarter: Just insert a % after the { of \onslide. Both solutions:

\documentclass[mathserif]{beamer}
\usetheme{Madrid}  %% Themenwahl

\usepackage{tcolorbox}
\tcbuselibrary{raster}

\begin{document}

\begin{frame}
\begin{tcbraster}[raster columns=3,raster column skip=0.05cm, size=small, raster force size=false,size=fbox]
    \onslide<1->{
        \begin{tcolorbox}[halign=center, valign=center, colframe=blue!80!black, colback=blue!10!lightgray!30, width=3.5cm]
            bla 
    \end{tcolorbox}}
    \onslide<1,2->{
        \begin{tcolorbox}[halign=center, colframe=blue!80!black,colback=blue!10!lightgray!30, width=3.5cm]
            bla 
    \end{tcolorbox}}
    \onslide<1,3->{
        \begin{tcolorbox}[halign=center, colframe=blue!80!black,colback=blue!10!lightgray!30, width=4.1cm]
            bla 
    \end{tcolorbox}}
\end{tcbraster}

\end{frame}

\begin{frame}
\begin{tcbraster}[raster columns=3,raster column skip=0.05cm, size=small, raster force size=false,size=fbox]
    \onslide<1->{%
        \begin{tcolorbox}[halign=center, valign=center, colframe=blue!80!black, colback=blue!10!lightgray!30, width=3.9cm]
            bla 
    \end{tcolorbox}}
    \onslide<1,2->{%
        \begin{tcolorbox}[halign=center, colframe=blue!80!black,colback=blue!10!lightgray!30, width=4cm]
            bla 
    \end{tcolorbox}}
    \onslide<1,3->{%
        \begin{tcolorbox}[halign=center, colframe=blue!80!black,colback=blue!10!lightgray!30, width=4.1cm]
            bla 
    \end{tcolorbox}}
\end{tcbraster}

\end{frame}

\end{document}

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.