3

I would like to format a text so that it looks like an enumerate item.

In the example below, you can see that I would like a list that consists of the items 1,2,n. I would like the "n" to be typeset like the 1 and the 2, i.e. with a blue background.

\documentclass{beamer}


\usetheme{Madrid}
\useinnertheme{rectangles}
\setbeamertemplate{blocks}[default]


\begin{document}
    \begin{frame}
        \begin{enumerate}
            \item Item one
            \item Item two
            \item[n] Item n
        \end{enumerate}
    \end{frame}
\end{document}

Thanks!

  • Welcome to TeX.Stackexchange! – user36296 Jan 31 at 17:26
4
\documentclass{beamer}


\usetheme{Madrid}
\useinnertheme{rectangles}
\setbeamertemplate{blocks}[default]

\newcommand{\mysquare}[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{document}
    \begin{frame}
        \begin{enumerate}
            \item Item one
            \item Item two
            \item[\mysquare{n}] Item n
        \end{enumerate}
    \end{frame}
\end{document}

enter image description here

  • A little followup: How did you figure that out? Did you look into the beamer sourcecode, or is there another way to find out the formatting of a special piece of text? – Jan Feb 1 at 16:22
  • @Jan Source code. The original template for the enumeration with squares can be found in github.com/josephwright/beamer/blob/master/base/… – user36296 Feb 1 at 16:25
  • OK, so there is no easy way... Guess I'll have to come back here the next time I have a similar question ;-) – Jan Feb 5 at 16:24

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.