1

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!

  • Hi Christian! Thanks a lot for the idea. It worked fine, BUT it broke the "List of Figures"... I believe that I will need to add some code for that, right? – Flávio Steffens de Castro Jan 6 '16 at 13:25
2

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

  • Hi Christian! The same happened here... It broke the "List of Figures"... , that should have "Figure - X.X" format. I believe that I will need to add some code for that, right? – Flávio Steffens de Castro Jan 6 '16 at 13:30
  • @FlávioSteffensdeCastro: I don't know what you're talking about – user31729 Jan 6 '16 at 14:47
1

Please always post minimal but complete code which can be compiled. To your question: Use a package like titletoc to customize your List of Tables.

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

enter image description here

And I suggest you also don't use a \resizebox{\textwidth}{!}{... construct to make your tables fit to text width.

0

What works for me is adding this commands to the tex main file:

\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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.