将多页目录刷新至底部

将多页目录刷新至底部

我想要一个带有标题和目录的起始页。这部分工作正常,但当目录超过一页时,我希望 LaTeX 先填充第二页,然后继续填充标题页。我该如何实现?

MWE(我只希望标题页的目录中有两个部分,其余部分放在第二页):

\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}

答案1

这看起来像是一个工作\vsplit

我必须添加更多部分;否则整个目录将适合第二页。我添加了一些胶水,\baselineskip以便消除第二页底部的间隙。

\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}

相关内容