以下代码是我设置的最小示例。这样,由于标签“图 10”的数字为 2 位,因此“endash”字符位于标题上方。
\documentclass[12pt]{article}
\usepackage[
labelsep=endash,
figurewithin=none,
]{caption}
\makeatletter
\renewcommand\l@figure[2]{\@dottedtocline{1}{0pt}{4.6em}{#1}{#2}}
\renewcommand{\p@figure}{Figura }
\DeclareCaptionListFormat{format}{#1#2 -- }
\captionsetup[figure]{listformat=format}
\makeatother
\begin{document}
\listoffigures
\captionof{figure}{Title of Figure}
\captionof{figure}{Title of Figure}
\captionof{figure}{Title of Figure}
\captionof{figure}{Title of Figure}
\captionof{figure}{Title of Figure}
\captionof{figure}{Title of Figure}
\captionof{figure}{Title of Figure}
\captionof{figure}{Title of Figure}
\captionof{figure}{Title of Figure}
\captionof{figure}{Title of Figure}
\end{document}
我该如何解决这个问题?我尝试使用
\renewcommand{\numberline}[1]{#1\quad}
但由于以下代码,它破坏了目录对齐
\newcommand{\PosTextual}{
\clearpage
\pagestyle{plain}
\def\@schapter##1{
\addcontentsline{toc}{chapter}{\protect\numberline{}##1}
\if@twocolumn
\@topnewpage[\@makeschapterhead{##1}]%
\else
\@makeschapterhead{##1}%
\@afterheading
\fi
}
}
答案1
这将使数字左对齐,并将等对齐--
。需要记住的是,它\numberline
位于一个指定宽度的框内(在本例中为 5.5em)。
\documentclass[12pt]{article}
\RequirePackage[
labelsep=endash,
figurewithin=none,
]{caption}
\makeatletter
\renewcommand\l@figure[2]{\@dottedtocline{1}{0pt}{5.5em}{#1}{#2}}
\renewcommand{\p@figure}{Figura }
\DeclareCaptionListFormat{format}{#1#2\hfill -- }
\captionsetup[figure]{listformat=format}
\makeatother
\begin{document}
\listoffigures
\captionof{figure}{Title of Figure}
\captionof{figure}{Title of Figure}
\captionof{figure}{Title of Figure}
\captionof{figure}{Title of Figure}
\captionof{figure}{Title of Figure}
\captionof{figure}{Title of Figure}
\captionof{figure}{Title of Figure}
\captionof{figure}{Title of Figure}
\captionof{figure}{Title of Figure}
\captionof{figure}{Title of Figure}
\end{document}