7

So, i "need" to use the enumitem package in order to increase the allowed depth for itemize/enumerate. To use the ball like label in those listing environments, I've tried the following code :

\documentclass[11pt]{beamer}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[francais]{babel}

\usepackage{enumitem}
\usepackage{tikz}

\makeatletter

% create beamer ball commands
\newcommand\beamerball{%
    \parbox[t]{10pt}{\raisebox{0.2pt}{\beamer@usesphere{item}{bigsphere}}}}

\newcommand\tikzball[1]{%
    \tikz[baseline=(char.base)]{%
        \node[circle,ball color=purple, shade, color=white,inner sep=1.2pt] (char) {\tiny #1};
    }
}

% create new list for increased depth
\usepackage{enumitem}
\renewlist{itemize}{itemize}{6}
\setlist[itemize]{label=\beamerball, labelsep=0pt, leftmargin=2em}
\setlist[itemize, 1]{leftmargin=1.2em}
\renewlist{enumerate}{enumerate}{6}
\setlist[enumerate]{label=\tikzball{\arabic*}, leftmargin=2em}
\setlist[enumerate, 1]{leftmargin=1.2em}

\makeatother

\begin{document}
\begin{frame}
    \tikzball{0} tikzball command test

    \begin{itemize}
        \item test 1
        \item test 2
        \begin{enumerate}
            \item test 2.1
            \item test 2.2
        \end{enumerate}
    \end{itemize}
\end{frame}
\end{document}

Itemize works fine, the ball command (tikzball) for enumerate too. But when I add label=\tikzball{\arabic*} in the enumerate settings, I get an Undefined control sequence error. Here is the linked log extract :

! Undefined control sequence.
<recently read> \tikz@origsemi 

l.45 \end{frame}

? 
! Emergency stop.
<recently read> \tikz@origsemi 

l.45 \end{frame}

End of file on the terminal!
3
  • beamer and enumitem are incompatible
    – user31729
    Apr 16, 2016 at 19:03
  • From what I've read, they are incompatible only in the sense that some functionality of beamer are not available with new/redefined lists (e.g. <+->).
    – A. Jacquet
    Apr 16, 2016 at 19:43
  • That's true. I've got an idea.
    – user31729
    Apr 16, 2016 at 20:30

1 Answer 1

5

The \tikzball command must be protected, i.e. use label={\protect\tikzball{...}}.

\documentclass[11pt]{beamer}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[francais]{babel}

\usepackage{enumitem}
\usepackage{tikz}

\makeatletter

% create beamer ball commands
\newcommand\beamerball{%
  \parbox[t]{10pt}{\raisebox{0.2pt}{\beamer@usesphere{item}{bigsphere}}}}

\newcommand\tikzball[1]{%
    \tikz[baseline=(char.base)]{%
      \node[circle,ball color=purple, shade, color=white,inner sep=1.2pt] (char) {\tiny #1};
    }
}

% create new list for increased depth
\usepackage{enumitem}

\renewlist{itemize}{itemize}{6}
\setlist[itemize]{label=\beamerball, labelsep=0pt, leftmargin=2em}
\setlist[itemize, 1]{leftmargin=1.2em}
\renewlist{enumerate}{enumerate}{6}
\setlist[enumerate]{label={\protect\tikzball{\arabic*}}, leftmargin=2em}
\setlist[enumerate, 1]{leftmargin=1.2em}

\makeatother

\begin{document}
\begin{frame}
  \tikzball{0} tikzball command test

    \begin{itemize}
        \item test 1
        \item test 2
        \begin{enumerate}
            \item test 2.1
            \item test 2.2
        \end{enumerate}
    \end{itemize}
\end{frame}
\end{document}

enter image description here

1
  • 1
    Works like a charm, thank you for your help.
    – A. Jacquet
    Apr 17, 2016 at 5:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.