Beamer 中一种奇特而优美的枚举类型

Beamer 中一种奇特而优美的枚举类型

我正在尝试重现这篇文章的枚举环境(一种奇特而美丽的枚举类型) 在比默。我的 MWE 改编自那里,如下所示:

\documentclass{beamer}

\usepackage{tikz}
\newcommand{\Colorlist}{red,blue,green,yellow}
\newcommand{\SebastianoItem}[1]{\foreach \X[count=\Y] in \Colorlist
{\ifnum\Y=#1\relax
\xdef\SebastianoColor{\X}
\fi
}
\tikz[baseline=(SebastianoItem.base),remember
picture]{%
\node[fill=\SebastianoColor,inner sep=4pt,font=\sffamily,fill opacity=0.5] (SebastianoItem){#1)};}
}
\newcommand{\SebastianoHighlight}{\tikz[overlay,remember picture]{%
\fill[\SebastianoColor,fill opacity=0.5] ([yshift=4pt,xshift=-\pgflinewidth]SebastianoItem.east) -- ++(4pt,-4pt)
-- ++(-4pt,-4pt) -- cycle;
}}

\begin{document}
\begin{frame}
\renewcommand{\labelenumi}{\SebastianoItem{\arabic{enumi}}}

Some general advices.
  \begin{enumerate}
    \item No fast food.
    \item Don't drink to much alcohol.
    \item No pineapple on pizza. \SebastianoHighlight
    \item Don't use onions in food.
  \end{enumerate}

\end{frame}
\end{document}

当我取消注释 \renewcommand 和 \SebastianoHighlight 行时,代码可以编译,所以我猜想错误就在那里。我知道在 Beamer 中更新命令比在 Article 文档类中更棘手。但是,我找不到解决方案。有什么想法吗?

答案1

在投影机中:

\setbeamertemplate{enumerate item}{\SebastianoItem{\arabic{enumi}}}

同样地枚举子项枚举子子项,并枚举小模板。

编辑文件:

\documentclass{beamer}

\usepackage{tikz}
\newcommand{\Colorlist}{red,blue,green,yellow}
\newcommand{\SebastianoItem}[1]{\foreach \X[count=\Y] in \Colorlist
{\ifnum\Y=#1\relax
\xdef\SebastianoColor{\X}
\fi
}
\tikz[baseline=(SebastianoItem.base),remember
picture]{%
\node[fill=\SebastianoColor,inner sep=4pt,font=\sffamily,fill opacity=0.5] (SebastianoItem){#1)};}
}
\newcommand{\SebastianoHighlight}{\tikz[overlay,remember picture]{%
\fill[\SebastianoColor,fill opacity=0.5] ([yshift=4pt,xshift=-\pgflinewidth]SebastianoItem.east) -- ++(4pt,-4pt)
-- ++(-4pt,-4pt) -- cycle;
}}

\setbeamertemplate{enumerate item}{\SebastianoItem{\arabic{enumi}}}


\begin{document}
\begin{frame}
%\renewcommand{\labelenumi}{\SebastianoItem{\arabic{enumi}}}

Some general advices.
  \begin{enumerate}
    \item No fast food.
    \item Don't drink to much alcohol.
    \item No pineapple on pizza. \SebastianoHighlight
    \item Don't use onions in food.
  \end{enumerate}

\end{frame}
\end{document}

输出: 在此处输入图片描述

相关内容