# table of contents in second page, title in the first

I am trying to write title in first page, and after table of contents:

\documentclass{article}

\begin{document}

\title{My Title}
\author{My Name}

\newpage

\tableofcontents

\section{Installation}
aaaaaaaaaaaa
\subsection{Getting started}
\subsection{Jamaican rice rat}
\subsection{White-footed rabbit-rat}

\section{Butterflies}
\subsection{Nymphalidae}
\subsection{Lycaenidae}
\subsection{Uraniidae}

\end{document}


but it displays only one page with table of contents

• What document class are you using? If you are using book, just add \maketitle before \tableofcontents. – user156344 Apr 2 '19 at 7:54
• I'm using \documentclass{article} – Codey Apr 2 '19 at 7:54
• How do you want the title page to look like? – user156344 Apr 2 '19 at 7:55
• @JouleV After I added \maketitle it works, please post as answer – Codey Apr 2 '19 at 7:56
• I added an answer. – user156344 Apr 2 '19 at 8:05

You just have to add \maketitle before \newpage. This command will generate the title.

\documentclass{article}
\begin{document}
\title{My Title}
\author{My Name}
\maketitle
\newpage
\tableofcontents
\section{Installation}
aaaaaaaaaaaa
\subsection{Getting started}
\subsection{Jamaican rice rat}
\subsection{White-footed rabbit-rat}
\section{Butterflies}
\subsection{Nymphalidae}
\subsection{Lycaenidae}
\subsection{Uraniidae}
\end{document}


However, IMHO you should not use \newpage in this case. article already provides titlepage option.

\documentclass[titlepage]{article}
\begin{document}
\title{My Title}
\author{My Name}
\maketitle
\tableofcontents
\section{Installation}
aaaaaaaaaaaa
\subsection{Getting started}
\subsection{Jamaican rice rat}
\subsection{White-footed rabbit-rat}
\section{Butterflies}
\subsection{Nymphalidae}
\subsection{Lycaenidae}
\subsection{Uraniidae}
\end{document}


and the title page is much nicer

For more customization, you can use titlepage environment.