目录以一行继续下一页

目录以一行继续下一页

考虑这个例子:

\documentclass{report}
%% \clubpenalty=10000                                                                                                                                                                                       
%% \widowpenalty=10000                                                                                                                                                                                      

\begin{document}
\tableofcontents

\chapter{Introduction}

\chapter{Background}

\chapter{Setup}

\chapter{Methodology}

\chapter{Data}

\chapter{Statistical Selection}

\chapter{Uncertainties}

\chapter{Results}

\section{Results of methodology 1}

\section{Results of methodology 2}

\section{Results of methodology 3}

\section{Results of methodology 4}

\section{Results of methodology 5}

\section{Resuts of methodology 6}

\section{Results of methodology 7}

\section{Results of methodology 8}

\section{Results of methodology 9}

\section{Results of methodology 10}

\section{Results of methodology 11}

\section{Results of methodology 12}

\section{Results of methodology 13}

\section{Results of methodology 14}

\section{Resullts of methodology 15}

\chapter{Conclusions}

\chapter{Appendix}

\chapter{Bibliography}

\end{document}

目录中只有一行继续下一页:

在此处输入图片描述

在我取消注释这些行之后,情况也没有任何改善:

%% \clubpenalty=10000                                                                                                                                                                                       
%% \widowpenalty=10000

我根据如何防止出现孤儿线?

如何使目录更加稀疏,以便第 2 页有更多行,或者更加紧凑,以便目录不会延续到第 2 页?

答案1

只有当文档完成并且处于真正不再对文本进行更改的状态时,您才需要担心这些细节。

此时,您可能会发现第二页上不再只有“参考书目”一行。但也可能只有两行。

将一行移动到第一页很容易:添加\addtocontents{toc}{\protect\enlargethispage*{\baselineskip}}到您的文档:

\documentclass{report}

\begin{document}

\addtocontents{toc}{\protect\enlargethispage*{\baselineskip}}

\tableofcontents

\chapter{Introduction}

\chapter{Background}

\chapter{Setup}

\chapter{Methodology}

\chapter{Data}

\chapter{Statistical Selection}

\chapter{Uncertainties}

\chapter{Results}

\section{Results of methodology 1}

\section{Results of methodology 2}

\section{Results of methodology 3}

\section{Results of methodology 4}

\section{Results of methodology 5}

\section{Resuts of methodology 6}

\section{Results of methodology 7}

\newpage

\section{Results of methodology 8}

\section{Results of methodology 9}

\section{Results of methodology 10}

\section{Results of methodology 11}

\section{Results of methodology 12}

\section{Results of methodology 13}

\section{Results of methodology 14}

\section{Resullts of methodology 15}

\chapter{Conclusions}

\chapter{Appendix}

\chapter{Bibliography}

\end{document}

经过几次 LaTeX 运行后,你将获得所需的输出

在此处输入图片描述

如果目录的第二页只有两三行,那么可能无法将它们挤在第一页中,但你可以缩短第一页,在第二页中多移动几行,

\addtocontents{toc}{\protect\enlargethispage{-3\baselineskip}

或者使用不同的因素,具体取决于第一页底部的实际内容。

但我坚持认为,仅当文档处于其 最终的 状态,确实不再对文本进行任何更改。

答案2

\baselinestretch只需在附近添加此更改\tableofcontents

\begin{document} 
\renewcommand{\baselinestretch}{0.95}\normalsize 
\tableofcontents 
\renewcommand{\baselinestretch}{1.075}\normalsize

d

答案3

您可以使用包tocloft来使目录标题后的空间稍微小一点。

\usepackage{tocloft} % <================================================
\addtolength{\cftaftertoctitleskip}{-\baselineskip} % <=================

然后可以将目录完整地放在一页上,如下面的代码所示(包showframe仅用于可视化打字区域和边距):

\documentclass{report}

\usepackage{showframe} % <==============================================
\usepackage{tocloft} % <================================================
\addtolength{\cftaftertoctitleskip}{-\baselineskip} % <=================
%% \clubpenalty=10000 
%% \widowpenalty=10000


\begin{document}

%\enlargethispage{2\baselineskip} % 
\tableofcontents

\chapter{Introduction}

\chapter{Background}

\chapter{Setup}

\chapter{Methodology}

\chapter{Data}

\chapter{Statistical Selection}

\chapter{Uncertainties}

\chapter{Results}

\section{Results of methodology 1}

\section{Results of methodology 2}

\section{Results of methodology 3}

\section{Results of methodology 4}

\section{Results of methodology 5}

\section{Resuts of methodology 6}

\section{Results of methodology 7}

\section{Results of methodology 8}

\section{Results of methodology 9}

\section{Results of methodology 10}

\section{Results of methodology 11}

\section{Results of methodology 12}

\section{Results of methodology 13}

\section{Results of methodology 14}

\section{Resullts of methodology 15}

\chapter{Conclusions}

\chapter{Appendix}

\chapter{Bibliography}

\end{document} 

并给出结果:

产生的 toc

答案4

\l@chapter报告类在条目之间使用。\vskip 1.0em \@plus\p@我只是添加了一些收缩胶。

\documentclass{report}
\makeatletter
\renewcommand*\l@chapter[2]{%
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    \vskip 1.0em \@plus\p@ \@minus\p@
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\hfil
      \nobreak\hb@xt@\@pnumwidth{\hss #2%
                                 \kern-\p@\kern\p@}\par
      \penalty\@highpenalty
    \endgroup
  \fi}
\makeatother

\begin{document}
\tableofcontents

\chapter{Introduction}

\chapter{Background}

\chapter{Setup}

\chapter{Methodology}

\chapter{Data}

\chapter{Statistical Selection}

\chapter{Uncertainties}

\chapter{Results}

\section{Results of methodology 1}

\section{Results of methodology 2}

\section{Results of methodology 3}

\section{Results of methodology 4}

\section{Results of methodology 5}

\section{Resuts of methodology 6}

\section{Results of methodology 7}

\section{Results of methodology 8}

\section{Results of methodology 9}

\section{Results of methodology 10}

\section{Results of methodology 11}

\section{Results of methodology 12}

\section{Results of methodology 13}

\section{Results of methodology 14}

\section{Resullts of methodology 15}

\chapter{Conclusions}

\chapter{Appendix}

\chapter{Bibliography}

\end{document}

可以使用 etoolbox 包简化此编辑。

\usepackage{etoolbox}
\makeatletter
\patchcmd{\l@chapter}{1.0em \@plus\p@}{1.0em \@plus\p@ \@minus\p@}{}{}
\makeatother

相关内容