目录中出现过满 \vbox 警告,目录不会换到新页面

目录中出现过满 \vbox 警告,目录不会换到新页面

我在目录中遇到了 \vbox 过满的问题。如下图所示,页脚处有覆盖。我收到的警告是:“\output 处于活动状态时,\vbox 过满(188.96039pt 太高)。”理想情况下,目录中的所有信息应放在两页中​​,但我得到的是第一页空白页,上面只有页码,第二页就是我在图中显示的那页。我使用的是 xelatex。
在此处输入图片描述 这是我的完整 cls:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{UniThesis}[]
% This document class is based on the 'book' document class
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessOptions
\LoadClass[oneside]{book}
% ============================================================================
% REQUIRED PACKAGES
% ============================================================================
\usepackage[plainpages=false,pdfpagelabels,hidelinks,breaklinks=true]{hyperref} % Get nice PDF document links 
%\expandafter\def\expandafter\UrlBreaks\expandafter{\UrlBreaks\do\-}

\usepackage[a4paper, top=4cm,bottom=2.5cm,right=2.5cm,left=4cm, headheight=15pt]{geometry}      % Easily set margins
\usepackage[toc,title,page]{appendix}                 % Configure appendix formatting
\usepackage{tocloft}                                  % Configure ToC Lo{F,T} formatting
\usepackage{indentfirst}                              % Always indent first paragraph
\usepackage{fancyhdr}                                 % Control header, footer position
\usepackage{graphicx}                                 % Include figures
\usepackage{setspace}                                 % Control spacing
%\usepackage[latin1]{inputenc}                         % Coding latin1
\usepackage[spanish]{babel}                           % Spanish languaje
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{mathtools, bbm}
\DeclareMathOperator*{\argmin}{\arg\!\min}
\newcommand{\me}{\mathrm{e}}

\usepackage{fontspec}
\setmainfont{Times New Roman}
\usepackage{lmodern}
% \usepackage[svgpath=./Images/]{svg}
\usepackage{color}                                    % Manage colors
\usepackage{breakcites}                               % Break citation reference
\usepackage[font=small,labelfont=bf,justification=centering]{caption} % Customize caption of tables or figures
\usepackage{multirow}                                 % Allow multirow tables
\usepackage{float}                                    % Exact location of figures Here
\usepackage{enumerate}                                % Set item kind (I),(a),(A),...
\usepackage{subcaption}                               % Subcaption of subtables or subfigures
\usepackage{etoolbox} 
\usepackage{titlesec}

\usepackage{amsmath}
%\usepackage{appendix} 
% ============================================================================
% NEW COMMANDS AND ENVIRONMENTS
% ============================================================================
% redefine plain to delete page number
\newcommand{\hackplain}{\fancypagestyle{plain}{%
    \fancyhf{} % clear all header and footer fields
    \fancyhead[R]{\thepage}
}}

\renewcommand{\appendixpagename}{Apéndice}  % appendix name
\appto\frontmatter{\pagestyle{plain}}       % pagestyle frontmatter
\appto\mainmatter{\pagestyle{fancy}}        % pagestyle mainmatter
\appto\backmatter{\pagestyle{fancy}}        % pagestyle backmatter

%\renewcommand{\bibsetup}{\thispagestyle{empty}} % not number first page bibliography

% Environment to make a fancy dedication in the thesis
\newenvironment{dedication}{\phantom{}\begin{flushright}\begin{em}\begin{minipage}{0.5\textwidth}\raggedleft}{\end{minipage}\end{em}\end{flushright}}

% Environment to make a list without indentation
\newcounter{mycounter}
\newenvironment{noindlist}
 {\begin{list}{\arabic{mycounter}.~~}{\usecounter{mycounter} \labelsep=0em \labelwidth=0em \leftmargin=0em \itemindent=0em}}
 {\end{list}}

