10

In Beamer, I would like to be able to use ball items (with a number inside) in an enumerate list whose layout is defined by the package enumitem.

This question is closely related to Make enumerate have beamer themes when using enumitem. Actually a hint is given but does not work.

Hereafter, my MWE. If you remove \protect\usebeamertemplate{enumerate item}, the MWE works.

\documentclass[12pt]{beamer}
\usepackage{enumitem}
\setbeamertemplate{enumerate item}[ball]
\setenumerate[1]{%
  label=\protect\usebeamerfont{enumerate item}
        \protect\usebeamercolor[fg]{enumerate item}
        \protect\usebeamertemplate{enumerate item}
        \insertenumlabel.}
\begin{document}
\begin{frame}
  \begin{enumerate}
    \item First item
    \item Second item
  \end{enumerate}
\end{frame}
\end{document}

Would you have any suggestions to include properly the item template? Thanks.

1

1 Answer 1

12

I would suggest not to use enumitem with beamer, since this combination could produce more damages than benefits. Take for example the code given in the answer you linked to in your question:

\documentclass[12pt]{beamer}
\usetheme{Singapore}
\usepackage{enumitem}
\setenumerate[1]{%
  label=\protect\usebeamerfont{enumerate item}%
        \protect\usebeamercolor[fg]{enumerate item}%
        \insertenumlabel.}
\begin{document}
\begin{frame}
  \begin{enumerate}
    \item First item
    \item Second item
  \end{enumerate}
\end{frame}
\end{document}

This code works and apparently everything it's OK, but something this code "hides" is that now enumerate is not overlay-aware and this is a serious drawback; adding the typical overlay specification

\documentclass[12pt]{beamer}
\usetheme{Singapore}
\usepackage{enumitem}
\setenumerate[1]{%
  label=\protect\usebeamerfont{enumerate item}%
        \protect\usebeamercolor[fg]{enumerate item}%
        \insertenumlabel.}
\begin{document}
\begin{frame}
  \begin{enumerate}[<+->]
    \item First item
    \item Second item
  \end{enumerate}
\end{frame}
\end{document}

you get the error message

! Package enumitem Error: <+-> undefined.

See the enumitem package documentation for explanation. Type  H <return>  for immediate help.  ...                                    

l.14 \end{frame}

If you want to customize the list-like environments, you can do it by redefining the corresponding elements as they are defined in beamer. For example, the definitions for the enumerate item template for each one of the predefined options (default, ball, circle, square) can be found in the file beamerbaseauxtemplates.sty. You can then change this definitions according to your needs; a little example, increasing the size of the circle and adding a final dot after the label of the enumeration:

\documentclass[12pt]{beamer}

\makeatletter
\setbeamertemplate{enumerate item}
{
  \begin{pgfpicture}{-1ex}{-0.65ex}{1ex}{1ex}
    \usebeamercolor[fg]{item projected}
    {\pgftransformscale{2}\pgftext{\normalsize\pgfuseshading{bigsphere}}}
    {\pgftransformshift{\pgfpoint{0pt}{0.5pt}}
      \pgftext{\usebeamerfont*{item projected}\insertenumlabel.}}
  \end{pgfpicture}%
}
\makeatother

\begin{document}

\begin{frame}
\begin{enumerate}
  \item First item
  \item Second item
\end{enumerate}
\end{frame}

\end{document}

enter image description here

3
  • Thanks Gonzalo. I modified my file beamerbaseauxtemplates.sty as you mentioned and the results are as expected.
    – RolPasto
    Jun 21, 2012 at 7:48
  • 1
    @RolPasto it's not a good idea to modify LaTeX files directly; you can save a copy and edit the copy or do the changes in your document. Jun 21, 2012 at 12:23
  • bigshpere goes away when used with `\begin{enumerate}[i]'
    – Khaaba
    Mar 31, 2018 at 6:12

You must log in to answer this question.

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