[Tex/LaTex] Customising list of tables to include “table” word

spacingtable of contentstocloft

I am customizing the list of tables and list of figures in a report class document. I am trying to produce lists that start this way: "Table 1: Some info" and so on, instead of the default beginning with section numbers ("1.2 Some info"). There are two things I am unable to do: 1. add the ":" after Table/Figure, and 2.Suppress the extra vertical space between tables/figures from different chapters, i.e. I want equal distances between the items in the lists regardless of which chapter they belong to.

Here is the code for list of tables only:

\documentclass{report}
\usepackage{chngcntr}  
\usepackage{tocloft}
\usepackage{hyperref}

\renewcommand{\cfttabpresnum}{Table }
\newlength{\mylen}
\settowidth{\mylen}{\cfttabpresnum\cfttabaftersnum}
\addtolength{\cfttabnumwidth}{\mylen}

\begin{document}
\listoftables

\chapter{Test one}
\section{Test one one}

\begin{table}
\caption{Test table one}
\end{table}

\begin{table}
\caption{Test table one}
\end{table}

\begin{table}
\caption{Test table one}
\end{table}

\begin{table}
\caption{Test table one}
\end{table}

\begin{figure}
  \caption{Test figure one}
\end{figure}

\chapter{Test two}
\section{Test two two}

\begin{table}
\caption{Test table two}
\end{table}

\begin{figure}
\caption{Test figure two}
\end{figure}

\end{document}

Best Answer

For customization of any tableofcontents-like command (ToC, LoT, or LoF) I like the titletoc package, as it offers the same friendly user interface of the titlesec package.

The important part in the code below is

\titlecontents{table}
[0pt]                                               % left margin
{\addvspace{.5cm}\itshape}%                         % above code (e.g vertical space)
{\contentsmargin{0pt} \bfseries                     % numbered entry format
    TABLE~\thecontentslabel:\enspace%
    \large}
{\contentsmargin{0pt}\large}                        % unnumbered entry format
{\titlerule*[.5pc]{.}\contentspage}                 % filler-page format (e.g dots)
[\addvspace{.5pc}]                                  % below code (e.g vertical space)

I have used more spacing commands than you requested, but you can tweak them to suit your tastes. In particular, you can change \enspace to any \hspace{} command that you like.

% arara: pdflatex
% !arara: indent: {overwrite: true}

\documentclass{report}
\usepackage{titletoc}
\usepackage{hyperref}

\titlecontents{table}
[0pt]                                               % left margin
{\addvspace{.5cm}\itshape}%                         % above code (e.g vertical space)
{\contentsmargin{0pt} \bfseries                     % numbered entry format
    TABLE~\thecontentslabel:\enspace%
    \large}
{\contentsmargin{0pt}\large}                        % unnumbered entry format
{\titlerule*[.5pc]{.}\contentspage}                 % filler-page format (e.g dots)
[\addvspace{.5pc}]                                  % below code (e.g vertical space)


\begin{document}

\listoftables
\chapter{Test one}
\section{Test one one}

\begin{table}
    \caption{Test table one}
\end{table}

\begin{table}
    \caption{Test table one}
\end{table}

\begin{table}
    \caption{Test table one}
\end{table}

\begin{table}
    \caption{Test table one}
\end{table}

\begin{figure}
    \caption{Test figure one}
\end{figure}

\chapter{Test two}
\section{Test two two}

\begin{table}
    \caption{Test table two}
\end{table}

\begin{figure}
    \caption{Test figure two}
\end{figure}

\end{document}