The behaviour of the enumerate mini template was changed in this commit: https://github.com/josephwright/beamer/commit/561ebfeca410a68c57179bd8ed1fdb85c9b703d2
To revert to the previous behaviour, you could do \setbeamertemplate{enumerate mini template}{\insertenumlabel}
\documentclass{beamer}
\usetheme{Madrid}
\setbeamertemplate{enumerate mini template}{\insertenumlabel}
\begin{document}
\begin{frame}
\begin{enumerate}[H1]
\item
\item[H2]
\end{enumerate}
\end{frame}
\end{document}
First, I think it is worth noting that enumitem
is consistent here, nothing that works in your first example fails in your second one. When you write a value manually, the format is never copied from the other entries. It's only that in your first example, the only formatting done on the counter is to add a dot after the number, which you did:
\item[10.] Sentence.
Using the same idea in the second example works just as well: replacing the line of item 2* with
\item[\greenbox{2*}] Description.
yields the expected output
Now, if you want to automatically add the formatting when writing a value manually, I think the easiest way is to modify slightly the behavior of \item
to wrap the optional argument in \greenbox{...}
when it is given. The following example outputs the list of the previous image.
\documentclass[openany]{book}
\usepackage{tcolorbox}
\newtcbox{\greenbox}[1][]{nobeforeafter,
notitle,
colframe=green!20!black,
colback=green!50!black,
top=4pt,
left=5pt,
right=5pt,
bottom=2pt,
fontupper=\sffamily\bfseries,
colupper=white,
tcbox raise base,
#1}
\usepackage{enumitem}
\let\olditem\item
\newcommand*{\greenboxitems}{%
\renewcommand*{\item}[1][]{%
\ifblank{##1}{\olditem}{\olditem[\greenbox{##1}]}%
}%
}
\setlist{
label*={\greenbox{\arabic*}},
before=\greenboxitems,
after=\let\item\olditem,
}
\begin{document}
\thispagestyle{empty}
\Large
\begin{enumerate}
\item Sentence.
\item[2*] Description.
\item Sentence.
\end{enumerate}
\end{document}
Best Answer
The idea is to use the
\label
,\ref
mechanism, but defining a command to enclose the string produced by\ref
inside a shaded ball like those used bybeamer
:Since the
french
option forbabel
makes;
an active charcater, extra precuations will have to be taken: