beamer, enumitem - 枚举球标签

beamer, enumitem - 枚举球标签

因此,我“需要”使用该enumitem包来增加 itemize/enumerate 的允许深度。为了在这些列表环境中使用球形标签,我尝试了以下代码:

\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 运行良好,用于枚举的球命令 ( tikzball) 也运行良好。但是当我添加label=\tikzball{\arabic*}枚举设置时,出现Undefined control sequence错误。以下是链接的日志摘录:

! 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!

答案1

\tikzball命令必须受到保护,即使用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}

在此处输入图片描述

相关内容