6

I have problems to put a picture right to the table of contents. This is how it should look like: enter image description here

I have two MWE's, becuase I already tried two different approaches. (All the empty frames are needed to create the TOC) The first one works with columns:

\documentclass{beamer}
\begin{document}
\begin{frame}
    \begin{columns}
        \column{7cm}
            \tableofcontents
        \column{3cm}
            \includegraphics{picture.png}
    \end{columns}
\end{frame}
\section{A section with a name}
\begin{frame}
\end{frame}
\section{A longer section name, ....................}
\begin{frame}
\end{frame}
\section{another section}
\begin{frame}
\end{frame}
\section{a medium long section name}
\begin{frame}
\end{frame}
\end{document}

In this approach the vspace between the items in the TOC disappears.

This is my second approach:

\documentclass{beamer}
\begin{document}
\begin{frame}
    \hspace{7cm}\includegraphics{picture.png}
    \tableofcontents
\end{frame}
\section{A section with a name}
\begin{frame}
\end{frame}
\section{A longer section name, ....................}
\begin{frame}
\end{frame}
\section{another section}
\begin{frame}
\end{frame}
\section{a medium long section name}
\begin{frame}
\end{frame}
\end{document}

People more experienced than me already know what happens before compiling. The TOC is shifted down.

I already thought about using this solution: Backround in TOC with beamer But that wouldn't be a nice solution, becauase I would have to create a whole background image, just to insert one little picture.

There must be a better solution. Is here anyone who knows it?

3 Answers 3

5

How about using minipages:

\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{minipage}[t][0.6\textheight]{0.6\textwidth}
 \vspace{0pt} 
  \tableofcontents
\end{minipage}
\begin{minipage}[t]{0.35\textwidth} 
 \vspace{0pt}  
 \includegraphics[width=.9\textwidth]{picture.jpg}
\end{minipage}
\end{frame}
\section{A section with a name}
\begin{frame}
\end{frame}
\section{A longer section name, ....................}
\begin{frame}
\end{frame}
\section{another section}
\begin{frame}
\end{frame}
\section{a medium long section name}
\begin{frame}
\end{frame}
\end{document}

This is how it will look:

4
  • Sorry, but this way I run into the same problem as with columns. The space between the elements of the TOC are decreased.
    – Dave
    Commented Jan 24, 2013 at 14:21
  • You can specify the height of the minipage too: \begin{minipage}[t][0.6\textheight]{0.6\textwidth}. Then the toc will populate the minipage with a regular spread of all entries. In that case then I would also recommend to put \vspace{0pt} as a first line in each minipage so that they both align on the same line.
    – myrtille
    Commented Jan 24, 2013 at 14:37
  • I've edited the code in my reply to reflect the suggested changes. Maybe that's more what you're looking for.
    – myrtille
    Commented Jan 24, 2013 at 14:41
  • TOC is still too low compared to the version with plain \begin{frame}\tableofcontents\end{frame}. See my related question. Commented Sep 22, 2017 at 9:28
9

With the help of TikZ one could use the special node current page that, in combination with overlay allows you to achieve the target. It is necessary also to shift a bit the position because you can just access the node's anchors.

The code:

\documentclass{beamer}
\usepackage{lmodern}
\usetheme{CambridgeUS}
\usepackage{tikz}
\usepackage{mwe}% for dummy image

\begin{document}

\begin{frame}
\frametitle{Outline}
\tableofcontents
\tikz[remember picture,overlay]
 \node at ([xshift=-3.5cm,yshift=-3.5cm]current page.north east) 
  {\includegraphics[height=2cm,keepaspectratio]{example-image}};
\end{frame}

\section{Test Section One}
\begin{frame}
Contents of section one
\end{frame}

\section{Test Section Two}
\begin{frame}
Contents of section two
\end{frame}

\section{Test Section Three}
\begin{frame}
Contents of section three
\end{frame}

\end{document}

The result:

enter image description here

2
  • Thanks :-) Good to know how to achieve this in with TikZ. I already thought about extracting the toc as pdf, then load it with tikz and then add the real picture. But this is much smarter :-)
    – Dave
    Commented Jan 24, 2013 at 14:54
  • This is a much more flexible solution than using minipages. It should be the accepted answer. Commented Oct 17, 2018 at 10:04
5

I suggest you use the textpos package. Using the answer provided by Claudio Fiandrino

\documentclass{beamer}
\usepackage{lmodern}
\usetheme{CambridgeUS}
\usepackage{mwe}% for dummy image
\usepackage[absolute,overlay]{textpos}

\begin{document}

\begin{frame}
%
\begin{textblock*}{2cm}(10cm,2cm)
\includegraphics[width=2cm,keepaspectratio]{example-image}
\end{textblock*}
%
\frametitle{Outline}
\tableofcontents
\end{frame}

\section{Test Section One}
\begin{frame}
Contents of section one
\end{frame}
\section{Test Section Two}
\begin{frame}
Contents of section two
\end{frame}

\section{Test Section Three}
\begin{frame}
Contents of section three
\end{frame}

\end{document}

Using it, you can place anything on a slide, independently of its contets.

3
  • Now, that I have three working solutions, I'll try all of them by time. But the textpos package sounds very usefull. I'll remember it :-)
    – Dave
    Commented Jan 24, 2013 at 15:02
  • 1
    i use all the time with beamer... also useful, when using textpos, is to create a grid on the slide, so you know where to place thing. You can add a grid by using \usepackage[texcoord,grid, gridunit=mm, gridcolor=red!10, subgridcolor=green!10]{eso-pic} Commented Jan 24, 2013 at 15:04
  • I can't believe I spent three hours trying to fit two logos in a poster header before I found this.. Commented Feb 1, 2017 at 4:59

You must log in to answer this question.

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