如何像第二幅图那样制作缩进?
现在看起来是这样的:
它看起来应该是这样的:
梅威瑟:
\documentclass[a4paper, 14pt, english]{extreport}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{tocloft}
\usepackage[a4paper, left=25mm, right=10mm, top=20mm, bottom=20mm]{geometry}
\linespread{1.3}
\renewcommand{\rmdefault}{ftm}
\frenchspacing
\renewcommand{\cftchapfont}{\normalsize }
\renewcommand\cftchappagefont{\normalfont}
\renewcommand{\cftbeforechapskip}{0em}
\renewcommand{\cftparskip}{-1mm}
\renewcommand{\cftdotsep}{1}
\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\cftsetindents{chapter}{0pt}{10pt}
\cftsetindents{section}{0pt}{30pt}
\cftsetindents{subsection}{0pt}{40pt}
\cftsetindents{subsubsection}{0pt}{50pt}
\begin{document}
\tableofcontents
\thispagestyle{empty}
\addtocontents{toc}{\protect\thispagestyle{empty}}
\chapter{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\end{document}
答案1
该软件包tocloft
支持这种间接方式。然而,这种修改允许所有设置通过tocloft
\documentclass{book}
\usepackage{tocloft}
\makeatletter
\renewcommand{\numberline}[1]{%
\setbox0\hbox{#1\quad}%
\hb@xt@\wd0{\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb}
\makeatother
\begin{document}
\tableofcontents
\chapter{foo}
\section{bar}
\section{bar}
\setcounter{section}{170}
\section{bar}
\section{bar}
\end{document}
答案2
虽然我无法提供tocloft
解决方案,但可以通过使用该tocstyle
包(KOMA-Script
) 及其tocfullflat
选项。
\documentclass{report}
\usepackage[tocfullflat]{tocstyle}
\usetocstyle{allwithdot}
\settocstylefeature[0]{entryhook}{\normalfont}
\settocstylefeature[0]{entryvskip}{0pt}
\makeatletter
\renewcommand*{\@dotsep}{1}
\makeatother
\begin{document}
\tableofcontents
\chapter{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\section{test}
\end{document}