[Tex/LaTex] Longtable and List of Tables – How to add “Table” before numeration

longtabletable of contentstables

Im using a template for my Msc thesis and everything was ok, until I used the longtable, to create tables in multiple pages.

When I use the normal TABLE, the caption appear like this in the LIST OF TABLES:

\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*}

That result on this:

enter image description here

Now, using the LONGTABLE, I am getting the following results:

\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}

The list of tables is like:

enter image description here

I tried some things that I searched and nothing worked. What I want to do is to set all the list as "Table X.X – Loren Ipsum etc etc"

Don't know if it helps, but here the code that I found where the template create that model for the regular tables.

%----------------------------------------------------------------------------------
% 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}

And here's the packages that Im using:

\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}

Hope someone could give me a light for this… thanks a lot!

Best Answer

Here's a tocloft - package solution for this problem.

\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}

enter image description here

Related Question