在 lof/lot 中添加单词“Figure”/“Table”:过去的解决方案改变了格式

在 lof/lot 中添加单词“Figure”/“Table”:过去的解决方案改变了格式

我是论坛新手。希望我的问题符合标准。

我想在 lof/lot 中的每个标题前添加单词“Figure”/“Table”。我尝试了以下解决方案:https://tex.stackexchange.com/a/155202/124927

而且效果非常好。好吧,几乎是这样的。

问题是,现在我的 lof/lot 中的格式略有改变。它弄乱了需要两行的长标题的缩进,例如: 在此处输入图片描述

我知道 tocloft 这个包。问题是,简单地加载它(作为[subfigure]{tocloft})反过来会弄乱 lof 和 lot 的格式。格式需要在整个论文中保持一致。

我正在使用定制的课程(不是报告等)来格式化我的学校(由某人在一段时间前创建),其开始如下:

\NeedsTeXFormat{LaTeX2e}[2009/09/24]
\ProvidesPackage{sgpPhDstyle}

有什么方法可以保持溶液https://tex.stackexchange.com/a/155202/124927,同时保留 lof/lot 的格式?也许是对 的巧妙重新定义\listoffigures

在此先向能够给我答案的任何人致以衷心的谢意。

EDIT2:好的,这里是MWE:

    \documentclass{article}
    \usepackage{tocloft}
    \begin{document}
    {
    \let\oldnumberline\numberline
    \renewcommand{\numberline}{\figurename~\oldnumberline}
    \listoffigures
    }   
    \addcontentsline{toc}{chapter}{List Of Figures} 
    \cleardoublepage

    \begin{figure}[!ht]
    \caption{this is a really loooooooooooooooooooooooooong figure captionthat will take up two lines in the List of Figures.} 
    \end{figure}
    \end{document}

答案1

tocloft提供了使用这种figure前缀的更好方法,但最好的方法是使用和为和caption定义新的标题列表格式。figuretable

\documentclass{article}
\usepackage{caption}
\usepackage[nottoc]{tocbibind}
\usepackage{tocloft}
\addtolength{\cftfignumwidth}{30pt}% More space
\addtolength{\cfttabnumwidth}{30pt}% More space


\usepackage{pgffor}

\DeclareCaptionListFormat{figprefix}{#1\figurename~#2}
\DeclareCaptionListFormat{tabprefix}{#1\tablename~#2}

\begin{document}
\tableofcontents
\cleardoublepage
\listoffigures
\listoftables


\captionsetup[figure]{listformat=figprefix}
\captionsetup[table]{listformat=tabprefix}


\foreach \x in {1,...,10} {%
  \begin{figure}[!ht]
    \caption{this is a really loooooooooooooooooooooooooong figure caption that will take up two lines in the List of Tables.}
  \end{figure}

  \begin{table}[!ht]
    \caption{this is a really loooooooooooooooooooooooooong figure caption that will take up two lines in the List of Tables.} 
  \end{table}


}
\end{document}

在此处输入图片描述

相关内容