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}
相关推荐
Wang's Blog6 小时前
PostgreSQL笔记60: 权限与角色管理——从层级体系到最佳实践
数据库·笔记·postgresql
IZero079 小时前
Elasticsearch 学习笔记筑基-文档操作篇
笔记·学习·elasticsearch
公爵爱学习10 小时前
安装Ubuntu20.04遇到的问题 简要简述笔记
笔记
Wang's Blog12 小时前
PostgreSQL笔记28: PostgreSQL ACID 特性与实现机制深度解析
大数据·笔记·postgresql
u01030552712 小时前
正则表达式find与matches区别详解
笔记
浪兎兎12 小时前
Nginx 笔记
运维·笔记·nginx
_Narcissus_13 小时前
二分算法笔记及例题
数据结构·c++·笔记·算法·蓝桥杯·查找·二分算法
Hammer_Hans13 小时前
DFT笔记112
笔记
FAREWELL0007513 小时前
学习笔记-热更新导航
笔记·学习
苏子寒14 小时前
Nano-VLLM全代码解析笔记(6)-embed_head和linear
pytorch·笔记·python·机器学习·ai·nlp·vllm