\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\begin{document}
\tableofcontents
\section{Chapter 5}
\subsection{Section 1}
\end{document}
I am trying to create a table of contents but it comes out like this
I only want the top part to display, I don't know why it's duplicating. Also, how can I delete the numbers on the left side of the titles? And how can I set up the page number for each section and title?
Best Answer
Among other things, your document setup suffers from mis-using of the directives
\section
and\subsection
to generate headers that are labeled "chapter" and "section", respectively. To reduce the confusion that will inevitably follow, you may want to switch to thereport
document class, issue the instruction\setcounter{secnumdepth}{-1}
in the preamble, and use the directives\chapter
and\section
to generate the corresponding headers.If you do not want to have a page break between the table of contents and the first header, use the following code instead: