1

I wanted a start page with title and ToC. That part works fine, but when ToC is longer than one page, I'd prefer LaTeX to fill second page first and then continue on title page. How can I achieve that?

MWE (I want only two section in ToC on title page, rest on second):

\documentclass{article}

\usepackage[
    a4paper,
    margin=1.5cm,
    centering,
    nohead,
    includefoot
]{geometry}

\title{Example}

\begin{document}
\thispagestyle{empty}

\pagenumbering{Alph}

\begin{titlepage}
    \vspace*{\fill}
    \begin{center}
        \makeatletter
        \huge
        \@title
        \makeatother
    \end{center}
    \vspace*{\fill}
    \tableofcontents{
        \thispagestyle{empty}
    }
\end{titlepage}

\newpage

\pagenumbering{arabic}
\setcounter{page}{1}

\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}
\section{Test section}

\end{document}
0

This looks like a job for \vsplit!

I had to add a few more sections; otherwise the whole TOC would fit on the second page. I added some glue to \baselineskip in order to get rid of the gap at the bottom of page 2.

\documentclass{article}

\usepackage[
    a4paper,
    margin=1.5cm,
    centering,
    nohead,
    includefoot,
    showframe
]{geometry}

\title{Example}

\begin{document}
\pagenumbering{Alph}

\newsavebox{\tempbox}

\begin{titlepage}
    \vspace*{\fill}
    \begin{center}
        \makeatletter
        \huge
        \@title
        \makeatother
    \end{center}
    \vfill
    \advance\baselineskip by 0pt plus 1pt minus .5pt
    \setbox0=\vbox{\tableofcontents}%
    \setbox1=\vsplit0 to \dimexpr \ht0-\textheight\relax
    \box1
    \pagebreak
    \thispagestyle{empty}
    \unvbox0
\end{titlepage}

\pagenumbering{arabic}
\setcounter{page}{1}

\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode
\section{Test section}\leavevmode

\end{document}
  • So no easy automatic way? For more pages I add more \vsplit? – j000 Feb 20 '18 at 1:08
  • You could do it with a couple of loops, The first loop to determine how may pages, and the second to split off the pages. – John Kormylo Feb 20 '18 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.