2

This question is related to this post: Beamer: Increase square enumerate size when using 14pt font

The code works perfectly in the enumeration environment but I still get the square not vertically aligned/centered in the table of contents even if I put the new code before the frame containing the \tableofcontents expression. Thanks.

\documentclass[10pt]{beamer}

\useinnertheme{rectangles}
\title{Your Presentation}

\begin{document}

\begin{frame}
\tableofcontents
\end{frame}

\section{Section 1 - Enumeration Squares Lower than Text}
\begin{frame}
   \begin{itemize}
     \item Your introduction goes here!
   \end{itemize}
    \begin{enumerate}
   \item Enum
   \item Enum
   \item Enum
 \end{enumerate}
 \end{frame}

\setbeamertemplate{enumerate item}{%
  \usebeamercolor[bg]{item projected}%
  \raisebox{1.5pt}{\colorbox{bg}{\color{fg}\footnotesize\insertenumlabel}}%
}

\section{Frame 2 - Enumeration Squares Vertically Centered}

\begin{frame}
\begin{itemize}
  \item Your introduction goes here!
\end{itemize}
\begin{enumerate}
  \item Enum
  \item Enum
  \item Enum
\end{enumerate}
\end{frame}

\end{document} 

enter image description here

1
  • the toc use other templates, e.g. section in toc, you can find the original definition in beamerbaseauxtemplates.sty, search for \defbeamertemplate{section in toc}{square} Apr 7, 2017 at 21:27

1 Answer 1

2

You have to insert a beamer template for the toc, just like you did for the enumerate item. You should specify section in toc as its first argument; I reused your code, basically, adapting it to this case:

\begin{frame}
\setbeamertemplate{section in toc}{\usebeamercolor[bg]{item projected}%
  \raisebox{1pt}{\colorbox{bg}{\color{fg}\footnotesize\inserttocsectionnumber}} \inserttocsection}
\tableofcontents
\end{frame}

This Yields:

enter image description here

The full code is:

\documentclass[10pt]{beamer}
\usepackage{lmodern}
\useinnertheme{rectangles}
\title{Your Presentation}

\begin{document}

\begin{frame}
\setbeamertemplate{section in toc}{\usebeamercolor[bg]{item projected}%
  \raisebox{1pt}{\colorbox{bg}{\color{fg}\footnotesize\inserttocsectionnumber}} \inserttocsection}
\tableofcontents
\end{frame}

\section{Section 1 - Enumeration Squares Lower than Text}
\begin{frame}
   \begin{itemize}
     \item Your introduction goes here!
   \end{itemize}
    \begin{enumerate}
   \item Enum
   \item Enum
   \item Enum
 \end{enumerate}
 \end{frame}

\setbeamertemplate{enumerate item}{%
  \usebeamercolor[bg]{item projected}%
  \raisebox{1.5pt}{\colorbox{bg}{\color{fg}\footnotesize\insertenumlabel}}%
}


\section{Frame 2 - Enumeration Squares Vertically Centered}

\begin{frame}
\begin{itemize}
  \item Your introduction goes here!
\end{itemize}
\begin{enumerate}
  \item Enum
  \item Enum
  \item Enum
\end{enumerate}
\end{frame}

\end{document} 

You can tweak the vertical position of the numbering changing the \raisebox value.

2
  • is there a way to add spacing between the squares and the text? I have tried several approaches and including the \usepackage{tocloft} as mentioned in different posts but it doesn't work. Thanks in advance.
    – Alan
    Apr 8, 2017 at 17:49
  • @Alan yes, you should insert a spacing command like \hspace{5pt} or whatever, before the \inserttocsection command
    – Moriambar
    Apr 8, 2017 at 17:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .