Longtable 和表格列表 - 如何在编号前添加“表格”?

Longtable 和表格列表 - 如何在编号前添加“表格”?

我正在使用模板来完成我的Msc论文,一切都很好,直到我使用 longtable 在多个页面中创建表格。

当我使用正常桌子,表格列表中的标题如下所示:

\begin{table*}[t!]
%\scriptsize
\centering
\caption{The Sandish Chaos Report - Project Success Factors \cite{Chaos2015}}
\label{table:successChaos}
%\resizebox{\textwidth}{!}{%
\hspace*{-1cm}
\begin{tabular}{|p{1.1cm}|p{8.8cm}|p{2.1cm}|}
\hline
\multicolumn{3}{|l|}{\cellcolor{gray!15}Project Success Factors (\% of Responses)} \\ \hline
\ 1. & User Involvement & 15.9\% \\ 
\ 2. & Executive Management Support & 13.9\% \\ 
\ 3. & Clear Statement of Requirements & 13.0\% \\ 
\ 4. & Proper Planning & 9.6\% \\ 
\ 5. & Realistic Expectations & 8.2\% \\ 
\ 6. & Smaller Project Milestones & 7.7\% \\ 
\ 7. & Competent Staff & 7.2\% \\ 
\ 8. & Ownership & 5.3\% \\ 
\ 9. & Clear Vision and Objectives & 2.9\% \\
\ 10. & Hard-Working, Focused Staff & 2.4\% \\ 
\ 11. & Other & 13.9\% \\ 
\hline
\end{tabular}
\hspace*{-1cm}
\end{table*}

结果如下:

在此处输入图片描述

-

现在,使用 LONGTABLE,我得到以下结果:

\def\arraystretch{1.5}
\begin{center}
\footnotesize
\begin{longtable}{|p{3.9cm}|p{5.9cm}|p{5.9cm}|}
\captionsetup{width=14cm}
\caption{\NomeDaIssue{}}
\label{table:Excessive Communication}
\hline
\multicolumn{3}{|l|}{\cellcolor{gray!15}Excessive Communication} 
\\ \hline
\cellcolor{gray!15} Dimension:   
&
\multicolumn{2}{|p{12.0cm}|}{Communication}
\\ \hline
\cellcolor{gray!15} Description:   
&
\multicolumn{2}{|p{12.0cm}|}{There's no common ground between team members and this affects the quality of communication.}
\\ \hline
\cellcolor{gray!15} Desired Behavior:  
&
\multicolumn{2}{|p{12.0cm}|}{Team members must have a similar language for working together.} 
\\ \hline
\cellcolor{gray!15}Game Element
&
\cellcolor{gray!15}Discussion
&
\cellcolor{gray!15} Example
\\ \hline
\endfirsthead
\hline
\multicolumn{3}{|l|}{\cellcolor{gray!15}Excessive Communication}
\\ \hline
\cellcolor{gray!15}Game Element 
&
\cellcolor{gray!15}Discussion
&
\cellcolor{gray!15} Example
\\ \hline
\endhead
\hline \multicolumn{3}{r}{\textit{Continued on next page}} \\
\endfoot
\hline
\endlastfoot
Cascading Information Theory
& 
Information about the project could be released in minimum snippets for the team, helping them to achieve similar level of understanding.
& 
Very useful in the beginning of a project, you can create a presentation about the project in small chapters, where team members will go further only after completing each chapter.
\\ \hline
\end{longtable}
\end{center}

表格列表如下:

在此处输入图片描述

-

我尝试了一些我搜索过的方法,但都不起作用。我想要做的是将所有列表设置为“表 XX - Loren Ipsum 等等

不知道是否有帮助,但这里是我找到的代码,模板为常规表创建了该模型。

%----------------------------------------------------------------------------------
% Redefinindo o comando interno do LaTeX para formatar legendas,
% para incluir 'Figura' ou 'Tabela' ao lado do número de cada uma
% nas listas de figuras e tabelas.
%----------------------------------------------------------------------------------
\long\def\@caption#1[#2]#3{%
  \par
  \addcontentsline{\csname ext@#1\endcsname}{#1}%
   %Aqui
   %{\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
    {\csname #1name\endcsname\nobreakspace\protect\numberline{\csname the#1\endcsname\hfil\nobreakspace--\nobreakspace}{\ignorespaces #2}}%
  \begingroup
    \@parboxrestore
    \if@minipage
      \@setminipage
    \fi
    \normalsize
    \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
  \endgroup}

以下是我使用的软件包:

\usepackage{graphicx}
\usepackage{multirow}
\usepackage{nicefrac}
\usepackage{algorithmic}
\usepackage{soul}
\usepackage{framed}
\usepackage{pdfpages}
\usepackage{todonotes}
\usepackage{lscape}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{subcaption}

希望有人能给我一点启发...非常感谢!

答案1

这是tocloft该问题的一揽子解决方案。

\documentclass{book}

\usepackage{longtable}
\usepackage{caption}
\usepackage{tocloft}



\renewcommand{\cfttabpresnum}{\tablename\ } % Insert `Table before Table number in `LoT`
\addtolength{\cfttabnumwidth}{20pt} % Increase the width of the box reserved for the table numbers. 
\begin{document}

\listoftables

\chapter{Foo}
\begin{longtable}{ll}
\caption{David's table} \tabularnewline
\endfirsthead
  David & Carlisle \tabularnewline
\end{longtable}

\begin{table}[h]
  \centering
  \begin{tabular}{ll}
  Another & Table \tabularnewline
  \end{tabular}
  \caption{Another table}
\end{table}

\end{document}

在此处输入图片描述

答案2

请始终发布可以编译的最小但完整的代码。对于您的问题:使用类似的包titletoc来自定义您的表格列表。

\documentclass{article}

\usepackage{longtable,geometry}
\usepackage{caption}
\usepackage[table]{xcolor}
\usepackage{titletoc}

\titlecontents{table}
  [4.5em]
  {}
  {\contentslabel[Table~\thecontentslabel~--]{4.5em}}
  {0em}
  {\titlerule*[1pc]{.}\contentspage}

\begin{document}

\listoftables

\begin{table}[!h]
  \centering
  \caption{The Sandish Chaos Report - Project Success Factors
    Chaos2015 -- The Sandish Chaos Report - Project Success Factors
    Chaos2015}
  \label{table:successChaos}
  % \resizebox{\textwidth}{!}{%
  \hspace*{-1cm}
  \begin{tabular}{|p{1.1cm}|p{8.8cm}|p{2.1cm}|}
    \hline
    \multicolumn{3}{|l|}{\cellcolor{gray!15}Project Success Factors (\% of Responses)} \\ \hline
    \ 1. & User Involvement & 15.9\% \\ 
    \ 2. & Executive Management Support & 13.9\% \\ 
    \ 3. & Clear Statement of Requirements & 13.0\% \\ 
    \ 4. & Proper Planning & 9.6\% \\ 
    \ 5. & Realistic Expectations & 8.2\% \\ 
    \ 6. & Smaller Project Milestones & 7.7\% \\ 
    \ 7. & Competent Staff & 7.2\% \\ 
    \ 8. & Ownership & 5.3\% \\ 
    \ 9. & Clear Vision and Objectives & 2.9\% \\
    \ 10. & Hard-Working, Focused Staff & 2.4\% \\ 
    \ 11. & Other & 13.9\% \\ \hline
  \end{tabular}
\end{table}

\begin{center}
  \footnotesize
  \begin{longtable}{|p{3.9cm}|p{5.9cm}|p{5.9cm}|}
%    \captionsetup{width=14cm}
    \caption{NomeDaIssue}
    \label{table:Excessive Communication}
    \\\hline
    \multicolumn{3}{|l|}{\cellcolor{gray!15}Excessive Communication} 
    \\ \hline
    \cellcolor{gray!15} Dimension:   
    &
    \multicolumn{2}{|p{12.0cm}|}{Communication}
    \\ \hline
    \cellcolor{gray!15} Description:   
    &
    \multicolumn{2}{|p{12.0cm}|}{There's no common ground between team
      members and this affects the quality of communication.}
    \\ \hline
    \cellcolor{gray!15} Desired Behavior:  
    &
    \multicolumn{2}{|p{12.0cm}|}{Team members must have a similar
      language for working together.}
    \\ \hline
    \cellcolor{gray!15}Game Element
    &
    \cellcolor{gray!15}Discussion
    &
    \cellcolor{gray!15} Example
    \\ \hline
    \endfirsthead
    \hline
    \multicolumn{3}{|l|}{\cellcolor{gray!15}Excessive Communication}
    \\ \hline
    \cellcolor{gray!15}Game Element 
    &
    \cellcolor{gray!15}Discussion
    &
    \cellcolor{gray!15} Example
    \\ \hline
    \endhead
    \hline \multicolumn{3}{r}{\textit{Continued on next page}} \\
    \endfoot
    \hline
    \endlastfoot
    Cascading Information Theory
    & 
    Information about the project could be released in minimum
    snippets for the team, helping them to achieve similar level of
    understanding.
    & 
    Very useful in the beginning of a project, you can create a
    presentation about the project in small chapters, where team
    members will go further only after completing each chapter.
    \\ \hline
  \end{longtable}
\end{center}

\end{document}

在此处输入图片描述

而且我建议您也不要使用\resizebox{\textwidth}{!}{...构造来使表格适合文本宽度。

答案3

对我有用的是将此命令添加到 tex 主文件:

\makeatletter
\def\LT@c@ption#1[#2]#3{%
  \LT@makecaption#1\fnum@table{#3}%
  \def\@tempa{#2}%
  \ifx\@tempa\@empty\else
     {\let\\\space
     \addcontentsline{lot}{table}{Table}{\protect\numberline{\thetable}{#2}}}%
  \fi}
\makeatother

相关内容