2

I have some problems with vertical alignment of toc in beamer class related to this question.

The answer works for me, but i would like to center the toc and decrease the horizontal space between these two columns. All items should be on the same height.

\documentclass[12pt,handout,]{beamer}
\usepackage{luacode}
\usepackage{luatextra}
\usepackage[utf8]{luainputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}

\begin{document}

\begin{frame}[t,plain]
\titlepage
\addtocounter{framenumber}{-1}
\end{frame}

\begin{frame}[fragile]\frametitle{Inhalt des Kurses}

\setcounter{tocdepth}{1}
\begin{columns}[t]
\begin{column}{.33\textwidth}
    \tableofcontents[sections={1-5}]
\end{column}
\begin{column}{.33\textwidth}
    \tableofcontents[sections={6-10}]
\end{column}
\end{columns}

\end{frame}

\section{section 1}
\subsection{section 1}
\begin{frame}test\end{frame}
\subsection{section 1}
\begin{frame}test\end{frame}
\section{section 2}
\subsection{section 1}
\begin{frame}test\end{frame}
\subsection{section 1}
\begin{frame}test\end{frame}
\section{section 3}
\subsection{section 1}
\begin{frame}test\end{frame}
\subsection{section 1}
\begin{frame}test\end{frame}
\section{section 4}
\subsection{section 1}
\begin{frame}test\end{frame}
\subsection{section 1}
\begin{frame}test\end{frame}
\section{section 5}
\subsection{section 1}
\begin{frame}test\end{frame}
\subsection{section 1}
\begin{frame}test\end{frame}
\section{section 6}
\subsection{section 1}
\begin{frame}test\end{frame}
\subsection{section 1}
\begin{frame}test\end{frame}
\section{section 7}
\subsection{section 1}
\begin{frame}test\end{frame}
\subsection{section 1}
\begin{frame}test\end{frame}
\section{section 8}
\subsection{section 1}
\begin{frame}test\end{frame}
\subsection{section 1}
\begin{frame}test\end{frame}
\section{section 9}
\subsection{section 1}
\begin{frame}test\end{frame}
\subsection{section 1}
\begin{frame}test\end{frame}
\section{section 10}
\subsection{section 1}
\begin{frame}test\end{frame}
\subsection{section 1}
\begin{frame}test\end{frame}

\end{document}

Edit: If I increase the column width, it works. The distance between the columns is too large and it is not centered.

SLx64
  • 2,823
  • I cannot see that with your code fragment. Make a complete example which shows that behaviour. –  Jun 05 '14 at 19:58
  • I've edited my answer. – SLx64 Jun 05 '14 at 20:08
  • Please provide a minimal working example (MWE) that replicates your problem. We want to copy-and-paste your code and see what the problem is. That doesn't happen with the above code snippet, as we don't have the full document you \input. – Werner Jun 05 '14 at 20:17
  • @SLx64 That is useless because we cannot run the example. –  Jun 05 '14 at 20:31
  • There are so many files, i hope it works now. – SLx64 Jun 05 '14 at 20:39
  • @SLx64: When I add the 10 sections you mention I get a well-aligned (vertically) ToC in the two columns. Why is that? – Werner Jun 05 '14 at 20:59
  • I don't know where the problem is. When i add the section i don't get the problem. The input files only contains a lot of frames like the one in my question. – SLx64 Jun 05 '14 at 21:02
  • So comment them out selectively until you find the one causing the problem and/or comment out the packages you are loading selectively. You need to create a minimal working example (MWE) that illustrates your problem. The link explains how to do that and what to post here. Often, creating the example will enable you to solve the problem yourself. If not, posting the example will make it much more likely you'll get useful help. – cfr Jun 06 '14 at 00:17
  • I was able to reproduce the problem some minutes later yesterday and edited my answer. I have edited my answer again and the MWE shows the problem now. – SLx64 Jun 06 '14 at 05:35
  • I cannot reproduce the problem compiling your example with MikTeX's lualatex. I had to comment out babel package, with it an error was shown. – Ignasi Jun 06 '14 at 07:09

1 Answers1

1

Although not automatically, you can adjust the value [totalwidth=.6\textwidth] to get your desired space between the columns. In case you want change the horizontal positioning on the page, you can play around with \hspace*{2.5cm}.

\documentclass{beamer}
\usepackage{luacode}
\usepackage{luatextra}
\usepackage[utf8]{luainputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}

\usepackage{pgffor} %to use \foreach

\begin{document}

    \begin{frame}
        \frametitle{Inhalt des Kurses}
        \setcounter{tocdepth}{1}
        \begin{columns}[totalwidth=.6\textwidth] %change size to adjust space 
            \hspace*{2.5cm} % change here for horizontal positioning
            \begin{column}{.35\textwidth}
          \tableofcontents[sections={1-5}]
            \end{column}
            \begin{column}{.35\textwidth}
            \tableofcontents[sections={6-10}]
            \end{column}
        \end{columns}
    \end{frame}

  \foreach \n in {1,...,10}{
    \section{section 1}
        \subsection{section 1}
        \begin{frame}test\end{frame}
    }

\end{document}

enter image description here