我的表格有问题,编号与标题相符。当数字短时一切都很好,但是一旦数字变大就会出现问题。有什么解决办法吗?
这是我使用的代码:
\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\newcommand\tab[1][1cm]{\hspace*{#1}}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\renewcommand{\thechapter}{\Roman{chapter}}
\begin{document}
\tableofcontents
\listoffigures
答案1
使用tocloft
包装并增加图形编号的空间。
\usepackage{tocloft}
\addtolength{\cftfignumwidth}{2em} % or more (or less)
通过 查看手册texdoc tocloft
。
答案2
如果您不想使用 tocloft...
\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{etoolbox}
\newcommand\tab[1][1cm]{\hspace*{#1}}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\renewcommand{\thechapter}{\Roman{chapter}}
\makeatletter
\patchcmd{\l@chapter}{1.5em}{3.5em}{}{chapter Failed!}
\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{4.3em}}
\renewcommand*\l@subsection{\@dottedtocline{2}{3.8em}{5.2em}}
\renewcommand*\l@subsubsection{\@dottedtocline{3}{7.0em}{6.1em}}
\renewcommand*\l@paragraph{\@dottedtocline{4}{10em}{7em}}
\renewcommand*\l@subparagraph{\@dottedtocline{5}{12em}{8em}}
\renewcommand*\l@figure{\@dottedtocline{1}{1.5em}{4.3em}}
\renewcommand*\l@table{\@dottedtocline{1}{1.5em}{4.3em}}
\makeatother
\setcounter{secnumdepth}{5}% number subparagraphs
\setcounter{tocdepth}{5}% show subparagraph
\begin{document}
\tableofcontents
\listoffigures
\chapter{Short number}
\setcounter{chapter}{17}%
\chapter{My chapter}
\section{My section}
\subsection{My subsection}
\subsubsection{My subsubsection}
\paragraph{My paragraph}
\subparagraph{My subparagraph}
\begin{figure}
\caption{My figure}
\end{figure}
\end{document}