TOC间距问题

TOC间距问题

在此处输入图片描述我的目录中的间距有问题。部分和章节的间距现在很好,但未编号的部分间距不好。我该如何修复?

\documentclass[a4paper,openany,book,12pt]{memoir}

% Marges
\setulmarginsandblock{1.5cm}{1.5cm}{*}
\setlrmarginsandblock{1.5cm}{1.5cm}{*}
\checkandfixthelayout
\setlength{\parindent}{0in}

% Vormgeving
\usepackage{graphicx}
\usepackage{tikzsymbols}
\usepackage{xcolor}
\usepackage{afterpage}
\usepackage[document]{ragged2e}
\usepackage{multicol}



\newcommand\blankpage{%
\null
\thispagestyle{empty}%
\addtocounter{page}{-1}%
\newpage}

% Delen
\aliaspagestyle{part}{empty} % change the part pagestyle
\renewcommand{\partpageend}{} %% can write after part title
\usepackage{graphicx}

\renewcommand{\beforepartskip}{% added <<<<<<<<<<<<<<<<<
       { \centering

        \par\vspace{8pt}}
}

% Hoofdstukken
\makeatletter
\def\@makechapterhead#1{%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
%\large\bfseries \@chapapp\space \thechapter
\Large\bfseries \thechapter.\space%
%\par\nobreak
%\vskip 20\p@
\fi
\fi
\interlinepenalty\@M
\Large \bfseries #1\par\nobreak
\vskip 12\p@
}}
\makeatother

% Secties
\makeatletter
\def\@makesectionhead#1{%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
%\large\bfseries \@chapapp\space \thechapter
\normalsize \bfseries \thesection.\space%
%\par\nobreak
%\vskip 20\p@
\fi
\fi
\interlinepenalty\@M
\normalsize \bfseries #1\par\nobreak
\vskip 12\p@
}}
\makeatother

\setsecnumdepth{chapter}


\chapterstyle{mychapterstyle}
\setsecheadstyle{\large\bfseries}
\setsubsecheadstyle{\large\bfseries}
\setsubsubsecheadstyle{\normalfont}
\setparaheadstyle{\normalfont}

\makeevenhead{headings}{\thepage}{}{\small\slshape\leftmark}
\makeoddhead{headings}{\small\slshape\rightmark}{}{\thepage}

\setlength\beforechapskip{-1\baselineskip}
\setlength\afterchapskip{1\baselineskip}

\setlength\beforesecskip{-1\baselineskip}
\setlength\aftersecskip{1\baselineskip}

% Kop- en voettekst
\makeheadrule{headings}{\textwidth}{\normalrulethickness}
\makefootrule{ruled}{\textwidth}{\normalrulethickness}{\footruleskip}

\makeevenfoot{headings}{\thepage}{}{}
\makeoddfoot{headings}{}{}{\thepage}
\makeevenhead{headings}{\leftmark}{}{}
\makeoddhead{headings}{}{}{\rightmark}

\makeheadrule{headings}{\textwidth}{\normalrulethickness}
\makefootrule{ruled}{\textwidth}{\normalrulethickness}{\footruleskip}

\makeevenhead{headings}{\leftmark}{}{}
\makeevenhead{ruled}{\leftmark}{}{}
\pagestyle{ruled}

\copypagestyle{chapter}{plain}
\makeevenfoot{chapter}{\thepage}{}{}
\makeoddfoot{chapter}{}{}{\thepage}
\makeevenhead{chapter}{}{}{}
\makeoddhead{chapter}{}{}{}

\makefootrule{chapter}{\textwidth}{\normalrulethickness}{\footruleskip}

\renewcommand\chaptermarksn[1]{}
\renewcommand\sectionmarksn[1]{}


% inhoudsopgave

\setlength\cftpartnumwidth{2em}
\let\oldparttitlefont\parttitlefont
\def\cftpartaftersnum{.} 

\setlength\cftchapternumwidth{2em}
\let\oldchaptitlefont\chaptitlefont
\def\contentstitlefont{\bfseries\Large}
\usepackage{tocloft} 
\def\cftchapteraftersnum{.} 

\setlength\cftsectionnumwidth{2em}

\begin{document}

\part{Part name}
\chapter{Chapter name}
\section{section name}
\section{section name}
\section{section name}

\part{Part name}
\chapter{Chapter name}
\section{section name}
\section{section name}
\section{section name}

\newpage

\renewcommand*{\chaptitlefont}{\contentstitlefont}
\tableofcontents*
\renewcommand*{\chaptitlefont}{\oldchaptitlefont}

\afterpage{\blankpage}
\end{document}

先感谢您!

答案1

\@makechapterhead您想要的就是这样的东西吗?(我从示例中删除了不相关的代码)。顺便说一句:我不明白重新定义和的目的\@makesectionhead,请改用内置接口。

\documentclass[a4paper,openany,12pt]{memoir}

% number until chapters
\setsecnumdepth{chapter}

% add dots
\renewcommand\cftpartaftersnum{.} 
\renewcommand\cftchapteraftersnum{.} 

% next we want the part, chapter and section title to have the same
% starting line

% set size of the box with the number
\setlength\cftpartnumwidth{3em}
\setlength\cftchapternumwidth{\cftpartnumwidth}
% set the indent of the sections (as they are un-numbered)
\setlength\cftsectionindent{\cftpartnumwidth}

\newcommand\test{
  \part{Part name}
  \chapter{Chapter name}
  \section{section name}
  \section{section name}
  \section{section name}
}

\begin{document}

\tableofcontents*

\test

\test
\end{document}

在此处输入图片描述

相关内容