18

When I make a presentation with nested enumerations where each enumeration needs to be animated, the inner enumeration is completely hidden from the slide until its parent becomes visible, while the other items are only watermarked. Is there a way all the items are watermarked until they become active?

Code:

\begin{frame}{Test}
   \begin{enumerate}[<+->]
      \item Item1
      \item Item2
      \begin{enumerate}[<+->]
         \item Item2A
         \item Item2B
      \end{enumerate}
      \item Item3
   \end{enumerate}
\end{frame}
4
  • 2
    Can you try putting \setbeamercovered{transparent} after \begin{document} ?
    – percusse
    Commented Apr 15, 2012 at 20:30
  • I have done that, it doesn't seem to solve the problem. Commented Apr 15, 2012 at 21:56
  • 6
    They are not invisible they are too dim. I can see them on my screen. But still, I don't have a fix.
    – percusse
    Commented Apr 15, 2012 at 22:09
  • 3
    I agree it's a detail, it however makes the audience starts focusing on the list of subitems that become less dim. Thats of course not the intention. :D Commented Apr 15, 2012 at 23:38

2 Answers 2

14

You can use \only to change the transparency level for the nested environment:

\documentclass{beamer}

\setbeamercovered{transparent}

\begin{document}

\begin{frame}{Test}
\begin{enumerate}[<+->]
  \item Item1
  \item Item2
  \only<1->{\setbeamercovered{transparent=100}}
  \only<2->{\setbeamercovered{transparent=15}}
  \begin{enumerate}[<+->]
    \item Item2A
    \item Item2B
  \end{enumerate}
  \item Item3
\end{enumerate}
\end{frame}

\end{document}

An image of the first frame:

enter image description here

The code can be automated with the help of the etoolbox package:

\documentclass{beamer}
\usepackage{etoolbox}

\setbeamercovered{transparent}

\makeatletter
\BeforeBeginEnvironment{enumerate}{\ifnum\@enumdepth=1 
  \only<1->{\setbeamercovered{transparent=100}}%
  \only<\theenumi->{\setbeamercovered{transparent=20}}%
\fi
}
\makeatother

\begin{document}

\begin{frame}{Test}
\begin{enumerate}[<+->]
  \item Item1
  \item Item2
  \item Item3
  \begin{enumerate}[<+->]
    \item Item3A
    \item Item3B
    \item Item3C
  \end{enumerate}
  \item Item4
\end{enumerate}
\end{frame}

\end{document}

The first frame:

enter image description here

4
  • That solves the problem! I will probably use this code because the deadline is within 2 days. However I had hoped for a more elegant solution :s. For instance in this sample one needs to calculate when a item will become visible. Commented Apr 16, 2012 at 21:03
  • 1
    @CommuSoft: I've updated my answer with an automated version. Commented Apr 16, 2012 at 21:28
  • Note that in your automated version you used 20 instead of 15. (It doesn't seem to make a difference in the output ...) Commented Sep 25, 2012 at 16:02
  • This solution works great with \setbeamercovered{transparent}, but not with \setbeamercovered{dynamic} (or highly dynamic). Commented Sep 25, 2012 at 16:03
15

As percusse noted in his comment, the subitems are not invisible but just much dimmer than the items. I don't think that this is the intended behaviour! What happens here is that the nested enumerates give you nested actionenvs, and each action environment level gives a dimming of 85%.

To fix this, it's best to get rid of the nesting of action environments. From Gonzalo's answer I took the idea to use \BeforeBeginEnvironment and \AfterEndEnvironment from the etoolbox package. The code below works with nested enumerate, itemize and description. The following output is created with \setbeamercovered{highly dynamic} instead of \setbeamercovered{transparent}, just to demonstrate that this also works.

animated output

\documentclass{beamer}
\usepackage{etoolbox}
%\setbeamercovered{transparent}
\setbeamercovered{highly dynamic}
\makeatletter
\newcommand*\fix@beamer@close{%
  \ifnum\beamer@trivlistdepth>0
    \beamer@closeitem
  \fi
  }
\newcommand*\fix@beamer@open{%
  \ifnum\beamer@trivlistdepth>0
    \gdef\beamer@closeitem{}%
  \fi
  }
\BeforeBeginEnvironment{enumerate}{\fix@beamer@close}
\AfterEndEnvironment{enumerate}{\fix@beamer@open}
\BeforeBeginEnvironment{itemize}{\fix@beamer@close}
\AfterEndEnvironment{itemize}{\fix@beamer@open}
\BeforeBeginEnvironment{description}{\fix@beamer@close}
\AfterEndEnvironment{description}{\fix@beamer@open}
\makeatother
\begin{document}
\begin{frame}{Test}
   \begin{enumerate}[<+->]
      \item Item1
      \item Item2
      \begin{itemize}%[<+->]
         \item Item2A
         \item Item2B
      \end{itemize}
      \item Item3
   \end{enumerate}
\end{frame}
\end{document}

Note that you don't need the [<+->] in the inner enumerate or itemize environment. (By default, the [<+->] of the outer environment is used.)

1
  • this forces itemize on new line on description-environment. could you explain a bit, why this works?
    – sivizius
    Commented Jan 9, 2019 at 3:53

You must log in to answer this question.

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