Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
    
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

2 Answers 2

up vote 3 down vote accepted

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}
share|improve this answer
    
I'd forgotten the empty lines around the text. This does make much more sense. Thank you! –  user2249626 Apr 30 '13 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. –  Jubobs Apr 30 '13 at 12:43

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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