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}
相关推荐
笑衬人心。2 小时前
Ubuntu 22.04 修改默认 Python 版本为 Python3 笔记
笔记·python·ubuntu
金色光环3 小时前
【Modbus学习笔记】stm32实现Modbus
笔记·stm32·学习
zyxzyx6664 小时前
Flyway 介绍以及与 Spring Boot 集成指南
spring boot·笔记
西岭千秋雪_5 小时前
Redis性能优化
数据库·redis·笔记·学习·缓存·性能优化
HuashuiMu花水木6 小时前
Matplotlib笔记4----------图像处理
图像处理·笔记·matplotlib
DES 仿真实践家7 小时前
【Day 11-N22】Python类(3)——Python的继承性、多继承、方法重写
开发语言·笔记·python
IMPYLH13 小时前
Python 的内置函数 reversed
笔记·python
ysa05103017 小时前
数论基础知识和模板
数据结构·c++·笔记·算法
今天背单词了吗98017 小时前
算法学习笔记:7.Dijkstra 算法——从原理到实战,涵盖 LeetCode 与考研 408 例题
java·开发语言·数据结构·笔记·算法
mitt_18 小时前
《人生顶层设计》读书笔记7
笔记