TransWikia.com

Creating two columns in beamer

TeX - LaTeX Asked by user4437416 on May 21, 2021

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.5textwidth}
   some text here
end{column}
begin{column}
    begin{center}
     includegraphics[width=0.5textwidth]{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.

3 Answers

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.5textwidth}
   some text here some text here some text here some text here some text here
end{column}
begin{column}{0.5textwidth}  %%<--- here
    begin{center}
     includegraphics[width=0.5textwidth]{image1.jpg}
     end{center}
end{column}
end{columns}
end{frame}
end{document}

enter image description here

Correct answer by user11232 on May 21, 2021

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.5textwidth}
   some text here some text here some text here some text here some text here
end{column}
begin{column}{0.5textwidth}  
    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}

Answered by Miklós Koren on May 21, 2021

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}

Answered by alfC on May 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP