Resurchify

# LaTeX Multiple Columns

This tutorial talks about the usage of multiple columns in LaTeX. Text with two or double columns can be created by passing the parameter \twocolumn to the document class statement. If you want to create a document with more than two columns, use the package multicol, which has a set of commands for the same.

## Introduction

It is very easy to manage multiple columns in LaTeX. Below is an example demonstrating the use of multicol package to manage multicolumn documents in LaTeX.

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[english]{babel}   \usepackage{multicol}   \begin{document} \begin{multicols}{4} [ \section{Section One} This is the first section and we are placing some text here. ] Now, we are adding some text here to understand how multiple columns will come up. This way, we hope that you are understanding the multicols package and its usage. The text that we have placed here is only for sample. \end{multicols}   \end{document} 

Use this line in the preamble to import the package: \usepackage{multicol}. After this, the multicols environment can be used. It takes two parameters:

• Number of columns: This parameter is passed inside the braces, and in the example above, the value is 4.
• Header text: This is inserted inside the square brackets. This parameter is optional and will be displayed on top of the multicolumn text. We can use any LaTeX command here, except for floating elements such as figures and tables. In the example above, we have given the title of the section with a small paragraph.

The text which lies between the tags \begin{multicols} and  \end{multicols} is displayed in multicolumn format.

## Column separation

The separation between the columns is specified by the command \columnsep Below is an example.

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[english]{babel}   \usepackage{multicol} \setlength{\columnsep}{2cm}   \begin{document} \begin{multicols}{3} [ \section{Section One} This is the first section and we are placing some text here. ] Now, we are adding some text here to understand how multiple columns will come up. This way, we hope that you are understanding the multicols package and its usage. The text that we have placed here is only for sample. \end{multicols}   \end{document} 

In the example above, the command  \setlength{\columnsep}{2cm} sets the column separation to 2cm.

## Unbalanced columns

Through the default settings of multicols environment, the text in each column is balanced that is, there is same amount of text in each column. This can be changed by the environment multicols*.

  1 2 3 4 5 6 7 8 9 10 11 \begin{multicols*}{2} [ \section{Section One} This is the first section and we are placing some text here. ] Now, we are adding some text here to understand how multiple columns will come up. This way, we hope that you are understanding the multicols package and its usage. The text that we have placed here is only for sample. \end{multicols*}   \end{document} 

In the above example, we can see that the text gets printed in a column till we reach the end of the page. After that, the text continues in the next column and so on.

## Inserting floating elements

Floating elements like figures and tables can be inserted in a multicolumn format document with the commands wrapfig and wraptable.

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 \begin{multicols}{3} [ \section{Section One} This is the first section and we are placing some text here. ]   Now, we are adding some text here to understand how multiple columns will come up. This way, we hope that you are understanding the multicols package and its usage. The text that we have placed here is only for sample.   \vfill   \begin{wrapfigure}{l}{0.6\linewidth} \includegraphics[width=\linewidth]{./sun.jpg} \caption{Nature’s place} \end{wrapfigure}   This is again some new text here. Just to show you how the.. text is getting placed….. Hope you are able to understand…   \begin{wraptable}{l}{0.6\linewidth} \centering \begin{tabular}{|c|c|} \hline R.No.& Name \\ \hline 1 & John \\ 2 & Peter \\ 3 & Susie \\ 4 & Suzanne \\ 5 & Tom \\ 6 & Veronica \\ \hline \end{tabular} \caption{Table, floating element} \label{table:ta} \end{wraptable}   \end{multicols}   \end{document} 

In the multicol package, floats are poorly supported. Elements inserted within the  figure* and  table* environments get displayed only at the top or bottom of the next page after they are inserted, and this breaks the layout. Below is a brief overview of the commands.

• \usepackage{wrapfig}: This line will import the package wrapfig
• wrapfigure: This will insert a figure wrapped with the text.
• wraptable: This is similar to wrapfigure, except that it acts for tables.

## Inserting vertical rulers

A vertical ruler can be inserted as a column separator as shown in the below example.

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[english]{babel}   \usepackage{multicol} \usepackage{color}   \usepackage{comment}   \setlength{\columnseprule}{2pt} \def\columnseprulecolor{\color{red}}   \begin{document}   \begin{multicols}{2} [ \section{Section One} This is the first section and we are placing some text here. ]   Now, we are adding some text here to understand how multiple columns will come up. This way, we hope that you are understanding the multicols package and its usage. The text that we have placed here is only for sample.   \columnbreak   This is again some new text here. Just to show you how the.. text is getting placed….. Hope you are able to understand… \end{multicols}   Some more text here just to show.   \end{document} 
• \usepackage{color}: This is added in the preamble so that several colours can be used within the document.
• \setlength{\columnseprule}{2pt}: This defines the width of the column separator. It is 0 by default. Here, the width is 2pt.
• \def\columnseprulecolor{\color{red}}: This sets the colour of the separator line to be red.
• \columnbreak: This command inserts a column breakpoint.

## Creating two columns in LaTeX

While writing a research paper, you may need to produce a document with two columns layout in a page. To do so, add twocolumn option in the document class.

Use the following command to make double column document:

 1 \documentclass[11pt,twocolumn]{article} 

Remember, the above command will generate double columns in the entire document.
Another way to achieve this is by including the \usepackage{multicol} package and using the multicols environment.

Look at the below sample code to understand the usage:

 1 2 3 4 5 \begin{multicols}{2} Column Nuumber 1 \columnbreak Column Number 2 \end{multicols} 

Two column layout is widely used in writing conference papers, journal papers, books, and articles, etc.