2

Reading Section 9.6.3 of the beamer book, I try to make a new environment which should behave just like alertenv but with different visual effects. Here is the code I use for testing this.

\documentclass{beamer}
\begin{document}

\newenvironment<>{itenv}{\mdseries\itshape}{}
\setbeamercovered{transparent}


\begin{frame}{With \texttt{alertenv}}
before items
  \pause
  \begin{itemize}[<+- | alert@+>]
    \item One
    \item Two
    \item Three
  \end{itemize}
\pause
after items
\end{frame}

\begin{frame}{With \texttt{itenv}}
  \setbeamercovered{transparent}
before items
  \pause
  \begin{itemize}[<+- | it@+>]
    \item One
    \item Two
    \item Three
  \end{itemize}
\pause
after items
\end{frame}
\end{document}

As it turns out, if an overlayed frame uses altenv, the current item changes to alert mode, i.e., painted in red. This item changes its color back to black, as the slide number progresses.

On the other hand, if the same overlayed frame uses itenv, the current item changes to italics. Butt, it does not changes back to non-italics as the slide number progresses.

animation showing frames in sequence

What am I doing wrong here?

Same Example: More Details

The following is a more verbose version of the example above. If someone cares to solve this problem, it might be used to demonstrate the solution.

\documentclass{beamer}
\begin{document}

\newenvironment<>{itenv}{\only{\mdseries\itshape}}{}
\setbeamercovered{transparent}

\begin{frame}{With \texttt{alertenv}}
    before items
    \pause
    \begin{itemize}[<+- | alert@+>]
        \item I will be \textcolor{red}{red} \textbf{first}, and then return to be black. 
        \item I will be \textcolor{red}{red} \textbf{second}, and then return to be black. 
        \item I will be \textcolor{red}{red} \textbf{third}, and then return to be black. 
    \end{itemize}
    \pause
    after items
\end{frame}

\begin{frame}{With \texttt{itenv}}
    before items
    \pause
    \begin{itemize}[<+- | it@+>]
        \item I should be \textit{italicized} \textbf{first}, and then return to be up shaped. 
      Take a close look. Did I return to be ``\textup{Up Shape}''?
        \item I should be \textit{italicized} \textbf{second}, and then return to be up shaped. 
      Ditto. 
      Am I ``\textup{Up Shape}'' or ``\textit{Italicized Shape}''?
        \item I should be \textit{italicized} \textbf{third}, and then return to be up shaped. 
      Did I return to be ``\textup{Up Shape}'' or am I ``\textit{Italicized Shape}''?
    \end{itemize}
    \pause
    after items
\end{frame}

\end{document}

And here is a little animation that demonstrates the problem with my code. enter image description here

1

A possible solution is to insert the \begin{altenv}...\end{altenv} into the newenvironment definition as displayed below

\newenvironment<>{itenv}{%
\begin{altenv}#1
{\mdseries\itshape}
{}{}{}}
{\end{altenv}}

enter image description here enter image description here enter image description here

Code

\documentclass{beamer}
\begin{document}

\newenvironment<>{itenv}{%
\begin{altenv}#1{\mdseries\itshape}
{}{}{}}
{\end{altenv}}

\begin{frame}{With \texttt{alertenv}}
    before items
    \pause
    \begin{itemize}[<+- | alert@+>]
        \item I will be \textcolor{red}{red} \textbf{first}, and then return to be black. 
        \item I will be \textcolor{red}{red} \textbf{second}, and then return to be black. 
        \item I will be \textcolor{red}{red} \textbf{third}, and then return to be black. 
    \end{itemize}
    \pause
    after items
\end{frame}

\begin{frame}{With \texttt{itenv}}
    before items
    \pause
    \begin{itemize}[<+- | it@+>]
        \item I should be \textit{italicized} \textbf{first}, and then return to be up shaped. 
      Take a close look. Did I return to be ``\textup{Up Shape}''?
        \item I should be \textit{italicized} \textbf{second}, and then return to be up shaped. 
      Ditto. 
      Am I ``\textup{Up Shape}'' or ``\textit{Italicized Shape}''?
        \item I should be \textit{italicized} \textbf{third}, and then return to be up shaped. 
      Did I return to be ``\textup{Up Shape}'' or am I ``\textit{Italicized Shape}''?
    \end{itemize}
    \pause
    after items
\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.