I want to make a presentation with certain tasks, but since there are certain problems with using enumitem
with beamer
, I decided to make it myself, so I have this example code:
\documentclass{beamer}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{ifthen}
\usetheme{CambridgeUS}
\newcounter{tasknumber}
\stepcounter{tasknumber}
\newcounter{taskletter}
\resetcounteronoverlays{tasknumber}
\resetcounteronoverlays{taskletter}
\newcommand{\task}[1][ ]
{
\ifthenelse{\equal{#1}{+}}{
\stepcounter{tasknumber}\setcounter{taskletter}{0}}{} %<- why this doesn't work?
Task \thetasknumber.
}
\newcommand{\taskl}
{
\stepcounter{taskletter}
\alph{taskletter})
}
\begin{document}
\begin{frame}
\frametitle{\task}
\taskl ...
\taskl ...
\taskl ...
\end{frame}
%\setcounter{taskletter}{0}
\begin{frame}
\frametitle{\task[+]}
\taskl ...
\taskl ...
\taskl ...
\end{frame}
\end{document}
Obviously, I want to get first frame for first task with a), b) and c), and second frame for second task with a) b) and c) as well, but I get d), e) and f) on second frame. I wouldn't like adding \setcounter{taskletter}{0}
after every frame.
\resetcounteronoverlays
, I get the same problem\usepackage{etoolbox} \AtBeginEnvironment{frame}{\setcounter{taskletter}{0}}
in the preamble seems to reset the counter for each frame. You may also want to add a%
to the end of the line containing\ifthenelse
to avoid excess whitespace on Tasks 2-n.