1

How to define a new tcolorbox to achieve the following using \onslide but with out \onslide in every tcolorbox

Slide 1: Heading

Slide 2: Upper text

Slide 3: Lower text

\documentclass{beamer}
\usepackage{tcolorbox}

\begin{document}
\begin{frame}
\begin{tcolorbox}[title={Valency = ?},
colframe=green!50!black,
colback=green!50!black!10!white,
]
\onslide<2->{Hydrogen, H}
\tcblower
\onslide<3>{1}
\end{tcolorbox}
\end{frame}
\end{document}
1
  • 2
    Your document is not compilable... no document class, no packages
    – user31729
    Feb 27, 2019 at 12:26

1 Answer 1

3

One way to achieve this, but with ugly 'jumping', depending on the needs, is to use the overlay statement only=<1->{...} with the relevant options to hide the lower box etc, and the segmentation line etc.

\documentclass{beamer}
\usepackage[most]{tcolorbox}

\begin{document}
\begin{frame}
\begin{tcolorbox}[only=<1->{title={Valency = ?}},only=<1-2>{lowerbox=ignored,segmentation hidden},
colframe=green!50!black,
colback=green!50!black!10!white,
]
\onslide<2->{Hydrogen, H}
\onslide<3->{%
\tcblower
1}
\end{tcolorbox}
\end{frame}
\end{document}

With a wrapper command:

\documentclass{beamer}
\usepackage[most]{tcolorbox}

\NewDocumentCommand{\MyNiceBox}{+O{}+m+m+m}{%
  \begin{tcolorbox}[only=<1->{title={#2}},only=<1-2>{lowerbox=ignored,segmentation hidden},
    colframe=green!50!black,
    colback=green!50!black!10!white,
    #1]
    \onslide<2->{#3}
    \onslide<3->{%
      \tcblower
      #4}
  \end{tcolorbox}%
}


\begin{document}
\begin{frame}
\MyNiceBox{Valency = ?}{Hydrogen, H}{1}
\end{frame}
\end{document}

enter image description here

enter image description here

enter image description here

3
  • To be edited later on...
    – user31729
    Feb 27, 2019 at 12:36
  • i want to define a new tcolorbox with out using onslide in every tcolorbox
    – sandu
    Feb 28, 2019 at 3:52
  • @sandu: You wrote: A new tcolorbox... with onslide...
    – user31729
    Feb 28, 2019 at 19:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .