用枚举的 Tcolorbox 徽标替换默认项目编号

用枚举的 Tcolorbox 徽标替换默认项目编号

考虑 MWE

\documentclass{article}
\usepackage{tcolorbox}
\usepackage{scalefnt}
\usepackage{xcolor}
\usepackage{lipsum}

\newtcbox{\logo}{nobeforeafter, notitle, %sharpcorners,
    colframe=blue,
    colback=blue!30,
    fontupper=\sffamily\bfseries,
    tcbox raise base}

\begin{document}

\Large
\begin{enumerate}
\item I would like to have LateX automatically replace the default item number by $\logo{1}$
\\[10pt]
\item I would like to have LateX automatically replace the default item number by $\logo{2}$
\\[10pt]
\item I would like to have LateX automatically replace the default item number by $\logo{3}$
\\[10pt]
\item And so on \ldots\
\end{enumerate}
\end{document}

产生输出

在此处输入图片描述

问题:我想用如图tcolorbox所示的枚举徽标替换默认枚举项目编号 1.、2.、3.、...。我该如何实现?

谢谢。

答案1

随附enumitem包装和\begin{enumerate}[label=\logo{\arabic*}]

在此处输入图片描述

\documentclass{article}

\usepackage{enumitem}

\usepackage{tcolorbox}
\usepackage{scalefnt}
\usepackage{xcolor}
\usepackage{lipsum}

\newtcbox{\logo}{nobeforeafter, notitle, %sharpcorners,
    colframe=blue,
    colback=blue!30,
    fontupper=\sffamily\bfseries,
    tcbox raise base}


\begin{document}
\Large
\begin{enumerate}[label=\logo{\arabic*}]
\item I would like to have LateX automatically replace the default item number by $\logo{1}$
\\[10pt]
\item I would like to have LateX automatically replace the default item number by $\logo{2}$
\\[10pt]
\item I would like to have LateX automatically replace the default item number by $\logo{3}$
\\[10pt]
\item And so on \ldots\
\end{enumerate}

\end{document}

相关内容