文章目录
设置目录的章节编号宽度和章节标题的缩进
latex
\usepackage{tocloft}
\setlength{\cftsubsecnumwidth}{4cm} % 设置子章节编号的宽度为4cm
\setlength{\cftsubsecindent}{1cm} % 设置子章节标题的缩进为1cm
示例:
latex
\documentclass{article}
\usepackage{tocloft}
\setlength{\cftsubsecnumwidth}{4cm} % 设置子章节编号的宽度为4cm
\setlength{\cftsubsecindent}{1cm} % 设置子章节标题的缩进为1cm
\begin{document}
\tableofcontents
\section{Section 1}
This is section 1.
\subsection{Subsection 1.1}
This is subsection 1.1.
\end{document}
设置条目的间距
latex
\usepackage{tocloft}
\setlength{\cftbeforesecskip}{10pt} % 设置章节与章节之间的间距为10pt
\setlength{\cftbeforesubsecskip}{5pt} % 设置章节与子章节之间的间距为5pt
示例:
latex
\documentclass{article}
\usepackage{tocloft}
\setlength{\cftbeforesecskip}{10pt} % 设置章节与章节之间的间距为10pt
\setlength{\cftbeforesubsecskip}{5pt} % 设置章节与子章节之间的间距为5pt
\begin{document}
\tableofcontents
\section{Section 1}
This is section 1.
\subsection{Subsection 1.1}
This is subsection 1.1.
\end{document}
设置章节标题与页码之间的连接线
latex
\usepackage{tocloft}
\renewcommand{\cftsecleader}{\cftdotfill{3}}
\renewcommand{\cftsubsecleader}{\cftdot}
示例:
latex
\documentclass{article}
\usepackage{tocloft}
\renewcommand{\cftsecleader}{\cftdotfill{3}}
\renewcommand{\cftsubsecleader}{\cftdot}
\begin{document}
\tableofcontents
\section{Section 1}
This is section 1.
\newpage
\section{Section 2}
This is section 2.
\end{document}