## 1. Creating columns with different widths

To create columns in beamer, we use the columns environment. Then, at the point to begin a column we use the \column command followed by the width of the columns (or \begin{column} ... \end{column}).

In the following example, we have created two columns with different widths:

% Columns in beamer
\documentclass{beamer}

% Theme choice:
\usetheme{CambridgeUS}

\begin{document}

\begin{frame}{Columns in beamer}
\begin{columns}
\column{0.6\textwidth}
\centering
This is column one with 0.75 text width.
\column{0.4\textwidth}
\centering
This is column two with 0.25 text width.
\end{columns}
\end{frame}

\end{document}

Compiling this code yields:

• We used CambridgeUS theme, loaded by the command \usetheme{CambridgeUS}.
• The frame has the title “Columns in beamer”.
• We created two columns: one with 60% of text width and the second with 40% text width.
• Text inside each column is centered using the command \centering.

## 2. Figure next to text in beamer

With the same manner as above, we can add text and image in the same slide as follows:

% Image and text in beamer (same slide)
\documentclass{beamer}

% Theme choice:
\usetheme{CambridgeUS}

\begin{document}

\begin{frame}{Text and Image in beamer}
\begin{columns}
\column{0.4\textwidth}
This is an example of text and image in the same slide using columns environment.
\column{0.6\textwidth}
\begin{figure}
\centering
\includegraphics[width=\textwidth]{Neural-Network.jpg}
\caption{Neural Network with 5 neurons in the hidden layer. }
\end{figure}
\end{columns}
\end{frame}

\end{document}

Compiling this code yields:

The image of the Neural Network can be downloaded from here: NN.jpg. This illustration is drawn in LaTeX using TikZ package, read this post!

## 3. Vertical line between columns

To distinctively separate the two (or more) columns from each other we can create a vertical line between them. This can be done simply by adding a \rule command in an intermediate column with a small width. In the example below two columns are separated with a vertical line using this method.

% Vertical line between columns
\documentclass{beamer}

% Theme choice:
\usetheme{CambridgeUS}

\begin{document}

\begin{frame}{Vertical line between columns}

\begin{columns}
% Column 1
\begin{column}{0.49\textwidth}

\begin{itemize}
\item Input layer: 2 neurons.
\item Hidden layer: 5 neurons.
\item Output layer: 2 neurons.
\end{itemize}

\end{column}

% Column 2 (vertical line)
\begin{column}{.02\textwidth}
\rule{.1mm}{0.7\textheight}
\end{column}

% Column 3
\begin{column}{0.49\textwidth}
\includegraphics[width=\textwidth]{Neural-Network.jpg}
\end{column}

\end{columns}
\end{frame}

\end{document}

Compiling this code yields:

• We have created 3 columns of widths 0.49, 0.02, 0.49 of the slide text width, respectively.
• The first column has an unordered list, the second column contains the vertical line and the third column contains an image.
• The vertical line has a width of 0.1mm and a height of 70% of the text height. This is achieved by the command \rule{<width>}{<height>}.

## 4. Vertical alignment of columns

The vertical alignment of column content is very important for the beautification of a presentation. The text and the figures can be placed in three position in a frame, i.e. top, bottom, and center. By specifying [c ], [T], or [b] after beginning the column environment will a automatically position the short content to the center, top, or bottom respectively.

### – Top alignment

% Vertical alignment columns
\documentclass{beamer}

% Theme choice:
\usetheme{CambridgeUS}

\begin{document}

\begin{frame}{Vertical alignment (top)}

\begin{columns}[T]
% Column 1
\begin{column}{0.5\textwidth}
This is a neural network with two inputs and two outputs. It has the following parameters:
\begin{itemize}
\item Input layer: 2 neurons.
\item Hidden layer: 5 neurons.
\item Output layer: 2 neurons.
\end{itemize}
The neural network is drawn in \LaTeX{} using Ti\textit{k}Z package. Check latexdraw.com for more details.
\end{column}

% Column 2
\begin{column}{0.5\textwidth}
\includegraphics[width=\textwidth]{Neural-Network.jpg}
\end{column}

\end{columns}
\end{frame}

\end{document}

which yields to top alignment of different columns’ contents. In this case, we have text and an image as shown below:

### – Center alignment

% Vertical alignment columns
\documentclass{beamer}

% Theme choice:
\usetheme{CambridgeUS}

\begin{document}

\begin{frame}{Vertical alignment (center)}

\begin{columns}[c]
% Column 1
\begin{column}{0.5\textwidth}
This is a neural network with two inputs and two outputs. It has the following parameters:
\begin{itemize}
\item Input layer: 2 neurons.
\item Hidden layer: 5 neurons.
\item Output layer: 2 neurons.
\end{itemize}
The neural network is drawn in \LaTeX{} using Ti\textit{k}Z package. Check latexdraw.com for more details.
\end{column}

% Column 2
\begin{column}{0.5\textwidth}
\includegraphics[width=\textwidth]{Neural-Network.jpg}
\end{column}

\end{columns}
\end{frame}

\end{document}

which yields to center alignment of different columns’ contents as shown below:

### – Bottom alignment

% Vertical alignment columns
\documentclass{beamer}

% Theme choice:
\usetheme{CambridgeUS}

\begin{document}

\begin{frame}{Vertical alignment (bottom)}

\begin{columns}[b]
% Column 1
\begin{column}{0.5\textwidth}
This is a neural network with two inputs and two outputs. It has the following parameters:
\begin{itemize}
\item Input layer: 2 neurons.
\item Hidden layer: 5 neurons.
\item Output layer: 2 neurons.
\end{itemize}
The neural network is drawn in \LaTeX{} using Ti\textit{k}Z package. Check latexdraw.com for more details.
\end{column}

% Column 2
\begin{column}{0.5\textwidth}
\includegraphics[width=\textwidth]{Neural-Network.jpg}
\end{column}

\end{columns}
\end{frame}

\end{document}

Compiling this code yields:

## Summary

• Creating columns in beamer can be achieved by column environment. We can create columns inside the main column with a predefined width which is achieved using \begin{columns}{<width>} ... \end{columns}
• Vertical line between columns can be created using the command \rule{<width>}{<height>} inside an intermediate column with a small width.
• Content alignment of different columns can be achieved by adding [T], [b] or [c] for top alignment, bottom alignment and center alignment, respectively, just after the main column environment.

Next Lesson: 07 Your Guide to Beamer Blocks