![\usepackage[subFigure]{tocloft}를 사용하는 동안 테이블 목록 오류가 발생했습니다.](https://rvso.com/image/412489/%5Cusepackage%5BsubFigure%5D%7Btocloft%7D%EB%A5%BC%20%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94%20%EB%8F%99%EC%95%88%20%ED%85%8C%EC%9D%B4%EB%B8%94%20%EB%AA%A9%EB%A1%9D%20%EC%98%A4%EB%A5%98%EA%B0%80%20%EB%B0%9C%EC%83%9D%ED%96%88%EC%8A%B5%EB%8B%88%EB%8B%A4..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}
.