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}
相关推荐
Jack___Xue几秒前
LangChain实战快速入门笔记(五)--LangChain使用之Tools
笔记·microsoft·langchain
走在路上的菜鸟1 小时前
Android学Dart学习笔记第十三节 注解
android·笔记·学习·flutter
hhy_smile2 小时前
Android 与 java 设计笔记
android·java·笔记
YJlio2 小时前
BgInfo 学习笔记(11.5):多种输出方式(壁纸 / 剪贴板 / 文件)与“更新其他桌面”实战
笔记·学习·c#
断剑zou天涯3 小时前
【算法笔记】线段树SegmentTree
数据结构·笔记·算法
自不量力的A同学3 小时前
ionet 25.2 发布
笔记
YJlio3 小时前
桌面工具学习笔记(11.4):BgInfo + Desktops + ZoomIt 组合拳——演示与排障环境一键到位
笔记·学习·自动化
玩具猴_wjh3 小时前
12.15 学习笔记
笔记·学习
福尔摩斯张4 小时前
TCP协议深度解析:从报文格式到连接管理(超详细)
linux·c语言·网络·c++·笔记·网络协议·tcp/ip
走在路上的菜鸟4 小时前
Android学Dart学习笔记第十四节 库和导库
android·笔记·学习·flutter