1. Introduction

When it comes to document preparation, LaTeX stands out as a powerful typesetting system known for its flexibility and robustness.

In this tutorial, we’ll explore how to use a two-column layout in LaTeX.

Firstly, we’ll explore utilizing the multicol package to create a two-column layout. After that, we’ll employ the minipage environment to create a two-column layout within a document. Lastly, we’ll explore how to create a double-column layout of different widths.

2. Display Styles in LaTeX

LaTeX supports various display styles, each catering to different document requirements. These styles include single-column, double-column, and custom-column layouts. While the default behavior is single-column, we can easily switch to double-column mode for the entire document using appropriate commands or document classes. Let’s look at various LaTeX column styles:

Different LaTeX layouts

Now, to create double-column and multi-column layouts as shown in the output given above, we have several approaches. Before we begin, let’s examine the sample one-column file main.tex:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\section*{Single Layout Example}
\subsection*{Left Column: Matrix}
\[
A = \begin{bmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{bmatrix}
\]
\subsection*{Equations}
\begin{align*}
f(x) &= x^2 \\
g(x) &= \frac{1}{x} \\
h(x) &= \sqrt{x}
\end{align*}
\subsection*{Right Column: Content}
\subsubsection*{List of Items}
\begin{itemize}
\item Item 1
\item Item 2
\end{itemize}
\subsubsection*{Paragraph}
This is a sample LaTeX document
\end{document}

Let’s look at the compiled LaTeX code for the sample document:

Sample LaTeX file

From the provided code snippet, we can observe that the layout includes equations, matrices, a list of items, and various sections.

3. Using the multicol Package

One approach to creating a double-column layout is to to use the multicol package to format a LaTeX document.

The multicol package is a popular choice for creating multi-column layouts in LaTeX. Additionally, to use this package, we include\usepackage{multicol} at the beginning of the LaTeX document.

For instance, to divide main.tex into a two-column layout, we use multicol at the beginning and end of the document:

\documentclass{article}
\usepackage{multicol}
\usepackage{amsmath} % for matrices
\begin{document}
\begin{multicols}{2}
\section*{Left Column: Matrix}
\[
A = \begin{bmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{bmatrix}
\]
\section*{Equations}
\begin{align*}
f(x) &= x^2 \\
g(x) &= \frac{1}{x} \\
h(x) &= \sqrt{x}
\end{align*}
\columnbreak
\section*{Right Column: Content}
\subsection*{List of Items}
\begin{itemize}
\item Item 1
\item Item 2
\end{itemize}
\subsection*{Paragraph}
This is a sample LaTeX document
\end{multicols}
\end{document}

The output displays the document content in two columns:

multicol package output

In the above example, the \begin{multicols}{2} statement divides the content into two columns. Moreover, the argument {2} specifies the number of columns. Furthermore, we can customize the number of columns by adjusting the argument of the multicols environment.

In addition, we use the \columnbreak command to force a column break, ensuring content appears in separate columns. Hence, this enables us to put content in an independent column, fulfilling our requirement of displaying a matrix in one column and a list of items in the other.

4. Using the minipage Package

Similarly, the minipage package provides a versatile solution for creating double-column content in LaTeX. Similarly, like with multicol, we include \usepackage{multicol} at the beginning of the LaTeX document.

4.1. Creating a Double-Column Layout of Equal Width

Here’s how we can utilize minipage for a two-column layout:

\documentclass{article}
\usepackage{amsmath} % for matrices
\begin{document}
\section*{Minipage Example}
\begin{minipage}[t]{0.48\textwidth}
\section*{Left Column: Matrix}
\[
A = \begin{bmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{bmatrix}
\]
\section*{Equations}
\begin{align*}
f(x) &= x^2 \\
g(x) &= \frac{1}{x} \\
h(x) &= \sqrt{x}
\end{align*}
\end{minipage}
\hfill
\begin{minipage}[t]{0.48\textwidth}
\section*{Right Column: Content}
\subsection*{List of Items}
\begin{itemize}
\item Item 1
\item Item 2
\end{itemize}
\subsection*{Paragraph}
This is a sample LaTeX document
\end{minipage}
\end{document}

Now, let’s look at the code:

  • \begin{minipage} initiates the minipage environment
  • [t] specifies the vertical alignment of the minipage content
  • {0.48\textwidth} specifies the width of the minipage

Let’s look at the output generated by this code:

multipage double-column layout

In this example, [t] stands for top. This indicates that the content will be aligned with the top of the surrounding text.

4.2. Creating a Double-Column Layout With Different Widths

Additionally, we can change the column width. For instance, if we want to make one column bigger and one column smaller, we adjust the minipage width argument:

\documentclass{article}
\usepackage{amsmath} % for matrices
\begin{document}
\section*{Minipage Example}
\begin{minipage}[t]{0.75\textwidth}
\section*{Left Column: Matrix}
\[
A = \begin{bmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{bmatrix}
\]
\section*{Equations}
\begin{align*}
f(x) &= x^2 \\
g(x) &= \frac{1}{x} \\
h(x) &= \sqrt{x}
\end{align*}
\end{minipage}
\hfill
\begin{minipage}[t]{0.25\textwidth}
\section*{Right Column: Content}
\subsection*{List of Items}
\begin{itemize}
\item Item 1
\item Item 2
\end{itemize}
\subsection*{Paragraph}
This is a sample LaTeX document
\end{minipage}
\end{document}

Now, let’s view the output:

multipage different width layout

In this example, the left column takes up 70% of the text width. However, the right column only takes up 30%. Therefore, we can adjust the width according to our requirements.

5. Conclusion

In this article, we covered how to create a two-column layout in LaTex.

Firstly, we covered how to use multicol to modify the single-column layout to a two-column layout. After that, we looked at the minipage package to achieve similar results. Lastly, we explored creating a two-column layout with different column lengths.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.