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}
相关推荐
jimmyleeee5 分钟前
人工智能基础知识笔记四十一:Claude 成本节约完全指南:从计费机制到工具实战
人工智能·笔记
garmin Chen7 分钟前
Elasticsearch(1):Elasticsearch核心原理与基础操作总结
java·大数据·笔记·elasticsearch·搜索引擎·全文检索
晓梦林10 分钟前
EVA靶场学习笔记
android·笔记·学习
ZzYH2220 分钟前
文献阅读 260529-Burning Questions: Research Data, Tools, and Insights
笔记
玖玥拾26 分钟前
C/C++ 基础笔记(一)
c语言·c++·笔记
sheeta199835 分钟前
LeetCode 补拙笔记 日期:2026.05.29 题目:1559. 二维网格图中探测环
笔记·算法·leetcode
不羁的木木44 分钟前
ArkWeb实战学习笔记02-环境搭建与基础配置
笔记·学习·harmonyos
stars-he1 小时前
SPICE编程与仿真学习笔记:从网表到瞬态分析
笔记·学习·硬件工程
.千余1 小时前
【C++】C++核心语法:函数重载与缺省参数原理与避坑
c语言·开发语言·c++·经验分享·笔记·git·学习
元气少女小圆丶1 小时前
SenseGlove Nova 2+Unity开发笔记3
笔记·unity·游戏引擎