Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In the following code, at the place of *step 2*, I would like to display exactly enter image description here. Does anyone know how to do it?

\begin{block}{title}
\begin{enumerate}
  \item ... %Step 1
  \item ... %Step 2
  \item ... Go back to *Step 2*
\end{enumerate}
\end{block}
share|improve this question
    
Do you create your enumerated items in beamer? And you just want to duplicate the numbered item in the "reference"? –  Werner Aug 20 '12 at 23:23
    
It is in beamer, and the \enumerate is actually inside a block environment, that is why it is in blue... –  SoftTimur Aug 20 '12 at 23:25

1 Answer 1

up vote 7 down vote accepted

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 by beamer:

\documentclass{beamer}
\usetheme{Warsaw}
\usepackage{tikz}

\newcommand\ballref[1]{%
\tikz \node[circle, shade,ball color=structure.fg,inner sep=0pt,%
  text width=8pt,font=\tiny,align=center] {\color{white}\ref{#1}};
}

\begin{document}

\begin{frame}
\begin{enumerate}
  \item ... %Step 1
  \item\label{ite:second} ... %Step 2
  \item ... Go back to Step~\ballref{ite:second}
\end{enumerate}
\end{frame}

\end{document}

enter image description here

Since the french option for babel makes ; an active charcater, extra precuations will have to be taken:

\documentclass{beamer}
\usetheme{Warsaw}
\usepackage[french]{babel}
\usepackage{tikz}

\newcommand\ballref[1]{%
\shorthandoff{;}\tikz \node[circle, shade,ball color=structure.fg,inner sep=0pt,%
  text width=8pt,font=\tiny,align=center] {\color{white}\ref{#1}};
\shorthandon{;}
}

\begin{document}

\begin{frame}
\begin{block}{title}
\begin{enumerate}
  \item ... %Step 1
  \item\label{ite:second} ... %Step 2
  \item ... Go back to Step~\ballref{ite:second}
\end{enumerate}
\end{block}
\end{frame}

\end{document}
share|improve this answer
    
I have \usepackage[frenchb]{babel} between \usetheme{Warsaw} and usepackage{tikz}, that results in an error ERROR: Paragraph ended before \tikz@next was complete. Do you have any idea? –  SoftTimur Aug 21 '12 at 0:25
1  
@SoftTimur yes; the problem is that french for babel makes ; active. I've provided a solution in my updated answer. –  Gonzalo Medina Aug 21 '12 at 0:36
    
Great... One last thing is that the ballref is always in gray, instead of blue here, do you know why? –  SoftTimur Aug 21 '12 at 0:43
    
@SoftTimur no, with so little information you provided. I need to see the settings of your document. Please add to your question a small complete document illustrating the problem mentioned. –  Gonzalo Medina Aug 21 '12 at 0:45
1  
@SoftTimur in that case, use structure.fg for the color. I updated my answer with this modification. –  Gonzalo Medina Aug 21 '12 at 0:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.