减少 ToC 中的间距

减少 ToC 中的间距

我怎样才能仅减少图片中显示的空间?

在此处输入图片描述

我的代码是:

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%%%% change layout of \chapter*
\makeatletter
\renewcommand{\@makeschapterhead}[1]{%
    %  \vspace*{50pt}%
    \vspace*{12pt}  % space above
    {\parindent 0pt \raggedright
        \normalfont
        \interlinepenalty\@M
        \huge \bfseries #1\par\nobreak
        %            \vskip 40pt
        \vskip 12pt % space below
}}
\makeatother

\begin{document}
    \tableofcontents
    \makeatletter
    \let\@makeschapterhead\save@makeschapterhead
    \makeatother
    \chapter{Résumé}
    \addcontentsline{toc}{chapter}{Table des matières}
    %\end{spacing}
    \listoffigures
    \addcontentsline{toc}{chapter}{Liste des figures}
    \listoftables
    \addcontentsline{toc}{chapter}{Liste des tableaux}
    \addcontentsline{toc}{chapter}{Liste des abréviation et des symboles}
\end{document}

答案1

ToC 标题使用 设置\chapter*。如果要更改前后间距,则需要重新定义,\chapter*如下所示:

 % tocspaceprob.tex  SE 648459

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%%%% change layout of \chapter*
\makeatletter
\renewcommand{\@makeschapterhead}[1]{%
  %  \vspace*{50pt}%
  \vspace*{12pt}  % space above
          {\parindent 0pt \raggedright
            \normalfont
            \interlinepenalty\@M
            \huge \bfseries #1\par\nobreak
            %            \vskip 40pt
            \vskip 12pt % space below
            }}
 \makeatother

\begin{document}
    \tableofcontents
    \chapter{Résumé}
\end{document}

** 根据 OP 的新请求进行编辑 **

% tocspaceprob.tex  SE 648459

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\makeatletter
% save original definition of \@makeschapterhead
\let\save@makeschapterhead\@makeschapterhead
% revise definition of \@makeschapterhead
\renewcommand{\@makeschapterhead}[1]{%
  %  \vspace*{50pt}%
  \vspace*{12pt}  % space above
          {\parindent 0pt \raggedright
            \normalfont
            \interlinepenalty\@M
            \huge \bfseries #1\par\nobreak
            %            \vskip 40pt
            \vskip 12pt % space below
            }}

\makeatother
\begin{document}
\tableofcontents
% revert to original definition of \makeschapterhead
\makeatletter
\let\@makeschapterhead\save@makeschapterhead
\makeatother
    \chapter{Résumé}
    \chapter*{Starred}
     Some text.
  \end{document}

相关内容