章节包含在图表列表中的问题

章节包含在图表列表中的问题

本周早些时候,我正在编辑目录,多亏了这个论坛,我才能够完成大部分格式设置。这篇文章仍然是关于目录的,但现在是关于一个相当奇怪的事件。在我提交修改后的论文后,审阅者指出整个目录应该有双倍行距。此外,目录应该在致谢之后,然后是表格列表、图表列表,然后是章节。我还使用了 UNT 样式文件,我对此进行了略微修改。在下面的 MWE 中,我能够完成大部分工作:

\documentclass[12pt, titlepage, openany]{amsbook}


\makeatletter
\renewcommand\tocchapter[3]{%
\indentlabel{\@ifnotempty{#2}{\ignorespaces#2.\quad}}#3%
}
\makeatother

\makeatletter
\def\@tocline#1#2#3#4#5#6#7{\relax
\ifnum #1>\c@tocdepth % then omit
\else
\par \addpenalty\@secpenalty\addvspace{#2}%
\begingroup \hyphenpenalty\@M
\@ifempty{#4}{%
  \@tempdima\csname r@tocindent\number#1\endcsname\relax
}{%
  \@tempdima#4\relax
}%
\parindent\z@ \leftskip#3\relax \advance\leftskip\@tempdima\relax
\rightskip\@pnumwidth plus4em \parfillskip-\@pnumwidth
#5\leavevmode\hskip-\@tempdima #6\nobreak\relax
\ifnum#1<0\hfill\else\dotfill\fi\hbox to\@pnumwidth{\@tocpagenum{#7}}\par
\nobreak
\endgroup
\fi}
\makeatother

\makeatletter
\DeclareRobustCommand{\l@specialchapter}{%
\let\@tocpagenum\@gobble
\@tocline{-1}{8pt plus 1pt}{0pt}{}{}}
\makeatother

\usepackage{amsmath, setspace, fancyhdr, times, graphicx}
\usepackage{lipsum}

\begin{document}

\addcontentsline{toc}{chapter}{TABLE OF CONTENTS}%\dotfill}
\doublespacing

\tableofcontents


\begin{doublespace}
\listoftables
\end{doublespace}
\begin{doublespace}
\listoffigures
\end{doublespace}

\makeatletter
\addtocontents{toc}{\begingroup
\let\protect\l@chapter\l@specialchapter}
\addcontentsline{toc}{chapter}{CHAPTER}
\addtocontents{toc}{\endgroup}
\makeatother

\mainmatter

\begin{doublespace}
\chapter{..} \lipsum[1-20] %This is the chapter that gets placed in LoF
\chapter{..} \lipsum[1-20]
\chapter{..} \lipsum[1-20]
\chapter{..} \lipsum[1-20]
\chapter{..} \lipsum[1-20]
\end{doublespace}

\end{document}

我很抱歉包含了这么多内容,但目录如下:

在此处输入图片描述

虽然我觉得我快完成了,但新问题中第一章被包含在图表列表中,这不太好。我尝试移动表格/图表列表的位置,但单词 CHAPTER 也被移动了,这是不可接受的。此外,双倍间距命令似乎对目录不起作用。

有办法解决这个问题吗?任何帮助都会得到深深的、最真诚的感谢。提前致谢。

更新

因此,我一直在努力纠正这个章节放错位置的问题,我注意到了以下情况:如果我使用 \include{...} 命令调用我编写的 .tex 文件,那么似乎只有第一个文件会包含在图表列表中,原因不明(我使用 \include{chapter1}, ... , \include{chapter5})。我试图从上面的 MWE 开始对问题进行逆向工程,这让我注意到了这一点。我也试图创建一个空章节,但无济于事。此时,似乎 LaTeX 对我来说已经失控了。如果有人有想法或能想出解决方案,请告诉我,因为这将帮助我完成我正在撰写的这篇论文。此外,我很乐意发送这些文件的副本,以便人们可以进一步调查/查看发生了什么。感谢您的时间。

答案1

一种快速的解决方法是删除以下几行

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\addtocontents{toc}{\begingroup
  \let\protect\l@chapter\l@specialchapter}
\addcontentsline{toc}{chapter}{CHAPTER}
\addtocontents{toc}{\endgroup}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

在您的主 tex 文件中JamilVThesis.tex并将它们添加为文件的第一行chapter1.tex

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\addtocontents{toc}{\begingroup
  \let\protect\l@chapter\l@specialchapter}
\addcontentsline{toc}{chapter}{CHAPTER}
\addtocontents{toc}{\endgroup}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Background Information}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

然后你就会得到想要的结果:

在此处输入图片描述

现在可以将文本Chapter添加到目录中其所属的位置,即章节前面...

相关内容