5

I've got a frame in beamer with two columns. Each column contains a figure that contains an image. I'd like to put some text below each figure.

I'd like the text to be centred within each column.

This is what my frame looks like:

\begin{frame}
\frametitle{Auswirkung der Knotenzahl}
\begin{columns}
\column{6.5cm}
\begin{figure}
\includegraphics[width=.90\textwidth]{KnotNo_1}
\end{figure}
Underfitting/Oversmoothing
\column{6.5cm}
\begin{figure}
\includegraphics[width=.90\textwidth]{KnotNo_3}
\end{figure}
Overfitting/Undersmoothing
\end{columns}
\end{frame}

I've tried putting the text inside a center environment but that doesn't give me the result I want (i.e. the text isn't perfectly aligned within each column).

  • Welcome to TeX.sx!. Simply use the \centering declaration in each column. – jubobs Apr 30 '13 at 12:19
  • Using figure environments here doesn't really make sense. You should get rid of them. – jubobs Apr 30 '13 at 12:30
  • The reason I used figure was to get the text below the images. Without using it the images cover part of the text. – user2249626 Apr 30 '13 at 12:32
  • I'm not sure what you mean. See my answer below. – jubobs Apr 30 '13 at 12:38
5

I don't think you need figure environments, here.

To centre everything within one column, just use the \centering declaration in it:

enter image description here

\documentclass{beamer}

\usepackage{tikz} % used instead of graphicx, for exposition purposes

\begin{document}
\begin{frame}
\frametitle{Auswirkung der Knotenzahl}
\begin{columns}
\column{6.5cm}
\centering
\begin{tikzpicture}
    \path[draw=red,fill=red!20] (0,0) rectangle (4,4);
\end{tikzpicture}
Underfitting/Oversmoothing
\column{6.5cm}
\centering
\begin{tikzpicture}
    \path[draw=blue,fill=blue!20] (0,0) rectangle (4,4);
 \end{tikzpicture}
Overfitting/Undersmoothing
\end{columns}
\end{frame}
\end{document}
2

The center environment centers the text correctly, but it looks misaligned because the images above aren't centered. You can add \centering to each figure to fix it.

\documentclass{beamer}

\usepackage{tikz}

\begin{document}
\begin{frame}
  \frametitle{Auswirkung der Knotenzahl}
  \begin{columns}
    \column{6.5cm}
    \begin{figure}
      \centering
      \tikz{\fill (0,0) rectangle (1,1);}
    \end{figure}
    \begin{center}
      Underfitting/Oversmoothing
    \end{center}
    \column{6.5cm}
    \begin{figure}
      \centering
      \tikz{\fill (0,0) rectangle (1,1);}
    \end{figure}
    \begin{center}
      Overfitting/Undersmoothing
    \end{center}
  \end{columns}
\end{frame}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.