11

I have an enumerate list in this MWE.

\documentclass[]{beamer}
\usetheme{Madrid}
\setbeamertemplate{items}[circle]

\begin{document}

\begin{frame}
\frametitle{Example}
\begin{enumerate}
\item First one
\item Second one
\item Third one
\end{enumerate}
In the above list, 2 and 3 are what more important.
\end{frame}

\end{document}

I want "2" and "3" in the text to be the same as in the list, a blue solid circle with white numbers.

How do I do that? Thank you.

enter image description here

6

If the appearance is the only thing matters, then the following will do:

Code

\documentclass[]{beamer}
\usetheme{Madrid}
\setbeamertemplate{items}[circle]
\usepackage{tikz}

\newcommand\mynum[1]{%
  \usebeamercolor{enumerate item}%
  \tikzset{beameritem/.style={circle,inner sep=0,minimum size=2ex,text=enumerate item.bg,fill=enumerate item.fg,font=\footnotesize}}%
  \tikz[baseline=(n.base)]\node(n)[beameritem]{#1};%
}

\begin{document}

\begin{frame}
\frametitle{Example}
\begin{enumerate}
\item First one
\item Second one
\item Third one
\end{enumerate}
In the above list, \mynum{2} and \mynum{3} are what more important.
\end{frame}

\end{document}

Output

enter image description here

10

This is almost the same answer, but with safe reference to label names instead of item numbers (i.e., when the item order is changed, the references are still correct).

\documentclass[]{beamer}
\usetheme{Warsaw}
\setbeamertemplate{items}[circle]
\usepackage{tikz}

\newcommand*\itemref[1]{%
\tikz[baseline=(char.base)]{%
\node[circle, fill=enumerate item.fg, inner sep=.6pt] (char) {\scriptsize\color{white}\ref{#1}};}}

\begin{document}

(Compile twice to solve the cross references).  

\begin{frame}
\frametitle{Example}
\begin{enumerate}
\item \label{one} First one
\item \label{two} Second one
\item  Last minuted included item without importance 
\item \label{three} Third one
\end{enumerate}
In the above list, \itemref{one}, \itemref{two} and \itemref{three} are the more important.

\end{frame}
\end{document}
  • 1
    I have an error with your code: Undefined color `enumerate item.fg' – Antonin May 14 '14 at 6:53
  • @Antonin Still work fine in my computer with the vanilla TexLive 2013...may be you are using an outdated version? – Fran May 14 '14 at 9:56
5

For sake of completeness, I believe the best solution is the combination of @Markus and @Fran. References to item labels with templated markers:

\documentclass[]{beamer}
\usetheme{Warsaw}
\setbeamertemplate{items}[circle]
\usepackage{tikz}

\newcommand\itemref[1]{{\renewcommand{\insertenumlabel}{\ref{#1}}%
  \usebeamertemplate{enumerate item}}}

\begin{document}

(Compile twice to solve the cross references).  

\begin{frame}
\frametitle{Example}
\begin{enumerate}
\item \label{one} First one
\item \label{two} Second one
\item  Last minuted included item without importance 
\item \label{three} Third one
\end{enumerate}
In the above list, \itemref{one}, \itemref{two} and \itemref{three} are the more important.

\end{frame}
\end{document}

Render of latex with enumerate references

3

Beamer draws the enumerate item numbers using the template "enumerate item", which gets the item number from \insertenumlabel. So just temporarily redefine the \insertenumlabel macro to show the \ref{...} value you need and then use the same template, using \usebeamertemplate:

\newcommand\mynum[1]{{\renewcommand{\insertenumlabel}{#1}%
      \usebeamertemplate{enumerate item}}}

This should work independent of what enumerate item template your inner theme you has chosen.

1

With this code:

\newcommand*\circled[1]{\tikz[baseline=(char.base)]{\node[shape=circle,draw,inner sep=2pt,fill=blue] (char) {#1};}}

\circled{\color{white} 3}

you get this:

The picture shows "In your text, 2 and 3" where 2 and 3 are circled.

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.