7

I am trying to adapt the Beamer table of content to my needs. I use the columns environment to change the lay-out of frames with a lot of white space. This works fine in most cases, but when I use it with the ToC, the vertical spacing is wrong, and the list is compressed. See the example below. Any ideas how to fix this? I could maybe use a hack like this post Beamer: Vertical alignment of multi-column ToC, but I'd prefer something more elegant.

Just to be clear: I don't have a very long ToC in my real document, it's for aesthetic reasons only.

\documentclass{beamer}
%\setbeamertemplate{subsection in toc shaded}[default][20]

\begin{document}
\begin{frame}
%\begin{columns}
%\column{.25\textwidth}
%\column{.75\textwidth}
\tableofcontents[sectionstyle=show, subsectionstyle=show/shaded]
%\end{columns}
\end{frame}

\section{What I like}
\frame{
    \begin{columns}[t]
    \column{.25\textwidth}
    \column{.75\textwidth}
    \tableofcontents[sectionstyle=show, subsectionstyle=show/show/shaded]
    \end{columns}
}

\subsection{I like chocolate}
\begin{frame}
\frametitle{I like chocolate}
\begin{columns}[t]
\column{.25\textwidth}
\column{.75\textwidth}
because it's nice and sweet
\end{columns}
\end{frame}
\subsection{I like football}
\begin{frame}
\frametitle{I like football}
because all my friends play it too
\end{frame}

\section{What I don't like}
\frame{
    \begin{columns}[t]
    \column{.25\textwidth}
    \column{.75\textwidth}
    \tableofcontents[sectionstyle=show, subsectionstyle=show/show/shaded]
    \end{columns}
}
\subsection{I don't like being sad}
\begin{frame}
\frametitle{I don't like being sad}
because it makes me cry
\end{frame}
\subsection{I don't like fighting}
\begin{frame}
\frametitle{I don't like fighting}
because I always loose
\end{frame}


\end{document}
0

1 Answer 1

7

This happens because the bemaer column system uses the LaTeX minipage behind the scenes: a vertical box. As these are not set with a fixed height they don't stretch, in contrast to setting a frame where beamer does some resizing (so the stretch is important). For a one-off application I'd be tempted to use a raw minipage and adjust as require. For example

\begin{frame}
    \begin{columns}
    \begin{minipage}[t][0.5\textheight]{0.75\textwidth}
      \tableofcontents[sectionstyle=show, subsectionstyle=show/show/shaded]
    \end{minipage}\hfill
    \end{columns}
\end{frame}

Looks just about right to me. The spacing is a bit off but the beamer internals are a pain in this regard and I'd rather not trace all of it through to make it identical to a 'normal' frame!

1
  • This works. Note that nesting the raw minipage inside a column environment fixes the spacing (at a minimal complexity cost).
    – oricha
    Commented Sep 8, 2021 at 17:29

You must log in to answer this question.

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