![\usepackage[subfigure]{tocloft} 使用中のテーブル リスト エラー](https://rvso.com/image/412489/%5Cusepackage%5Bsubfigure%5D%7Btocloft%7D%20%E4%BD%BF%E7%94%A8%E4%B8%AD%E3%81%AE%E3%83%86%E3%83%BC%E3%83%96%E3%83%AB%20%E3%83%AA%E3%82%B9%E3%83%88%20%E3%82%A8%E3%83%A9%E3%83%BC.png)
ドキュメントに問題があり、Overleaf で次のエラーが表示されます。
\l@table #1#2->\ifnum \c@lotdepth
>\z@ \vskip \cftbeforetabskip {\leftskip \...
l.1 ...le}{\numberline {1}{\ignorespaces Test}}{4}
%
正常に動作し、希望どおりに表示される図とサブ図があります。しかし、最初の表を挿入しようとしたところ、このエラーが発生し、表のリストに表示されません。調べたところ、サブ図パッケージに問題があることがわかりました。他の図にも必要なので、パッケージを変更せずにこの問題を解決するにはどうすればよいでしょうか。
私のMWE:
\documentclass[11pt]{article}
\usepackage{blindtext,tabularx,graphicx}
\usepackage[margin=1in]{geometry}
\usepackage[list=true]{subcaption}
\usepackage[labelfont=bf,labelsep=period]{caption}
% Formatting ToC
\usepackage[subfigure]{tocloft}
\setcounter{tocdepth}{3}
\renewcommand*\contentsname{\centerline{TABLE OF CONTENTS}}
%% Adjust spacing between number and title in ToC
\advance\cftsecnumwidth 1em\relax
\advance\cftsubsecindent 1em\relax
\advance\cftsubsubsecindent 1em\relax
%% Adjust dots in ToC & LoF
\renewcommand\cftdotsep{1}
\makeatletter
\renewcommand{\@dotsep}{1}
\makeatother
% Formatting LoF
\renewcommand{\listfigurename}{\section*{LIST OF FIGURES}}
\newcounter{lofdepth}
\setcounter{lofdepth}{3}
\cftpagenumbersoff{subfigure}
% Formatting LoT
\renewcommand{\listtablename}{\section*{LIST OF TABLES}}
\setcounter{tocdepth}{3}
\renewcommand{\listtablename}{\section*{LIST OF TABLES}}
\begin{document}
\tableofcontents
\clearpage
\listoffigures
\clearpage
\listoftables
\clearpage
\section{Nice0}
\begin{figure}[htb]
\centering
\includegraphics[width=\textwidth]{example-image}
\captionsetup[subfigure]{skip=8pt,position=bottom}
\parbox{0.5\textwidth}{\subcaption[Test]{\bf Test}}\hfill
\parbox{0.5\textwidth}{\subcaption[Test2]{\bf Test2}}
\caption[SuperTest]{{\bf Test} \\Histogram of (a) Test and (b) most common Test sample.} \label{figure:Test}
\end{figure}
\clearpage
\section{Nice1}
\begin{table}[htbp]
\caption[Test]{\bf Test} \blindtext
\begin{center}
\begin{tabular}{|l||c|c|} \hline\hline
Ice Cream Store & Location & How to Get There \\ \hline
Toscanini’s & Central Square & Just walk! \\
Herrell’s & Harvard Square & Red Line \\
J.P. Licks & Davis Square & Red Line \\
Ben \& Jerry’s & Newbury Street & Green Line \\ \hline\hline
\end{tabular}
\end{center}
\end{table}
\label{table:Test}
\end{document}
答え1
以下は私にとってはうまくいくようですが、理由は聞かないでください。
% subtocprob.tex SE 540609
\documentclass[11pt]{article}
\usepackage{blindtext,tabularx,graphicx}
\usepackage[margin=1in]{geometry}
\usepackage[list=true]{subcaption}
\usepackage[labelfont=bf,labelsep=period]{caption}
% Formatting ToC
%\usepackage{subfigure}
\usepackage%[subfigure]
{tocloft}
%\usepackage{subfigure}
\setcounter{tocdepth}{3}
\renewcommand*\contentsname{\centerline{TABLE OF CONTENTS}}
%% Adjust spacing between number and title in ToC
\advance\cftsecnumwidth 1em\relax
\advance\cftsubsecindent 1em\relax
\advance\cftsubsubsecindent 1em\relax
%% Adjust dots in ToC & LoF
\renewcommand\cftdotsep{1}
\makeatletter
\renewcommand{\@dotsep}{1}
\makeatother
% Formatting LoF
\renewcommand{\listfigurename}{\section*{LIST OF FIGURES}}
%\newcounter{lofdepth}
\setcounter{lofdepth}{3}
\cftpagenumbersoff{subfigure}
% Formatting LoT
\renewcommand{\listtablename}{\section*{LIST OF TABLES}}
\setcounter{tocdepth}{3}
\renewcommand{\listtablename}{\section*{LIST OF TABLES}}
\begin{document}
\tableofcontents
\clearpage
\listoffigures
\clearpage
\listoftables
\clearpage
\section{Nice0}
\begin{figure}[htb]
\centering
\includegraphics[width=\textwidth]{example-image}
\captionsetup[subfigure]{skip=8pt,position=bottom}
\parbox{0.5\textwidth}{\subcaption[Test]{\bf Test}}\hfill
\parbox{0.5\textwidth}{\subcaption[Test2]{\bf Test2}}
\caption[SuperTest]{{\bf Test} \\Histogram of (a) Test and (b) most common Test sample.} \label{figure:Test}
\end{figure}
\clearpage
\section{Nice1}
\begin{table}[htbp]
\caption[Test]{\bf Test} \blindtext
\begin{center}
\begin{tabular}{|l||c|c|} \hline\hline
Ice Cream Store & Location & How to Get There \\ \hline
Toscanini’s & Central Square & Just walk! \\
Herrell’s & Harvard Square & Red Line \\
J.P. Licks & Davis Square & Red Line \\
Ben \& Jerry’s & Newbury Street & Green Line \\ \hline\hline
\end{tabular}
\end{center}
\end{table}
\label{table:Test}
\end{document}
への参照をすべて削除しsubfigure
、その行もコメントアウトしました\newcounter{lofdepth}
。