0
\documentclass[a4paper]{article}

\title{Hello}

\begin{document}

\maketitle
\tableofcontents % I want to make the title and the TOC on the same page

\section{Section}
\subsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}

\section{Section}
\subsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}

\section{Section}
\subsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}

\section{Section}
\subsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}

\section{Section}
\subsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}
\subsubsection{SubSection}

\end{document}

I want to make the title and the TOC on the same page, but there are two problems:

The first problem is the page numbers are wrong.

The second problem is the wrong page layout showed in the following screenshot:

enter image description here

enter image description here

What's the root cause?

xmllmx
  • 871
  • 3
    LaTeX does not allow a page break after a section heading, put some text even if just \mbox{} in your sections. This is a duplicate I'll find the older question.... – David Carlisle Apr 04 '15 at 21:27
  • @DavidCarlisle, +1, Why are the page numbering still wrong even if the page layout is ok? – xmllmx Apr 04 '15 at 21:31
  • @xmllmx What's wrong with the page numbers? If I run your MWE I get exactly what I'd expect: TOC on pages 1/2, content on page 3. – Joseph Wright Apr 04 '15 at 21:33
  • They are not wrong. In what way do you think they are I get all sections on page 3, and that shows in the toc. – David Carlisle Apr 04 '15 at 21:33
  • @DavidCarlisle, The TOC shows Section 1 is on page 1, but it is actually on page 3. Please see my second picture. – xmllmx Apr 04 '15 at 21:37
  • 2
    run latex again, the section was on page 1 until the table of contents was generated on the second run. so will not show 3 until the third run – David Carlisle Apr 04 '15 at 21:39
  • @DavidCarlisle, I run xelatex three times, it's OK now! Thank you very much. It should require THREE times!!! – xmllmx Apr 04 '15 at 21:41
  • twice is not enough, as I said. – David Carlisle Apr 04 '15 at 21:43

0 Answers0