目录中的子章节编号与标题重叠。
我尝试过解决方案这个帖子,但它对我来说不起作用。
下面您将看到一个重现该问题的示例文档。
\documentclass[12pt]{article}
\usepackage[margin=0.5in,headheight=48pt,includeheadfoot]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[table,usenames,dvipsnames]{xcolor}
\usepackage{sectsty}
\usepackage{multirow}
\usepackage{float}
\usepackage{fancyhdr}
\usepackage{arev}
\usepackage{pgfgantt}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{titlesec}
\usepackage{tikz}
\usepackage{outlines}
\usepackage{hyperref}
\usepackage{longtable}
\usepackage{paralist}
% define custom colors
\definecolor{primary}{HTML}{8bc34a}
\colorlet{primarylight}{primary!60!white}
\colorlet{primarylightest}{primary!10!white}
\definecolor{secondary}{HTML}{000000}
\colorlet{secondarylight}{secondary!60!white}
\colorlet{secondarylightest}{secondary!80!white}
\definecolor{tertiary}{HTML}{1a237e}
\colorlet{tertiarylight}{tertiary!60!white}
\definecolor{background}{HTML}{FFFFFF}
% define document formatting
\pagestyle{fancy}
\rhead{}
\rfoot{PROPRIETARY \& CONFIDENTIAL}
\cfoot{\thepage}
\lfoot{OTHER THING}
\setlength{\parskip}{0.5em}
%\setcounter{secnumdepth}{0}
\titleformat{\section}
{\normalfont\Large\bfseries\color{primary}}{\thesection}{1em}{}[{\titlerule[0.8pt]}]
\setlength{\parindent}{0pt}
% document coloring
%\let\oldheadrule\headrule
%\renewcommand{\headrule}{\color{secondary}\oldheadrule}
\renewcommand{\headrulewidth}{0pt}
\sectionfont{\color{primary}}
\subsectionfont{\color{secondary}}
% table of contents
%\renewcommand{\@pnumwidth}{2em}
\renewcommand{\arraystretch}{2.5}
\arrayrulecolor{secondarylight}
\title{broken}
\author{}
\date{March 2022}
\begin{document}
\hypertarget{toc}{}
\tableofcontents
\newpage
\section{Introduction}
\section{Introduction}
\section{Introduction}
\section{Introduction}
\section{Introduction}
\section{Introduction}
\section{Introduction}
\section{Introduction}
\section{Introduction}
\section{Introduction}
\section{Introduction}
\section{Introduction}
\section{Introduction}
\section{Introduction}
\section{Introduction}
\section{Introduction}
\section{Introduction}
\section{Introduction}
\section{Introduction}
\section{Introduction}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\subsection{Sub-section}
\end{document}
答案1
您的问题标题包括“尝试过托克洛夫”,但您的 MWE 中没有usepackage{tocloft}
。那么,您是如何使用 的tocloft
?您是否阅读过手册,了解它能为您做什么?
您的 MWE 太长,包含不重要的包和代码。
\documentclass{article}
\usepackage{tocloft}
%\setlength{\cftsubsecnumwidth}{7em} % cater for very long subsection numbers, but better
\addtolength{\cftsubsecnumwidth}{{2em} % increase space for subsection numbers by 2em