LaTeX Beamer: Define \itemsep globally

In LaTeX Beamer, I'm trying to set \itemsep globally.

I've already tried the following, but it doesn't work:

\documentclass[14pt]{beamer}

\setbeamertemplate{itemize/enumerate body begin}{\setlength{\itemsep}{5ex}}

\begin{document}

\begin{frame}
\begin{itemize}
%       \setlength{\itemsep}{5ex}  % this would work locally..
\item Test1
\item Test2
\item Test3
\end{itemize}

\end{frame}

\end{document}


What am I doing wrong?

Edit:

I would prefer a solution that allows to define different spacing for body, subbody, subsubbody, etc., if possible.

Yout code won't work because the itemize/enumerate \beameritemnestingprefix body begin template is used before the \list internally used by itemize.

You can patch \itemize (original definition in beamerbaselocalstructure.sty):

\documentclass[14pt]{beamer}
\usepackage{xpatch}

\xpatchcmd{\itemize}
{\def\makelabel}
{\setlength{\itemsep}{5ex}\def\makelabel}
{}
{}

\begin{document}

\begin{frame}
\begin{itemize}
\item Test1
\item Test2
\item Test3
\end{itemize}
\end{frame}

\end{document}


Since \itemize as defined by beamer has an optional argument, using etoolbox's \patchcmd might produce undesired results. The \xpatchcmd from the xpatch package was designed to deal with these cases.

Update

In comments, it has been requested to be able to independently control the separation for the three allowed nesting levels; this can also be easily done using a conditional on \@itemdepth:

\documentclass{beamer}
\usepackage{xpatch}

\xpatchcmd{\itemize}
{\def\makelabel}
{\ifnum\@itemdepth=1\relax
\setlength\itemsep{3ex}% separation for first level
\else
\ifnum\@itemdepth=2\relax
\setlength\itemsep{2ex}% separation for second level
\else
\ifnum\@itemdepth=3\relax
\setlength\itemsep{0.5ex}% separation for third level
\fi\fi\fi\def\makelabel
}
{}
{}

\begin{document}

\begin{frame}
\begin{itemize}
\item First item.
\begin{itemize}
\item First subitem.
\item Second subitem.
\begin{itemize}
\item First subsubitem.
\item Second subsubitem.
\item Third subsubitem.
\end{itemize}
\item Third subitem.
\end{itemize}
\item Second item.
\item Third item.
\end{itemize}
\end{frame}

\end{document}


• Your one appeared while I was trying mine. Care to tell why \AtBeginEnvironment{itemize}{\setlength\itemsep{2.0em}} does not work? – Masroor Jan 30 '15 at 17:20
• @Masroor Your try with \AtBeginEnvironment (from etoolbox) executes the code immediately before \itemize so it won't have effect. – Gonzalo Medina Jan 30 '15 at 17:24
• So, etoolbox can not be used in this case? – Masroor Jan 30 '15 at 17:29
• @Masroor since \itemize is defined in beamer with an optional argument, using etoolbox's \patchcmd might produce undesired results. \xpatchcmd was written to deal with those cases correctly. – Gonzalo Medina Jan 30 '15 at 17:33
• Thanks. Was curious. I seem to have got my answer. Already upvoted your answer. – Masroor Jan 30 '15 at 17:34