3

For a tutorial presented with LaTeX Beamer slides I want to add a list of all the tasks inside it. The tasks are set as individual tcolorboxes, so I like to use the list inside key, which automatically creates the list of boxes.

Unfortunately, this doesn't seem to work with Beamer, as it wouldn't compile.

MWE

\documentclass{beamer}
\usepackage{tcolorbox}
\newtcolorbox[list inside=tsks]{plainbox}[1]{colback=blue!10, title=#1}
\begin{document}
    \section{Slides}
    \begin{frame}
        \tableofcontents
        \begin{plainbox}{One}
            First box
        \end{plainbox}
    \end{frame}
    \section{Overview}
    \begin{frame}
        \tcblistof[\section*]{tsks}{List of Tasks}
    \end{frame}
\end{document}

The problem appears to be related to what the ToC file of list inside, here .tsks, is filled with. I think it includes macros which are not available in Beamer. When comparing the file with Beamer's .toc file it looks distinctly different (and more like the .toc file of a usual LaTeX document would look like).

Eventually I'd like to have a list of tasks styled like Beamer's ToC, i.e. without any dotted lines or page numbers, but with links to the tasks.

1 Answer 1

4

You could redefine \numberline and style the list as you want:

\documentclass{beamer}
\usepackage{tcolorbox}
\newtcolorbox[list inside=tsks]{plainbox}[1]{colback=blue!10, title=#1}

\makeatletter
\renewcommand{\numberline}[2]{%
    \usebeamerfont*{section in toc}%
    \usebeamercolor[fg]{section in toc}%
    #2%
    \par\vfill%
}

\renewcommand*\l@tcolorbox{}
\makeatother

\begin{document}

\section{Slides}

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

\begin{frame}
    \begin{plainbox}{One}
        First box
    \end{plainbox}
    \begin{plainbox}{Two}
        First box
    \end{plainbox}
    \begin{plainbox}{Three}
        First box
    \end{plainbox}
\end{frame}

\section{Overview}

\begin{frame}
    \vfill
    \tcblistof[\section*]{tsks}{List of Tasks}
\end{frame}
\end{document}

enter image description here

10
  • That looks perfect! Does redefining \numberline have any side-effects? I grepped through Beamer's code base and apparently the macro is not used anywhere – so it seems to be fine!
    – AndiH
    Sep 1, 2017 at 12:36
  • @AndiH No guarantee, one never knows with such hacks :) Sep 1, 2017 at 12:39
  • Ok, I'm investigating! For my proper set of slides there's a compilation error – while it works for my test case. Could you, by chance, add links to the entries of the list of boxes?
    – AndiH
    Sep 1, 2017 at 13:17
  • @AndiH I guess links are a separate problem. Sep 1, 2017 at 13:18
  • @AndiH What does the error say? Sep 1, 2017 at 13:19

You must log in to answer this question.

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