5

I need to change the TCO entries in my beamer presentation to comply with my companies CI.

I need the Section number inside a color box and without the dot.

it should look like this: desired output with section numbers in colorboxes

I tried to adopt the solution from here: Numbering subsubsections in beamer
by adding:

\defbeamertemplate{section in toc}{sections numbered}{
 \leavevmode\leftskip=3em%
 \rlap{\hskip-3em\inserttocsectionnumber.\inserttocsubsectionnumber.\inserttocsubsubsectionnumber}%
 \inserttocsubsubsection\par
}

\setbeamertemplate{section in toc}[sections numbered]

but I get a compile error:

Package: beamerouterthemedefault 2012/10/02 (rcs-revision 5ed0f4010e8a)
)))
! LaTeX Error: Command \beamer@@tmpop@section in toc@sections numbered already

This is my MWE to play with:

\documentclass[aspectratio=169,hyperref={unicode},t]{beamer}
\usepackage{color}

\defbeamertemplate{section in toc}{sections numbered}{
 \leavevmode\leftskip=3em%
 \rlap{\hskip-3em\inserttocsectionnumber.\inserttocsubsectionnumber.\inserttocsubsubsectionnumber}%
 \inserttocsubsubsection\par
}

\setbeamertemplate{section in toc}[sections numbered]
\begin{document}

\begin{frame}{How to layout TOC entries?}
\huge
\setlength{\lineskip}{0pt}
    \tableofcontents[hideallsubsections]
\end{frame}

\section{Test}
    some content
\subsection{Test Test}
    some content
\section{Test}
\subsection{Test Test}
\section{Test}
\subsection{Test Test}
    some content
\section{Test}
\subsection{Test Test}
    some content
\end{document}

and this is my current output: no color box too much space between lines

1 Answer 1

12

enter image description here

\documentclass[aspectratio=169,hyperref={unicode},t]{beamer}

\setbeamertemplate{section in toc}[square]

\setbeamerfont{section number projected}{size=\large}
\setbeamercolor{section number projected}{bg=red,fg=green}

\begin{document}

\begin{frame}{How to layout TOC entries?}
\large
\tableofcontents[hideallsubsections]
\end{frame}

\section{Test}
    some content
\subsection{Test Test}
    some content
\section{Test}
\subsection{Test Test}
\section{Test}
\subsection{Test Test}
    some content
\section{Test}
\subsection{Test Test}
    some content
\end{document}

enter image description here


Or if you need further customisation, you can modify

\setbeamertemplate{section in toc}{%
    \leavevmode\leftskip=1.75ex%
  \llap{%
    \usebeamerfont*{section number projected}%
    \usebeamercolor[bg]{section number projected}%
    \vrule width2.25ex height1.85ex depth.4ex%
    \hskip-2.25ex%
    \hbox to2.25ex{\hfil\color{fg}\inserttocsectionnumber\hfil}}%
  \kern1.25ex\inserttocsection\par}
3
  • wow, didn'd thought it could be that easy... :o) but I Als need the font for the toc entries to be bigger (including the numbers) when I add \large bevore \tableofcontents the numbers are not scaled up. And I need lineskip 1.5. Commented Dec 10, 2016 at 16:16
  • can we also make the box aroun the numbers a little bigger? Commented Dec 10, 2016 at 16:17
  • @TimothyTruckle see my edit. From there you can modify everything. Commented Dec 10, 2016 at 16:54

You must log in to answer this question.

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