If you’ve ever found yourself navigating through lengthy academic papers, reports, or manuscripts, you’ll understand the importance of a well-organized table of contents (TOC). By default, \tableofcontents
command generates TOC in a single column in LaTeX. Sometimes, we want to make our TOC page compact and visually more appealing by generating TOC in two columns. In this blog post, we’ll show you how to create a two-column table of contents in LaTeX.
Table of Contents in LaTeX
Creating a Table of Contents in LaTeX is very easy. LaTeX automatically generates a table of contents based on the structure of your document using \tableofcontents
command. Ensure your document has a structure with proper sectioning. For example
\documentclass[11pt]{report}
\usepackage[margin=1in]{geometry}
\begin{document}
\tableofcontents
\chapter{Chapter 1}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 2}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 3}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 4}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 5}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 6}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\end{document}
Output
You can see that there is a single-column TOC in the above example. There is a lot of blank space on the page. So, in order to save the page and minimize space in the TOC, we will generate a two-column TOC.
Two column Table of Contents in LaTeX
You can use multitoc
package to generate two column TOC. The multitoc
package allows users to create multi-column tables of contents (TOCs), lists of figures (LOFs), and lists of tables (LOTs). You can install the multitoc
package from the CTAN website. For TOC, you need to add the following in the preamble.
\usepackage[toc]{multitoc}
Let us take an example.
\documentclass[11pt]{report}
\usepackage[margin=1in]{geometry}
\usepackage[toc]{multitoc}
\begin{document}
\tableofcontents
\chapter{Chapter 1}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 2}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 3}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 4}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 5}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 6}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 7}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 8}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 9}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 10}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\end{document}
Output
You can see TOC in the two column format.
Horizontal space between columns
If you want to customize the horizontal space between columns, you can do it using columnsep
command. Its value can be adjusted to control column spacing for better layout and readability.
Here’s how you can work with columnsep
:
Use the \setlength
command within the document preamble to set a global value for columnsep
.
\setlength{\columnsep}{7mm} % Sets separation to 7 mm
For example
\documentclass[11pt]{report}
\usepackage[margin=1in]{geometry}
\usepackage[toc]{multitoc}
\setlength{\columnsep}{7mm} % Sets separation to 7 mm
\begin{document}
\tableofcontents
\chapter{Chapter 1}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 2}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 3}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 4}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 5}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 6}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 7}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 8}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 9}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 10}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\end{document}
Output
Vertical Line separating two columns
If you want to add a vertical line separating two columns, you can use columnseprule
command. The columnseprule
command in LaTeX defines the thickness and appearance of the vertical rule dividing columns in certain situations.
Here’s how you can use columnseprule
:
Use the \setlength
command within the document preamble to set a global value for the rule thickness.
\setlength{\columnseprule}{1pt} % Sets rule thickness to 1 point
For example
\documentclass[11pt]{report}
\usepackage[margin=1in]{geometry}
\usepackage[toc]{multitoc}
\setlength{\columnsep}{7mm} % Sets separation to 7 mm
\setlength{\columnseprule}{1pt} % Sets rule thickness to 1 point
\begin{document}
\tableofcontents
\chapter{Chapter 1}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 2}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 3}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 4}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 5}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 6}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 7}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 8}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 9}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\chapter{Chapter 10}
\section{Section Title}
\subsection{Subsection Title}
\subsubsection{Subsubsection Title}
\section{Section Title New}
\subsection{Subsection Title New}
\subsubsection{Subsubsection Title New}
\end{document}
Output