8

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).

4
  • Welcome to TeX.sx!. Simply use the \centering declaration in each column.
    – jub0bs
    Commented Apr 30, 2013 at 12:19
  • Using figure environments here doesn't really make sense. You should get rid of them.
    – jub0bs
    Commented Apr 30, 2013 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. Commented Apr 30, 2013 at 12:32
  • I'm not sure what you mean. See my answer below.
    – jub0bs
    Commented Apr 30, 2013 at 12:38

2 Answers 2

7

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
  • I'd forgotten the empty lines around the text. This does make much more sense. Thank you! Commented Apr 30, 2013 at 12:39
  • @user2249626 Empty lines around the text don't change anything in this case. Accepting and upvoting answers is the preferred way here to say “thank you” to users who helped you.
    – jub0bs
    Commented Apr 30, 2013 at 12:43
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

You must log in to answer this question.

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