Trouble combining enumitem and beamer
As you already mentioned, enumitem
"disturbs" beamer
. This is because the document class (beamer
in this case) defines (or redefines) all the necessary commands/macros and environments to it's liking. Then, each loaded package does the same sequentially. As such, since enumitem
follows the document class, it redefines the itemize
(and other) environments, thereby removing beamer
's modified overlay specification.
It is possible to tap into the main level list environment parameters by patching the command \@listI
. The following shows the definition of the three levels contained in beamerbaselocalstructure.sty
:
%
% List stuff
%
\setlength\leftmargini {2em}
\setlength\leftmarginii {2em}
\setlength\leftmarginiii {2em}
\setlength \labelsep {.5em}
\setlength \labelwidth{\leftmargini}
\addtolength\labelwidth{-\labelsep}
\def\@listi{\leftmargin\leftmargini
\topsep 3\p@ \@plus2\p@ \@minus2.5\p@
\parsep 0\p@
\itemsep3\p@ \@plus2\p@ \@minus3\p@}
\let\@listI\@listi
\def\@listii{\leftmargin\leftmarginii
\topsep 2\p@ \@plus1\p@ \@minus2\p@
\parsep 0\p@ \@plus\p@
\itemsep \parsep}
\def\@listiii{\leftmargin\leftmarginiii
\topsep 2\p@ \@plus1\p@ \@minus2\p@
\parsep 0\p@ \@plus\p@
\itemsep \parsep}
A patch using \patchcmd
, as provided by etoolbox
, that changes \itemsep3\p@
to \itemsep2em
(say) modifies the command globally from 3pt
to 2em
:
\documentclass{beamer}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\@listI}{\itemsep3\p@}{\itemsep2em}{}{}
\makeatother
\begin{document}
\begin{frame}
\begin{itemize}[<+->]
\item First.
\item Second.
\item Third.
\end{itemize}
\end{frame}
\end{document}
The use of the \makeatletter
/\makeatother
pair is required, since the macro definition of \@listI
contains @
. Note that this patch does not modify the shrink (3pt
) or stretch (2pt
) of \itemsep
.
You can redefine the \itemize
command as defined in beamerbaselocalstructure.sty
; in the following example I defined a global itemsep
length of 2em
(the line signaled with %NEW
) for this command:
\documentclass{beamer}
\makeatletter
\renewcommand{\itemize}[1][]{%
\beamer@ifempty{#1}{}{\def\beamer@defaultospec{#1}}%
\ifnum \@itemdepth >2\relax\@toodeep\else
\advance\@itemdepth\@ne
\beamer@computepref\@itemdepth% sets \beameritemnestingprefix
\usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
\usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
\usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
\list
{\usebeamertemplate{itemize \beameritemnestingprefix item}}
{\setlength\itemsep{2em}% NEW
\def\makelabel##1{%
{%
\hss\llap{{%
\usebeamerfont*{itemize \beameritemnestingprefix item}%
\usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
}%
}%
}
\fi%
\beamer@cramped%
\raggedright%
\beamer@firstlineitemizeunskip%
}
\makeatother
\begin{document}
\begin{frame}
\begin{itemize}[<+->]
\item First.
\item Second.
\item Third.
\end{itemize}
\end{frame}
\end{document}
Here's a portion of the resulting third slide:
Adding \tracingall
shows that TeX is spinning around a cyclic definition of \\description
which is an internal saved version of the description environment.
It's quite easy for this to happen if two packages are saving the"original" version of something.
\\description [#1]->\beamer@origdescription
#1<-
\beamer@origdescription ->\@protected@testopt \description \\description {}
\@protected@testopt #1->\ifx \protect \@typeset@protect \expandafter \@testopt
\else \@x@protect #1\fi
\@testopt #1#2->\kernel@ifnextchar [{#1}{#1[{#2}]}
#1<-\\description
#2<-
\kernel@ifnextchar #1#2#3->\let \reserved@d =#1\def \reserved@a {#2}\def \reser
\@ifnch ->\ifx \@let@token \@sptoken \let \reserved@c \@xifnch \else \ifx \@let
\reserved@c ->\\description [{}]
\\description [#1]->\beamer@origdescription
#1<-
While it's easy to see why TeX hangs, fixing it depends what you want to do. You could re-assert the beamer or enumitem version. But if you want an environment with the features of both that may take a bit more coordination and knowledge of both packages neither of which I have this morning:-)
for example this keeps beamers defininition and stops the looping.
\let\olddescription\description
\let\oldenddescription\enddescription
\usepackage{enumitem}
\let\description\olddescription
\let\enddescription\oldenddescription