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.

I have an enumerate environment with square icons, which gives me a colored square with a number inside for each item.

Below this, I have things I would like to visually correspond with these items. So I am looking to just make this same square with a number inside. Any ideas?

Edit: Here is a minimal working example:

\documentclass[mathserif,xcolor=svgnames]{beamer}
\setbeamertemplate{enumerate items}[square]
\begin{document}

\begin{frame}{Example}
 \begin{enumerate}
  \item Hello there
 \end{enumerate}
\end{frame}

\end{document}
share|improve this question
add comment

2 Answers 2

up vote 11 down vote accepted

The code for creating the boxes can be found in beamerbaseauxtemplates.sty. You can wrap it in a new command so you can use it outside enumerations:

\documentclass[mathserif,xcolor=svgnames]{beamer}
\setbeamertemplate{enumerate items}[square]
\begin{document}

\newcommand\boxednumber[1]
{%
  \hbox{%
    \usebeamerfont*{item projected}%
    \usebeamercolor[bg]{item projected}%
    \vrule width2.25ex height1.85ex depth.4ex%
    \hskip-2.25ex%
    \hbox to2.25ex{%
      \hfil%
      \color{fg}#1%
      \hfil}%
  }%
}

\begin{frame}{Example}
 \begin{enumerate}
  \item Hello there
 \end{enumerate}

Let's talk about item \boxednumber{1}
\end{frame}

\end{document}
share|improve this answer
add comment

Here's another way to do this but using \label and \ref instead. I created a \squareref command which will enclose its reference in a square box. I did this originally for the ball type references, so I've included that code in the example as well. The basic code is taken from the same beamer source as in Jake's answer.

\documentclass{beamer}

\newcommand*{\squareref}[1]{
  \hbox{%
    \usebeamerfont*{item projected}%
    \usebeamercolor[bg]{item projected}%
    \vrule width2.25ex height1.85ex depth.4ex%
    \hskip-2.25ex%
    \hbox to2.25ex{%
      \hfil%
      \color{fg}\ref{#1}%
      \hfil}%
  }%
}

\newcommand*{\ballref}[1]{%
    \begin{pgfpicture}{-1ex}{-0.65ex}{1ex}{1ex}
    \usebeamercolor[fg]{item projected}
    {\pgftransformscale{1.75}\pgftext{\normalsize\pgfuseshading{bigsphere}}}
    {\pgftransformshift{\pgfpoint{0pt}{0.5pt}}
      \pgftext{\usebeamerfont*{item projected}\ref{#1}}}
  \end{pgfpicture}}%


\begin{document}
\setbeamertemplate{enumerate items}[square]

\begin{frame}

\begin{enumerate}
\item\label{item1} Go to \squareref{item2}
\item\label{item2} Go to \squareref{item1}
\end{enumerate}
\setbeamertemplate{enumerate items}[ball]

\begin{enumerate}
\item\label{item3} Go to \ballref{item4}
\item\label{item4} Go to \ballref{item3}

\end{enumerate}

\end{frame}

\end{document} 

output of code

share|improve this answer
    
This solution did not worked for my long presentation until I changed the labels from "item1" "item2" to "one" and "two". With "itemX" I've got the bullets but with wrong numbers as follows 1 go to 2 and 2 go to 2 –  Ottorino Apr 11 '13 at 20:43
    
@Ottorino I'm not sure what you were doing exactly, but the code works as posted. Perhaps you had duplicate labels (which I did in the code you tried.) I've removed the duplicates now, in case that was the cause of the problem. There's no problem for the labels to have numbers in them. –  Alan Munn Apr 12 '13 at 2:59
add comment

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.