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

  • 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} – Ulrike Fischer Apr 7 '17 at 21:27
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.

  • 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 '17 at 17:49
  • @Alan yes, you should insert a spacing command like \hspace{5pt} or whatever, before the \inserttocsection command – Moriambar Apr 8 '17 at 17:53

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.