2

I want my table of contents to be displayed in two halves side by side on the same page, what am I supposed to do?

SK Dash
  • 135

2 Answers2

3

A way with multicol package:

\documentclass{article}
\usepackage{multicol}
\begin{document}
\begingroup% In order to make local the \columnsep change bellow
% As @Mico suggested you may handle the separation space of the columns
% by un-commenting the next line:
%\setlength\columnsep{20pt}
\begin{multicols}{2}
\tableofcontents
\end{multicols}
\endgroup
\part{part A}
\section{Test A}
Test
\section{Test B}

\subsection{Test BA}
\subsection{Test BB}
\section{Test C}
\section{Text D}
\part{part B}
\section{Test A}
Test
\section{Test B}

\subsection{Test BA}
\subsection{Test BB}
\section{Test C}
\section{Text D}
\part{part C}
\section{Test A}
Test
\section{Test B}

\subsection{Test BA}
\subsection{Test BB}
\section{Test C}
\section{Text D}
\part{part D}
\section{Test A}
Test
\section{Test B}

\subsection{Test BA}
\subsection{Test BB}
\section{Test C}
\section{Text D}
\end{document}

Output:

enter image description here

koleygr
  • 20,105
  • Also see this post that allows many many things in customizing any "table of ...": https://tex.stackexchange.com/a/503458/120578 – koleygr Nov 09 '19 at 08:27
  • 2
    +1. You may want to add a comment to point out that if the OP wants to increase the horizontal distance between the columns, he/she can do so by changing the value of the length parameter \columsep; e.g., \setlength\columnsep{20pt}. (The default value of the parameter in most document classes is 10pt.) – Mico Nov 09 '19 at 08:40
  • Thanks @Mico ... Added your comment's suggestion in the code given. – koleygr Nov 09 '19 at 08:56
1

The tocloft and multicol package help with this.

\documentclass{...}
\usepackage{tocloft}
\usepackage{multicol}
% twocolumn ToC
\renewcommand{\cfttocprehook{\begin{multicols}{2}}
\renewcommand{\cfttocposthook}{\end{multicols}}
% twocolumn LoF (if required)
 \renewcommand{\cftlofprehook{\begin{multicols}{2}}
 \renewcommand{\cftlofposthook}{\end{multicols}}
% twocolumn LoT (if required)
 \renewcommand{\cftlotprehook{\begin{multicols}{2}}
 \renewcommand{\cftlotposthook}{\end{multicols}}

\begin{document}
\tableofcontents % in twocolumn
\listoffigures   % in twocolumn if \cftlofp... renewed 
\listoftables    % in twocolumn if \cftlotp... renewed
% etc
\end{document}
Peter Wilson
  • 28,066