% A command to control the line spacing
\newcommand{\newlinestretch}[1]{\renewcommand{\baselinestretch}{#1}\normalsize}

% Input the specified file, and add a \clearpage afterwards
\newcommand{\inputfile}[1]{
    \input{#1} \clearpage
}


\newcommand{\addtotoc}[2]{
    \phantomsection
    \addcontentsline{toc}{chapter}{#1}
    #2 \clearpage
}


\addto\captionsspanish{ \renewcommand\contentsname{TABLA DE CONTENIDOS} }
\addto\captionsspanish{ \renewcommand\listfigurename{LISTA DE FIGURAS} }
\addto\captionsspanish{ \renewcommand\listtablename{LISTA DE TABLAS} }
\addto\captionsspanish{\renewcommand\bibname{BIBLIOGRAFÍA}}
\addto\captionsspanish{\renewcommand\tablename{Tabla}}

\renewcommand\cfttoctitlefont{\hfill\large\bfseries}
\renewcommand\cftaftertoctitle{\hfill\mbox{}}
\renewcommand\cftloftitlefont{\hfill\large\bfseries}
\renewcommand\cftafterloftitle{\hfill\mbox{}}
\renewcommand\cftlottitlefont{\hfill\large\bfseries}
\renewcommand\cftafterlottitle{\hfill\mbox{}}


\usepackage{titletoc}
\titlecontents{chapter}[0mm]{\addvspace{1em}}{\bfseries \MakeUppercase{\chaptername} \ \thecontentslabel .\\ \quad}{\bfseries}{\bfseries\hfill\contentspage}

\titlecontents{section}[0mm]{}{\thecontentslabel. \ }{}{\ \normalsize\titlerule*[5pt]{.}\contentspage}

\titlecontents{subsection}[5pt]{}{\thecontentslabel. \ }{}{\ \normalsize\titlerule*[5pt]{.} \contentspage}
%\titlecontents{subsubsection}[22mm]{}{\thecontentslabel. \ }{}{\ \normalsize\titlerule*[5pt]{.} \contentspage}

% ============================================================================
% ADDITIONAL PARAMETERS
% ============================================================================
%\usepackage[letterspace=0]{microtype}

\titleformat{\chapter}[display]{ \bfseries \large }{\centering CAPÍTULO \ \thechapter }{0ex}{\centering }[\bigskip \bigskip \bigskip]
\titlespacing{\chapter}{0cm}{0cm}{0cm}

\titleformat{\section}{ \normalsize \singlespacing \bfseries}{\thesection .}{2ex}{}
\titlespacing{\section}{0cm}{0cm}{0cm}

\titleformat{\subsection}{\normalsize \singlespacing \bfseries}{\thesubsection .}{2ex}{}
\titlespacing{\subsection}{0cm}{0cm}{0cm}

\titleformat{\subsubsection}{\normalsize \singlespacing \bfseries}{\thesubsubsection .}{2ex}{}
\titlespacing{\subsubsection}{0cm}{0cm}{0cm}


% Set paragraph indention to 0.5 inches
\setlength{\parindent}{0.5in}

% Make the ToC only show Chapters and Sections
\setcounter{tocdepth}{2}

% Make subsections get numbered
\setcounter{secnumdepth}{3}

% Setup the page format.  All headers are empty.  The center footer
% contains the page number.  Also, remove the headrule from all pages.
% Finally, use the 'fancy' page style (which uses all the things we
% just setup).
\lhead{\empty}
\chead{\empty}
\rhead{\thepage}
\lfoot{\empty}
\cfoot{\empty}
\rfoot{\empty}
\pagestyle{fancy}
%\fancyhf{}
%\fancyhead[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}

% Set the appendix to just have a letter not prepended by the main division
% number in the ToC (see the documentation for the 'appendix' package)
\renewcommand{\setthesection}{\Alph{section}}

% Setup the ToC and List of {Tables|Figures|Whatever} to
% include the ellipses between the name and the page number.  Also make
% the page number big enough so that three digit numbers can be used.
\DeclareRobustCommand{\changetochap}{%
    \renewcommand{\cftchapleader}{\cftchapfont\cftdotfill{\cftdotsep}}%
    \cftsetpnumwidth{1.5em}
%    \newgeometry{top=4cm,bottom=2.5cm,right=2.5cm,left=4cm}
}
\changetochap

% Do not enumerate page appendix title
\makeatletter
\patchcmd{\@chap@pppage}{\thispagestyle{plain}}{\thispagestyle{empty}}{}{}
\makeatother

为了制作自定义目录,我使用以下几行:

\usepackage{titletoc}
    \titlecontents{chapter}[0mm]{\addvspace{1em}}{\bfseries \MakeUppercase{\chaptername} \ \thecontentslabel .\\ \quad}{\bfseries}{\bfseries\hfill\contentspage}

    \titlecontents{section}[0mm]{}{\thecontentslabel. \ }{}{\ \normalsize\titlerule*[5pt]{.}\contentspage}

    \titlecontents{subsection}[10mm]{}{\thecontentslabel. \ }{}{\ \normalsize\titlerule*[5pt]{.} \contentspage}

当我删除子节或节中的一行时,警告消失了,但显然我丢失了我需要的格式。我不知道为什么会发生这种情况,希望你能帮助我!

编辑: 根据评论中所建议的,我已经编辑了我的主文件,以便可以重现它:

\documentclass[12pt,a4paper,onecolumn]{UniThesis}
\usepackage{blindtext}

\begin{document}

    \frontmatter 
    \singlespacing               
    \setcounter{page}{1}
    \addtocontents{toc}{\protect\thispagestyle{fancy}}
    \addtocontents{toc}{\protect\pagestyle{fancy}}
    \tableofcontents \thispagestyle{fancy}\clearpage

    \mainmatter 

    \doublespacing 
    \input{randomtext.tex}\clearpage
    \input{randomtext.tex}\clearpage
    \input{randomtext.tex}\clearpage
    \input{randomtext.tex}\clearpage


\end{document}

其中 randomtext.tex 是:

\chapter{CHAPTER X}
\thispagestyle{empty}
\section{SECTION 1}
\blindtext[0]
\subsection{SUBSECTION 1}
\blindtext[0]
\subsection{SUBSECTION 2}
\blindtext[0]
\subsection{SUBSECTION 3}
\blindtext[0]
\section{SECTION 2}
\blindtext[0]
\subsection{SUBSECTION 1}
\blindtext[0]
\subsubsection{SUBSUBSECTION 1}
\blindtext[0]
\subsection{SUBSECTION 2}
\blindtext[0]
\subsection{SUBSECTION 3}
\blindtext[0]

编辑2: 我得到的.toc 文件如下:

\select@language {spanish}
\thispagestyle {fancy}
\pagestyle {fancy}
\contentsline {chapter}{\numberline {1}CHAPTER X}{1}{chapter.1}
\contentsline {section}{\numberline {1.1}SECTION 1}{1}{section.1.1}
\contentsline {subsection}{\numberline {1.1.1}SUBSECTION 1}{1}{subsection.1.1.1}
\contentsline {subsection}{\numberline {1.1.2}SUBSECTION 2}{2}{subsection.1.1.2}
\contentsline {subsection}{\numberline {1.1.3}SUBSECTION 3}{2}{subsection.1.1.3}
\contentsline {section}{\numberline {1.2}SECTION 2}{2}{section.1.2}
\contentsline {subsection}{\numberline {1.2.1}SUBSECTION 1}{3}{subsection.1.2.1}
\contentsline {subsubsection}{\numberline {1.2.1.1}SUBSUBSECTION 1}{3}{subsubsection.1.2.1.1}
\contentsline {subsection}{\numberline {1.2.2}SUBSECTION 2}{4}{subsection.1.2.2}
\contentsline {subsection}{\numberline {1.2.3}SUBSECTION 3}{4}{subsection.1.2.3}
\contentsline {chapter}{\numberline {2}CHAPTER X}{5}{chapter.2}
\contentsline {section}{\numberline {2.1}SECTION 1}{5}{section.2.1}
\contentsline {subsection}{\numberline {2.1.1}SUBSECTION 1}{5}{subsection.2.1.1}
\contentsline {subsection}{\numberline {2.1.2}SUBSECTION 2}{6}{subsection.2.1.2}
\contentsline {subsection}{\numberline {2.1.3}SUBSECTION 3}{6}{subsection.2.1.3}
\contentsline {section}{\numberline {2.2}SECTION 2}{6}{section.2.2}
\contentsline {subsection}{\numberline {2.2.1}SUBSECTION 1}{7}{subsection.2.2.1}
\contentsline {subsubsection}{\numberline {2.2.1.1}SUBSUBSECTION 1}{7}{subsubsection.2.2.1.1}
\contentsline {subsection}{\numberline {2.2.2}SUBSECTION 2}{8}{subsection.2.2.2}
\contentsline {subsection}{\numberline {2.2.3}SUBSECTION 3}{8}{subsection.2.2.3}
\contentsline {chapter}{\numberline {3}CHAPTER X}{9}{chapter.3}
\contentsline {section}{\numberline {3.1}SECTION 1}{9}{section.3.1}
\contentsline {subsection}{\numberline {3.1.1}SUBSECTION 1}{9}{subsection.3.1.1}
\contentsline {subsection}{\numberline {3.1.2}SUBSECTION 2}{10}{subsection.3.1.2}
\contentsline {subsection}{\numberline {3.1.3}SUBSECTION 3}{10}{subsection.3.1.3}
\contentsline {section}{\numberline {3.2}SECTION 2}{10}{section.3.2}
\contentsline {subsection}{\numberline {3.2.1}SUBSECTION 1}{11}{subsection.3.2.1}
\contentsline {subsubsection}{\numberline {3.2.1.1}SUBSUBSECTION 1}{11}{subsubsection.3.2.1.1}
\contentsline {subsection}{\numberline {3.2.2}SUBSECTION 2}{12}{subsection.3.2.2}
\contentsline {subsection}{\numberline {3.2.3}SUBSECTION 3}{12}{subsection.3.2.3}
\contentsline {chapter}{\numberline {4}CHAPTER X}{13}{chapter.4}
\contentsline {section}{\numberline {4.1}SECTION 1}{13}{section.4.1}
\contentsline {subsection}{\numberline {4.1.1}SUBSECTION 1}{13}{subsection.4.1.1}
\contentsline {subsection}{\numberline {4.1.2}SUBSECTION 2}{14}{subsection.4.1.2}
\contentsline {subsection}{\numberline {4.1.3}SUBSECTION 3}{14}{subsection.4.1.3}
\contentsline {section}{\numberline {4.2}SECTION 2}{14}{section.4.2}
\contentsline {subsection}{\numberline {4.2.1}SUBSECTION 1}{15}{subsection.4.2.1}
\contentsline {subsubsection}{\numberline {4.2.1.1}SUBSUBSECTION 1}{15}{subsubsection.4.2.1.1}
\contentsline {subsection}{\numberline {4.2.2}SUBSECTION 2}{16}{subsection.4.2.2}
\contentsline {subsection}{\numberline {4.2.3}SUBSECTION 3}{16}{subsection.4.2.3}
\contentsfinish 

答案1

您正在使用titlesectocloft titletoc在同一个类文件中。你应该包括选项titles正在加载tocloft

比较 MWE(顺便说一句,你的 MWE 并不是最小的)

\documentclass{book}
\usepackage{tocloft}
\usepackage{setspace}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{blindtext}

\titlecontents{chapter}[0mm]{\addvspace{1em}}{\bfseries \MakeUppercase{\chaptername} \ \thecontentslabel .\\ \quad}{\bfseries}{\bfseries\hfill\contentspage}

\titlecontents{section}[0mm]{}{\thecontentslabel. \ }{}{\ \normalsize\titlerule*[5pt]{.}\contentspage}

\titlecontents{subsection}[5pt]{}{\thecontentslabel. \ }{}{\ \normalsize\titlerule*[5pt]{.} \contentspage}

\titleformat{\chapter}[display]{ \bfseries \large }{\centering CAPÍTULO \ \thechapter }{0ex}{\centering }[\bigskip \bigskip \bigskip]
\titlespacing{\chapter}{0cm}{0cm}{0cm}

\titleformat{\section}{ \normalsize \singlespacing \bfseries}{\thesection .}{2ex}{}
\titlespacing{\section}{0cm}{0cm}{0cm}

\titleformat{\subsection}{\normalsize \singlespacing \bfseries}{\thesubsection .}{2ex}{}
\titlespacing{\subsection}{0cm}{0cm}{0cm}

\titleformat{\subsubsection}{\normalsize \singlespacing \bfseries}{\thesubsubsection .}{2ex}{}
\titlespacing{\subsubsection}{0cm}{0cm}{0cm}


\DeclareRobustCommand{\changetochap}{%
    \renewcommand{\cftchapleader}{\cftchapfont\cftdotfill{\cftdotsep}}%
    \cftsetpnumwidth{1.5em}
}
\changetochap

\begin{document}

\tableofcontents

\input{randomtext.tex}\clearpage
\input{randomtext.tex}\clearpage
\input{randomtext.tex}\clearpage
\input{randomtext.tex}\clearpage
\input{randomtext.tex}\clearpage
\input{randomtext.tex}\clearpage

\end{document}

版本中第二行被替换为

\usepackage[titles]{tocloft}

相关内容