放入目录后无法编译

放入目录后无法编译

这是我的序言:

\documentclass[12pt]{report}
\usepackage[left=1.5in, right=1in, top=1in,bottom=1.5in]{geometry}
\usepackage{setspace}
\usepackage{amsbsy}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{textcomp}
\usepackage{lscape}
\usepackage{amsmath}
\usepackage{calc}
\usepackage[rm,tiny]{titlesec} %added this to change the chapter title's font as default regular text font.
\usepackage{titlesec}
\usepackage{sectsty}
\sectionfont{\underline\normalfont\normalsize\centering}

\newlength{\depthofsumsign}
\setlength{\depthofsumsign}{\depthof{$\sum$}}
\newlength{\totalheightofsumsign}
\newlength{\heightanddepthofargument}

\usepackage{pdflscape,booktabs}
\usepackage[flushleft]{threeparttable}
\renewcommand\TPTtagStyle{\textit} 
\usepackage[font=it,skip=0.5\baselineskip]{caption} % italic text for captions

\usepackage{titletoc}
\usepackage{hyperref}

\titlecontents{chapter}
[3pt]                                               % left margin
{}%
{\contentsmargin{0pt}                               % numbered entry format
    \thecontentslabel\enspace%
    }
{\contentsmargin{0pt}\large}                        % unnumbered entry format
{\titlerule*[.99pc]{.}\contentspage}                 % filler-page format (e.g dots)
[]                                                  % below code (e.g vertical space)


%to put page numbers as the header
\fancyhf{}
\fancyhead[C]{\thepage}
\pagestyle{fancy}

\titleformat{\chapter}{\normalfont\centering}{}{0pt}{}
\titlelabel{}

\titlespacing*{\chapter}{0pt}{-25pt}{4pt}

\titleformat{\section}{\normalfont\centering}{}{0pt}{}

%koleygr: Redefining chapter to include \thispagestyle{fancy}
\let\oldchapter\chapter
\makeatletter
\def\chapter{%
\@ifstar{\@Starred}{\@nonStarred}%
}
\def\@Starred{%
\@ifnextchar[%
{\GenericWarning{}{Warning: A starred section can not have parameters. I am going to ignore them!}\@StarredWith}%
{\@StarredWithout}%
}      
\def\@StarredWith[#1]#2{%
\oldchapter*{#2}%
\thispagestyle{fancy}
}
\def\@StarredWithout#1{
\oldchapter*{#1}%
\thispagestyle{fancy}
}
\def\@nonStarred{%
\@ifnextchar[%
{\@nonStarredWith}%
{\@nonStarredWithout}%
}
\def\@nonStarredWith[#1]#2{%
\oldchapter[#1]{#2}%
\thispagestyle{fancy}
}
\def\@nonStarredWithout#1{%
\oldchapter{#1}%
\thispagestyle{fancy}
}
\makeatother

\interfootnotelinepenalty=10000
\renewcommand{\contentsname}{TABLE OF CONTENTS}



\begin{document}

我之前也用过这套代码,效果很好。后来我想把标题“图片列表”和“表格列表”的格式改成全大写,即“图片列表”和“表格列表”。所以我用了一堆代码。在它们显示错误后,我撤消了所有操作并恢复到原始状态,但编译却停止了。

最后,我删除了\tableofcontents代码,并编译成功。但是,现在我无法添加目录。

它显示了大量错误。以下是屏幕截图: 在此处输入图片描述

对于我的目录代码,我只是使用一组普通的代码:

\tableofcontents

\pagebreak

\listoftables

\pagebreak

\listoffigures

\pagebreak

我的代码是否存在缺陷?

多谢!!

相关内容