使用 \caption 時出現表格清單和圖表清單錯誤

使用 \caption 時出現表格清單和圖表清單錯誤

當我嘗試寫論文時,我遇到了這個問題。

圖形未顯示在內容中:圖形清單。桌子也沒有。當我嘗試使用\caption{some figure}新增進行編譯時,出現錯誤訊息。

! Undefined control sequence.
\l@figure #1#2->\ifnum \c@lofdepth 
                                   >\z@ \vskip \cftbeforefigskip {\leftskip ...
l.2 ...paces normal \relax }}{3}{figure.caption.6}
                                                  %
?

我嘗試並發現了其他人回答的有用問題。將附錄作為 LOF 和 LOT 中的章節包含在內,並在 lof 和 lot 中格式化章節

所以我之前載入了程式碼\begin{document}

\makeatletter
\def\thisparttitle{}\def\thispartnumber{}
\newtoggle{noFigs}

\apptocmd{\@part}%
  {\gdef\thisparttitle{#1}\gdef\thispartnumber{\thepart}%
    \global\toggletrue{noFigs}}{}{}

\AtBeginDocument{%
  \AtBeginEnvironment{figure}{%
    \iftoggle{noFigs}{
      \addtocontents{lof}{\protect\contentsline {part}%
        {\protect\numberline {\thispartnumber} {\thisparttitle}}{}{} }
      \global\togglefalse{noFigs}
    }{}
  }%
}

\makeatother

但是,在將有用的設定程式碼載入到我之前的程式碼之後\begin{document}。我發現該包subcaption不相容。該subfigure軟體包可以作為替代方案,但效果不那麼好。此外,我發現\floatfoot在使用設定程式碼進行編譯後,該命令也產生了錯誤訊息。

有什麼想法嗎?謝謝你!

答案1

我剛剛找到了我發布的問題的解決方案。

將以下程式碼複製到序言中:

\usepackage{subcaption}

\captionsetup[subfigure]{list=false}

\usepackage[subfigure]{tocloft}

\newcounter{lofdepth}
\setcounter{lofdepth}{2}

\cftpagenumbersoff{subfigure}

相關內容