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}
相关推荐
cmc102821 分钟前
127.XIlinx fpga端的pcie(XDMA)与驱动是如何交换数据的
笔记·fpga开发
optimistic_chen24 分钟前
【Java EE进阶 --- SpringBoot】Mybatis操作数据库(基础二)
xml·数据库·spring boot·笔记·java-ee·mybatis
摇滚侠1 小时前
Spring Boot 3零基础教程,properties文件中配置和类的属性绑定,笔记14
java·spring boot·笔记
程序员大雄学编程1 小时前
「机器学习笔记12」支持向量机(SVM)详解:从数学原理到Python实战
笔记·机器学习·支持向量机
YJlio1 小时前
Process Monitor 学习笔记(5.7):长时间运行追踪与日志文件体积的控制
java·笔记·学习
JJJJ_iii1 小时前
【机器学习03】学习率与特征工程、多项式回归、逻辑回归
人工智能·pytorch·笔记·学习·机器学习·回归·逻辑回归
_dindong2 小时前
Linux网络编程:宏观网络体系
linux·网络·笔记·学习
碱化钾3 小时前
学习笔记——GPU训练
笔记·学习
wan5555cn4 小时前
国产电脑操作系统与硬盘兼容性现状分析:挑战与前景评估
人工智能·笔记·深度学习·机器学习·电脑·生活
摇滚侠5 小时前
Spring Boot 3零基础教程,创建第一个 Spring Boot 3 应用,Spring Boot 3 外部配置,笔记03
java·spring boot·笔记