7

Why when using enumerate environment I got error when place \includeonlyframes{} to compile only single frame. But this error dissapear when I remove \includeonlyframes{}.

enter image description here

This is my code:

\documentclass[t]{beamer}

\usepackage{framed, color}
\usepackage{fancybox}
\usepackage{amsmath}
\setbeamercovered{transparent}
\usepackage[labelsep=period]{caption}
\usepackage{setspace}
\usepackage{amssymb}
\usepackage{algorithmicx}
\usepackage{algorithm}
\usepackage{listings}
\usepackage{algcompatible}
\usepackage{algpseudocode}
\usepackage{subcaption}
\usepackage{float}
\usepackage{graphicx}
\usepackage{comment}

\includeonlyframes{current}


\begin{document}

\begin{frame}
msdsadnsajkdnsa
\end{frame}


\begin{frame}
\begin{enumerate}
\onslide<1->
\item ssasas
\begin{equation}
\frac{3q32}{swsasdasdas}
\end{equation}
\onslide<2->
\item msmssmms
\begin{eqnarray}
ssaasa
\end{eqnarray}
\end{enumerate}
\end{frame}

\begin{frame}[label=current]
Mama
\end{frame}

\end{document}
1
  • Thanks for adding the example. I can reproduce the problem; as a workaround, add any label to the frame containing the enumerate: \begin{frame}[label=other] \begin{enumerate}....\end{enumerate}\end{frame}. Feb 20, 2014 at 1:36

2 Answers 2

7

I can confIrm the problem; this simplified document reproduces the error:

\documentclass{beamer}

\includeonlyframes{current}

\begin{document}

\begin{frame}
\begin{enumerate}
\onslide<1->{%
\item test1
}
\onslide<2->{%
\item test2
}
\end{enumerate}
\end{frame}

\begin{frame}[label=current]
test3
\end{frame}

\end{document}

The error message:

! LaTeX Error: Something's wrong--perhaps a missing \item.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.16 \end{frame}

? 

This seems (at least to me) like a bug in beamer.

I can only offer you two work arounds:

  1. Use a label for the frame with the problematic enumerate:

    \documentclass{beamer}
    
    \includeonlyframes{current}
    
    \begin{document}
    
    \begin{frame}[label=anything]
    \begin{enumerate}
    \onslide<1->{%
    \item test1
    }
    \onslide<2->{%
    \item test2
    }
    \end{enumerate}
    \end{frame}
    
    \begin{frame}[label=current]
    test3
    \end{frame}
    
    \end{document}
    
  2. Instead of an "external" overlay specification with \onslide. use the fact that \item is overlay aware:

    \documentclass{beamer}
    
    \includeonlyframes{current}
    
    \begin{document}
    
    \begin{frame}
    \begin{enumerate}
    \item<1-> test1
    \item<2-> test2
    \end{enumerate}
    \end{frame}
    
    \begin{frame}[label=current]
    test3
    \end{frame}
    
    \end{document}
    
6

This is a bug in beamer (although arguably the \item<n> syntax is better here). A fix which I'll check in to beamer for the next release (to go in the preamble):

\makeatletter
\def\gobble@onslide{%
  \@ifnextchar<%>
    \gobble@onslide@aux
    \@firstofone
}
\def\gobble@onslide@aux<#1>{\@firstofone}
\def\beamer@donoframe{%
  \beamer@slideinframe=1\relax%
  \setbox\beamer@tempbox\vbox\bgroup%
    \beamer@inframetrue%
    \leavevmode%
    \def\pause{}%
    \let\onslide\gobble@onslide % Change here
    \afterassignment\beamer@checknoslide\let\beamer@next}
\makeatother

The problem is that the current version of the 'do no slide' code doesn't remove the < ... > from the use of \onslide. Normally that is harmless, but it fails if you wrap up an \item as the < then gets inserted for typesetting before any \item has been seen. On the other hand, when you label the frame the mechanism used to not print it is slightly different (as everything does need to be done properly), hence the difference in outcome.

1
  • 1
    Checked in to beamer sources for next release
    – Joseph Wright
    Feb 20, 2014 at 8:59

You must log in to answer this question.

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