目录缩进/间距问题

目录缩进/间距问题

我正在使用我所在机构的模板撰写论文。我的工作代码如下:

\makeatletter
\let\my@xfloat\@xfloat
\makeatother

\documentclass[oneside,12pt,a4paper]{book}
%\documentclass[12pt,a4paper]{book}
\usepackage{UTMThesis, enumerate, amsfonts, longtable, qtree, etoolbox, array, rotating, pgf, tikz, tikz-cd, algorithm, csquotes}

\makeatletter
\def\@xfloat#1[#2]{
    \my@xfloat#1[#2]%
    \def\baselinestretch{1}%
    \@normalsize \normalsize
}
\makeatother

\allowdisplaybreaks
\usetikzlibrary{arrows, matrix, positioning, shapes, shapes.geometric, calc, intersections, decorations.pathreplacing}
\newcommand{\tikznode}[2]{\relax
    \ifmmode%
    \tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {$#2$};
    \else
    \tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {#2};%
    \fi}
\let\openbox\relax
\let\iint\relax
\let\iiint\relax
\let\iiiint\relax
\let\idotsint\relax

\newcommand*{\qed}{\hfill\ensuremath{\square}}

%-------------------------------------------------------------
\usepackage{cite}                       % change  cite from [1,2,3] to [1-3] etc for number system
\makeatletter                           % change from
  \renewcommand{\@biblabel}[1]{#1.}     % [1] to 1. etc 
\makeatother                            % in list of references
%-----------------------------------------------------------
  \setlength{\voffset}{-2.1cm}
  \setlength{\hoffset}{-.4cm}  
%--------------------------------------------------------
\font\fiverm=cmr5 
%\input{Pictex.tex} % using pictex
%---------------------------------------------------------
%\pagestyle{plain}
%-------------------------------------------------------
  \usepackage{fancyhdr}
  \pagestyle{fancy}
  \lhead{}
  \chead{}
  \rhead{}
  \lfoot{}  
  \cfoot{\vspace{-.35cm}\thepage}  % 
  \rfoot{} 
  \renewcommand{\headrulewidth}{0pt}
%-------------------------------------------------------
\begin{document}
\frontmatter

\chapter*{TABLE OF CONTENTS}

\addcontentsline{toc}{section}{\textbf{TABLE OF CONTENTS}}
\contentsline{toc}{\hspace{-1.3cm}\phantom{\textbf{CHAPTER}}\hfill
    \textbf{TITLE}\hspace{1.1cm}}\hfill {\textbf{PAGE\,\,}}

{\setlength{\parskip}{.25cm}
    \setlength{\baselineskip}{.5cm}
    
    \contentsline {chapter}{\numberline {\hspace {-.9cm}CHAPTER 1}\hspace{1cm}THIS IS A VERY LONG LONG LONG LONG LONG LONG TITLE}{1}
    \contentsline {section}{\numberline {\hspace {-.175in}1.1\hspace {.12in}}Background Problem}{1}

\backmatter
\end{document}

产生:

在此处输入图片描述

我希望它看起来像这样:

在此处输入图片描述

换句话说,非常长的标题的间距必须固定。但我不知道该怎么做。请帮忙。

答案1

我必须承认,我不喜欢贵机构的模板,无论它是什么。尝试以下方法,看看它是否能产生您想要的效果。

% thesistocprob.tex  SE 581226

\makeatletter
\let\my@xfloat\@xfloat
\makeatother

\documentclass[oneside,12pt,a4paper]{book}
%\documentclass[12pt,a4paper]{book}

\usepackage{comment}

%\usepackage{UTMThesis, enumerate, amsfonts, longtable, qtree, etoolbox, array, rotating, pgf, tikz, tikz-cd, algorithm, csquotes}

\makeatletter
\def\@xfloat#1[#2]{
    \my@xfloat#1[#2]%
    \def\baselinestretch{1}%
    \@normalsize \normalsize
}
\makeatother

\begin{comment}
\allowdisplaybreaks
\usetikzlibrary{arrows, matrix, positioning, shapes, shapes.geometric, calc, intersections, decorations.pathreplacing}
\newcommand{\tikznode}[2]{\relax
    \ifmmode%
    \tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {$#2$};
    \else
    \tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {#2};%
    \fi}
\let\openbox\relax
\let\iint\relax
\let\iiint\relax
\let\iiiint\relax
\let\idotsint\relax
\end{comment}

\newcommand*{\qed}{\hfill\ensuremath{\square}}

%-------------------------------------------------------------
\usepackage{cite}                       % change  cite from [1,2,3] to [1-3] etc for number system
\makeatletter                           % change from
  \renewcommand{\@biblabel}[1]{#1.}     % [1] to 1. etc 
\makeatother                            % in list of references
%-----------------------------------------------------------
  \setlength{\voffset}{-2.1cm}
  \setlength{\hoffset}{-.4cm}  
%--------------------------------------------------------
\font\fiverm=cmr5 
%\input{Pictex.tex} % using pictex
%---------------------------------------------------------
%\pagestyle{plain}
%-------------------------------------------------------
  \usepackage{fancyhdr}
  \pagestyle{fancy}
  \lhead{}
  \chead{}
  \rhead{}
  \lfoot{}  
  \cfoot{\vspace{-.35cm}\thepage}  % 
  \rfoot{} 
  \renewcommand{\headrulewidth}{0pt}
%-------------------------------------------------------

\usepackage{tocloft}
\renewcommand{\cftchappresnum}{\textbf{CHAPTER }}
\setlength{\cftchapnumwidth}{3cm}
\renewcommand{\contentsname}{TABLE OF CONTENTS}

\begin{document}
\frontmatter

\addtocontents{toc}{\textbf{CHAPTER} \hfill \textbf{TITLE} \hfill \textbf{PAGE} \par}
%\chapter*{TABLE OF CONTENTS}
\addcontentsline{toc}{section}{\contentsname}
\tableofcontents

\begin{comment}
\addcontentsline{toc}{section}{\textbf{TABLE OF CONTENTS}}
\contentsline{toc}{\hspace{-1.3cm}\phantom{\textbf{CHAPTER}}\hfill
    \textbf{TITLE}\hspace{1.1cm}}\hfill {\textbf{PAGE\,\,}}
\end{comment}

\setlength{\parskip}{.25cm}
    \setlength{\baselineskip}{.5cm}
\begin{comment}    
%    \contentsline {chapter}{\numberline {\hspace {-.9cm}CHAPTER 1}\hspace{1cm}THIS IS A VERY LONG LONG LONG LONG LONG LONG TITLE}{1}
    \contentsline {chapter}{\numberline {CHAPTER 1}\hspace{2.5cm}THIS IS A VERY LONG LONG LONG LONG LONG LONG TITLE}{1}
    \contentsline {section}{\numberline {\hspace {-.175in}1.1\hspace {.12in}}Background Problem}{1}
\end{comment}
\mainmatter

\chapter{THIS IS A VERY LONG LONG LONG LONG LONG LONG TITLE}
\section{Background Problem}

\backmatter
\end{document}

这是您的 MWE 的大量修订版本,但总体上遵循了通常的 LaTeX 样式。它使用常规的 LaTeX \chapter,与您的 MWE 不同,但使用tocloft包来获取 ToC,我认为您的模板需要它。

相关内容