将表格的某些部分添加到目录中

将表格的某些部分添加到目录中

我使用一个长表“longtblr”,它分布在 5 页上。该表位于 \section 下。该表包含多个主题和许多参数:这意味着 ITEM_a 有 10 行,ITEM_b 有 30 行,……从 TOC 我只能到达表的开头。例如,所需主题位于表的末尾,我需要向下滚动 5 页。

我如何向表格添加链接或子部分,使其出现在主部分下的目录中?

先感谢您。

\documentclass{article}
\usepackage{blindtext}
\usepackage{titlesec}
\usepackage{longtable}
\title{Sections and Chapters}
\author{Gubert Farnsworth}
\date{ }
\begin{document}

\maketitle

\tableofcontents

\section{Introduction}


\begin{longtable}[c]{| c | c |}
\caption{Long table caption.\label{long}}\\
 \hline
 \multicolumn{2}{| c |}{Begin of Table}\\
 \hline
 Something & something else\\
 \hline
 \endfirsthead

 \hline
 \multicolumn{2}{|c|}{Continuation of Table \ref{long}}\\
 \hline
 Something & something else\\
 \hline
 \endhead

 \hline
 \endfoot

 \hline
 \multicolumn{2}{| c |}{End of Table}\\
 \hline\hline
 \endlastfoot

 ITEM\_a         & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
ITEM\_b             & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
ITEM\_c           & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
ITEM\_d           & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
ITEM\_e           & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
 \end{longtable}


\section{Second Section}

\blindtext
\end{document}

答案1

不太清楚为什么你想要把它ITEM_…放在目录中而不是表格列表中,但你是老板……

像往常一样,您可以使用\addcontentsline将条目添加到目录中。对于您来说,使用级别是最有意义的subsection,因此您应该使用

\addcontentsline{toc}{subsection}{ITEM\_a}

ETC。

我还建议使用命令来生成项目:

\documentclass{article}
\usepackage{longtable}
\usepackage{blindtext}

\title{Sections and Chapters}
\author{Gubert Farnsworth}
\date{ }

\newcommand*\ITEM[1]{%
  \addcontentsline{toc}{subsection}{ITEM\_#1}% ToC entry
  ITEM\_#1% item
}

\begin{document}

\maketitle

\tableofcontents

\section{Introduction}


\begin{longtable}[c]{| c | c |}
\caption{Long table caption.\label{long}}\\
 \hline
 \multicolumn{2}{| c |}{Begin of Table}\\
 \hline
 Something & something else\\
 \hline
 \endfirsthead

 \hline
 \multicolumn{2}{|c|}{Continuation of Table \ref{long}}\\
 \hline
 Something & something else\\
 \hline
 \endhead

 \hline
 \endfoot

 \hline
 \multicolumn{2}{| c |}{End of Table}\\
 \hline\hline
 \endlastfoot

 \ITEM{a}         & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
\ITEM{b}             & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
\ITEM{c}           & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
\ITEM{d}           & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
\ITEM{e}           & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
                 & like this\\
 \end{longtable}


\section{Second Section}

\blindtext
\end{document}

在此处输入图片描述

仅供参考:这种带有大量垂直和水平线的表格不仅不好看,而且印刷也存在问题。对于具有两列和一种(数字)项目的表格,通常使用枚举列表包裹enumitem是更好的解决方案。

相关内容