I just want a table of contents with two columns by the etoc
package. But the following code typesets two TOCs (please see the attached figure). Why? What's wrong with my code?
Code:
\documentclass{article}
\usepackage{etoc}
\usepackage{geometry}
\geometry{showframe}
\geometry{left=1cm,right=1cm,top=1cm,bottom=1cm}
\parindent0pt
\begin{document}
\etocmulticol{}%
\tableofcontents
\section{first}
\subsection{subfirst}
\section{second}
\subsection{subsecond}
\section{third}
\subsection{subthird}
\section{fourth}
\subsection{subfourth}
\section{fifth}
\end{document}
\etocmulticol{}
gives you the two-column ToC and\tableofcontents
gives you the single-column ToC. You call both macros and therefore you get two ToCs. If you only want the two-column ToC, you need to delete\tableofcontents
.\etocmulticol
is only for set not for typeset!