148

I have searched the stackexchange for a resolution of this problem, but I am still getting an error message when I put in the following (for now neglecting other things in my document, such as documentclass, begin{document}, etc.):

\begin{frame}
\frametitle{explanation}
\begin{columns}
\begin{column}{width=0.5\textwidth}
   some text here
\end{column}
\begin{column}
    \begin{center}
     \includegraphics[width=0.5\textwidth]{image1.jpg}      
     \end{center}
\end{column}
\end{columns}
\end{frame}

When compiled, I get the error: Missing number, treated as zero. I should appreciate any help.

user4437416
  • 1,939

3 Answers3

199

You forgot to give the mandatory width to the second column, and you included an unnecessary width= in the width for the first column.

\documentclass[demo]{beamer}
\begin{document}
  \begin{frame}
\frametitle{explanation}
\begin{columns}
\begin{column}{0.5\textwidth}
   some text here some text here some text here some text here some text here
\end{column}
\begin{column}{0.5\textwidth}  %%<--- here
    \begin{center}
     \includegraphics[width=0.5\textwidth]{image1.jpg}
     \end{center}
\end{column}
\end{columns}
\end{frame}
\end{document}

enter image description here

14

Also note that the graphics need not be scaled down as much in the second column. The column becomes a minipage, so \textwidth is already adjusted to its width.

\documentclass[demo]{beamer}
\begin{document}
  \begin{frame}
\frametitle{explanation}
\begin{columns}
\begin{column}{0.5\textwidth}
   some text here some text here some text here some text here some text here
\end{column}
\begin{column}{0.5\textwidth}  
    \begin{center}
     %%%%% this is a minipage, so \textwidth is already adjusted to the size of the column
     \includegraphics[width=\textwidth]{image1.jpg}
     \end{center}
\end{column}
\end{columns}
\end{frame}
\end{document}
12

The "columns" feature of Beamer (other answers above) lets you customize the layout and the breaking point.

However if you want to let the text flow or you don't care about the exact layout, many times the good old multicol package does the job well with less noise. Paragraph divisions and \columnbreak can help deciding what is on the left and side or the right hand side in the two-column case.

\usepackage{multicol}
...
\begin{frame}{Frame Title}
    \begin{multicols}{2} % two columns
        Left Hand side text
    \includegraphics[width=4cm]{RHS_image}
\end{multicols}

\end{frame}

alfC
  • 14,350