我想将表格列表直接包含在目录中。这意味着每个部分、子部分等的表格都列在目录中,而不是单独列在表格列表中。
下面这个例子没有得到我想要的结果。Table 1
应该直接跟在 之下subtitle1
,Table 2
之下subtitle2
,以及Table 3
之下title2
......
我该如何修改他的例子?
\documentclass[11pt,a4paper]{article}
\usepackage{graphicx}
\begin{document}
\tableofcontents
\listoftables
\newpage
\section{title1}
\subsection{subtitle1}
\begin{table}[htp!]
\caption{Table 1}
\label{tab:my-table}
\begin{tabular}{ll}
1 & 2 \\
neo & old
\end{tabular}
\end{table}
\subsection{subtitle2}
\begin{table}[htp!]
\caption{Table 2}
\label{tab:my-table}
\begin{tabular}{ll}
1 & 2 \\
neo & old
\end{tabular}
\end{table}
\section{title2}
\begin{table}[htp!]
\caption{Table 3}
\label{tab:my-table}
\begin{tabular}{ll}
1 & 2 \\
neo & old
\end{tabular}
\end{table}
\end{document}
答案1
尝试这个:
% tablesintocprob.tex SE 554629
\documentclass[11pt,a4paper]{article}
\usepackage{graphicx}
\begin{document}
\tableofcontents
%\listoftables
\newpage
\section{title1}
\subsection{subtitle1}
\begin{table}[htp!]
\caption{Table 1}
\addcontentsline{toc}{table}{Table 1}
\label{tab:my-table}
\begin{tabular}{ll}
1 & 2 \\
neo & old
\end{tabular}
\end{table}
\subsection{subtitle2}
\begin{table}[htp!]
\caption{Table 2}
\addcontentsline{toc}{table}{Table 2}
\label{tab:my-other-table}
\begin{tabular}{ll}
1 & 2 \\
neo & old
\end{tabular}
\end{table}
\section{title2}
\begin{table}[htp!]
\caption{Table 3}
\addcontentsline{toc}{table}{Table 3}
\label{tab:my-another-table}
\begin{tabular}{ll}
1 & 2 \\
neo & old
\end{tabular}
\end{table}
\end{document}
我不确定它是否会给出你想要的结果但它会给你一个开始。