目录中的长章节标题采用单倍行距,不同章节标题之间采用双倍行距

目录中的长章节标题采用单倍行距,不同章节标题之间采用双倍行距

我正在通过该软件包为我的论文准备目录titletoc。具体来说,我有一个很长的章节标题,它延伸到多行,并且是双倍行距。但是,我需要它们是单倍行距。对于目录的其余部分,即不同章节标题之间的间距必须是双倍行距。有没有特定的方法可以在软件包中做到这一点titletoc

目录示例

附件是我正在使用的代码:

\documentclass{report}

\usepackage[indentafter]{titlesec} 
\usepackage{titletoc}
\usepackage{setspace}
\usepackage{lipsum}

\renewcommand{\chaptername}{CHAPTER}

\setcounter{tocdepth}{0} %% changes toc entry appearance
\newcommand{\setupname}[1][\chaptername]{
    \titlecontents{chapter}[0pt]{\vspace{1ex}}{#1~\thecontentslabel:\quad}{}{\mdseries\titlerule*[0.75em]{.}\contentspage}[]
}

\titleformat{\chapter}[hang]{\mdseries\large}{\chaptertitlename\ \thechapter:}{1em}{\centering}
\begin{document}
    \begin{spacing}{1.75}
        \renewcommand*\contentsname{TABLE OF CONTENTS}
        \tableofcontents
        \cleardoublepage
        \setupname
        \chapter{INTRODUCTION}
        \lipsum
        
        \section{Problem Statement and Organization}
        \lipsum
        
        \section{Detailed Investigations}
        \lipsum

        \chapter{I AM A VERY LONG CHAPTER, BUT I NEED TO BE SINGLE SPACED USING THE TITLETOC PACKAGE}
        \lipsum
                
        \section{Problem Statement and Organization}
        \lipsum
        
        \section{Detailed Investigations}
        \lipsum
        
        \chapter{CONCLUSION}
        \lipsum
        
    \end{spacing}
\end{document}

答案1

正如我在这个问题的评论中所建议的那样,你可以将环境放在\tableofcontents外面spacing,以防止首先出现更多的行距。然后,为了恢复目录中条目之间的额外空间,请在命令的第 3 个参数中添加一些空格\titlecontents,即放在每个目录条目之前的代码:

documentclass[12pt]{report}

\usepackage{setspace}
\usepackage[indentafter]{titlesec}
\usepackage{titletoc}
\setcounter{tocdepth}{0}
\renewcommand{\chaptername}{CHAPTER}

\newcommand{\setupname}[1][\chaptername]{ % set \vspace to 1.75\baselineskip
    \titlecontents{chapter}[0pt]{\vspace{1.75\baselineskip}}{#1~\thecontentslabel:\quad}{}{\mdseries\titlerule*[0.75em]{.}\contentspage}
}

\titleformat{\chapter}[hang]{\mdseries\large}{\chaptertitlename\ \thechapter:}{1em}{\centering}
\begin{document}
    \renewcommand*\contentsname{TABLE OF CONTENTS}
    \tableofcontents
    \begin{spacing}{1.75}
        \cleardoublepage
        \pagenumbering{arabic}
        \setupname
        \chapter{INTRODUCTION}\label{chap:intro}
        
        \chapter{I AM A VERY LONG CHAPTER, BUT I NEED TO BE SINGLE SPACED USING THE TITLETOC PACKAGE}\label{chap:intro}
        
        \chapter{REFERENCES}
        
    \end{spacing}
    
\end{document}

在此处输入图片描述

答案2

我不会将整个文档包含在环境中:只需在文档序言中\spacing发布。您可以在代码中设置。\setstretch{1.75}\singlespacing\titlecontents

\documentclass{report}

\usepackage[indentafter]{titlesec} 
\usepackage{titletoc}
\usepackage{setspace}
\usepackage{lipsum}

\renewcommand{\chaptername}{CHAPTER}
\renewcommand*\contentsname{TABLE OF CONTENTS}

\titleformat{\chapter}[hang]
  {\mdseries\large}
  {\chaptertitlename\ \thechapter:}
  {1em}
  {\centering}
\titlecontents{chapter}
  [0pt]
  {\vspace{1ex}\singlespacing}
  {\chaptername~\thecontentslabel:\quad}
  {}
  {\mdseries\titlerule*[0.75em]{.}\contentspage}


\setcounter{tocdepth}{0} %% changes toc entry appearance

\setstretch{1.75}

\begin{document}

\tableofcontents

\cleardoublepage

\chapter{INTRODUCTION}
\lipsum

\section{Problem Statement and Organization}
\lipsum

\section{Detailed Investigations}
\lipsum

\chapter{I AM A VERY LONG CHAPTER, BUT I NEED TO BE SINGLE SPACED USING THE TITLETOC PACKAGE}
\lipsum

\section{Problem Statement and Organization}
\lipsum

\section{Detailed Investigations}
\lipsum

\chapter{CONCLUSION}
\lipsum

\end{document}

在此处输入图片描述

相关内容