latex中对目录的处理

文章目录

设置目录的章节编号宽度和章节标题的缩进

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}
相关推荐
He BianGu4 小时前
【笔记】DebuggerDisplay、DebuggerBrowsable 及其相关“系列”特性的系统性说明
笔记·c#
其美杰布-富贵-李4 小时前
OpenCalphad 学习笔记
笔记·学习·热力学计算
hkNaruto4 小时前
【AI】AI学习笔记:直接使用Python+BM25算法实现RAG的可行性以及实用价值
人工智能·笔记·学习
Lv11770084 小时前
WinForm常用控件功能介绍及使用模板
笔记·c#·visual studio·winform
week_泽5 小时前
第7课:管理长期记忆的关键架构决策 - 学习笔记_7
java·笔记·学习·ai agent
koo3645 小时前
pytorch深度学习笔记15
pytorch·笔记·深度学习
中屹指纹浏览器6 小时前
2026 指纹浏览器技术深度剖析:沙箱隔离与 IP 协同适配的实现方案
经验分享·笔记
被制作时长两年半的个人练习生6 小时前
首尾元素相同的间隔循环策略
c++·笔记·循环·ptx
今儿敲了吗6 小时前
计算机网络第三章笔记(三)
笔记·计算机网络
week_泽6 小时前
第2课:深度剖析AI Agent核心模块 - 学习笔记_2
人工智能·笔记·学习·ai agent