5

I would like to add enumerated lists to a Beamer presentation. Here is a minimal example:

\documentclass{beamer}

\setbeamertemplate{enumerate subitem}{\Alph{enumii}}
\setbeamerfont{itemize/enumerate subbody}{size=\normalsize}

\begin{document}

\begin{frame}

\begin{enumerate}
\item First level item
\begin{enumerate}
\item Second level item 1
\item Second level item 2
\item Second level item 3
\item Second level item 4
\item Second level item 5
\item Second level item 6
\item Second level item 7
\item Second level item 8
\item Second level item 9
\item Second level item 10
\item Second level item 11
\end{enumerate}
\end{enumerate}

\end{frame}
\end{document}

If you look at the pdf output you can see that the alignment of the alphabetical labels A, B, C etc. looks ugly. Especially the D below C, and I and J between H and K. Here is an image of the output:

beamer-enumerate-list-example

I would like the to center the labels horizontally (within \labelwidth). That is, the horizontal centers of the letters would be placed on a vertical line. How can I do it in Beamer?

I would like to avoid enumitem package as it does not work well with Beamer. Previously I had errors with enumitem in Beamer similar to those reported here:

Dealing with long description environment items

! TeX capacity exceeded, sorry [grouping levels=255]. errors

1

You could define \makelabelcenter as follows (the standard beamer version of \makelabel within an enumerate but with \clap instead of \llap and with an extra \hss after the label), and then \let \makelabel to \makelabelcenter at the start of the desired enumeration. Applying this automatically to every second level list/enumeration is harder.

\documentclass{beamer}

\setbeamertemplate{enumerate subitem}{\Alph{enumii}}
\setbeamerfont{itemize/enumerate subbody}{size=\normalsize}

\providecommand\clap[1]{\hbox to0pt{\hss#1\hss}}
\def\makelabelcenter#1{{\hss\clap{{%
        \usebeamerfont*{enumerate \beameritemnestingprefix item}%
        \usebeamercolor[fg]{enumerate \beameritemnestingprefix item}#1}}\hss}}%


\begin{document}

\begin{frame}[fragile]

\begin{enumerate}
\item First level item 1
\begin{enumerate}
\let\makelabel\makelabelcenter
\item Second level item 1
\item Second level item 2
\item Second level item 3
\item Second level item 4
\item Second level item 5
\item Second level item 6
\item Second level item 7
\item Second level item 8
\item Second level item 9
\item Second level item 10
\item Second level item 11
\item[Test] Larger label
\end{enumerate}
\end{enumerate}

\end{frame}
\end{document}

Illustration of output

0

Poor man's solution - put every item label in a centered box:

\documentclass{beamer}

\setbeamertemplate{enumerate subitem}{\Alph{enumii}}
\setbeamerfont{itemize/enumerate subbody}{size=\normalsize}

\begin{document}

\begin{frame}

\begin{enumerate}
\item First level item
\begin{enumerate}
\item[{\makebox[0.3cm][c]{A}}] Second level item 1 
\item[{\makebox[0.3cm][c]{B}}] Second level item 2
\item[{\makebox[0.3cm][c]{C}}] Second level item 3
\item[{\makebox[0.3cm][c]{D}}] Second level item 4
\item[{\makebox[0.3cm][c]{E}}] Second level item 5
\item[{\makebox[0.3cm][c]{F}}] Second level item 6
\item[{\makebox[0.3cm][c]{G}}] Second level item 7
\item[{\makebox[0.3cm][c]{H}}] Second level item 8
\item[{\makebox[0.3cm][c]{I}}] Second level item 9
\item[{\makebox[0.3cm][c]{J}}] Second level item 10
\item[{\makebox[0.3cm][c]{K}}] Second level item 11
\end{enumerate}
\end{enumerate}

\end{frame}
\end{document}

enter image description here

0

To avoid this problem, try to use a monospace font (typewriter font):

(1) Use the \setbeamerfont before \begin{document}:

\setbeamerfont{enumerate subitem}{family=\ttfamily}  % Typewriter Family

Enumerate 01


(2) If you need to change the default typewriter font, use this:

\usepackage[scaled]{beramono} % Bera Mono type
\usepackage[T1]{fontenc}
\setbeamerfont{enumerate subitem}{family=\ttfamily}

The Typewriter Fonts Catalogue: http://www.tug.dk/FontCatalogue/typewriterfonts.html

Enumerate 02

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.