1

I am creating a presentation using latex and beamer. I plan to have a roadmap shown at certain points in the presentation. To this purpose, I have defined

\newcommand{\roadmapframe}[1]{
\begin{frame}
\label{roadmap_frame}

\setbeamercovered{transparent}
Roadmap:

% if #1 (first argument) is not defined, print the whole thing. 
%  Otherwise highlight only the one passed as #1. How to do this?

\begin{itemize}
\item<1> El 1
\item<1> El2 
\item<0> El3

\end{frame}

}

I would like to behave it this way: If I call \roadmap, then all three items are printed with full opacity. If I call \roadmap{2}, then only the 2 element is at full opacity and the other two are transparent.

How can I achieve this?

3
\documentclass{beamer}
\usepackage{ifthen}
\newcounter{maxroad}

\newcommand{\roadmapframe}[1][]{%
    \ifthenelse{\equal{#1}{}}{%
        \setcounter{maxroad}{3}
    }{
        \setcounter{maxroad}{#1}
    }
    \begin{frame}<\themaxroad>
    \setbeamercovered{transparent}
    Roadmap:
    \ifthenelse{\equal{#1}{}}{%
      \begin{itemize}[<+->]
              \item El 1
              \item El2 
              \item El3
      \end{itemize}
    }{
      \begin{itemize}[<+>]
              \item El 1
              \item El2 
              \item El3
      \end{itemize}
    }
  \end{frame}
}

\begin{document}

\roadmapframe

\roadmapframe[1]

\roadmapframe[2]

\roadmapframe[3]

\end{document}
3

Don't know whether you want that or what @samcarter posted. This leads to the same like @samcarter's, but you can specify the relations to the number in the optional argument in \roadmapitem's argument.

\documentclass[]{beamer}

\newcount\roadmaponly
\makeatletter
\newcommand*\roadmapitem[1]
  {%
    \ifnum\roadmaponly=-1
      \expandafter\@firstoftwo
    \else
      \ifnum\roadmaponly#1\relax
        \expandafter\expandafter\expandafter\@firstoftwo
      \else
        \expandafter\expandafter\expandafter\@secondoftwo
      \fi
    \fi
    {\item}{\item<0>}%
  }
\makeatother
\newcommand*\roadmapframe[1][-1]
  {%
    \begin{frame}%
      \roadmaponly=#1
      \setbeamercovered{transparent}%
      Roadmap:

      \begin{itemize}
        \roadmapitem{=0} E13
        \roadmapitem{=1} E1 1
        \roadmapitem{=1} E12
      \end{itemize}
    \end{frame}%
  }

\begin{document}
\roadmapframe[0]
\roadmapframe[1]
\roadmapframe[2]
\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.