Generalincrease space between table number and caption

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
carol
Posts: 105
Joined: Wed Dec 24, 2008 7:25 pm

increase space between table number and caption

Post by carol »

Hi,
I used \listoftables to generate the list of tables in my document. However, I noticed that for the tables with 2-digit table number like 10.21 (10 is the chapter number and 21 the number of table), the table caption is very close to the table number like 10.21This is a table. This doesn't happen when the table number is 1-digit like 10.2 This is another table. Since it's generated automatically, how to increase the space between the table number and table caption for the table with 2-digit table number?

Cheers,

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

increase space between table number and caption

Post by localghost »

Take a look at the manual of the tocloft package. The search function of the forum should yield also some useful results.


Best regards
Thorsten
carol
Posts: 105
Joined: Wed Dec 24, 2008 7:25 pm

Re: increase space between table number and caption

Post by carol »

I had a look at the manual. Whatever I use generates error, for example
\newcommand*{\l@table}{\@dottedtocline{1}{1.5em}{3em}}. I don't know how to change concretely.

I also had a look at the forum by searing \listoftables
http://www.latex-community.org/forum/se ... es&fid[]=5

but didn't find a solution.

By the way, why does it happen to the list of tables and not list of figures?

thanks
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

increase space between table number and caption

Post by localghost »

carol wrote:I had a look at the manual. Whatever I use generates error, for example
\newcommand*{\l@table}{\@dottedtocline{1}{1.5em}{3em}}. I don't know how to change concretely. […]
You can't just use this line in your code. You have to group it by two special commands.

Code: Select all

\makeatletter
\newcommand*{\l@table}{\@dottedtocline{1}{1.5em}{3em}}
\makeatother
carol wrote:[…] I also had a look at the forum by searing \listoftables
http://www.latex-community.org/forum/se ... es&fid[]=5

but didn't find a solution. […]
Wrong search parameter. You should have searched for "tocloft". Here's an example that makes use of the package.

Code: Select all

\documentclass[11pt,a4paper,english]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[font=small,labelfont={bf,sf},tableposition=top]{caption}
\usepackage{tocloft}

% Formatting the lists (tocloft)
\setlength{\cftfignumwidth}{3em}  % Modify number width in LoF
\setlength{\cfttabnumwidth}{3em}  % Modify number width in LoT

\begin{document}
  \setcounter{chapter}{9}

  \listoffigures
  \listoftables
  \chapter{Dummy Chapter}
    \setcounter{section}{9}
    \setcounter{figure}{9}
    \setcounter{table}{9}

    \section{Dummy Section}

    \begin{figure}[!ht]
      \centering
      \rule{6.4cm}{3.6cm}
      \caption{Dummy figure}\label{fig:dummy}
    \end{figure}

    \begin{table}[!ht]
      \caption{Dummy table}\label{tab:dummy}
      \centering
      \rule{6.4cm}{3.6cm}
    \end{table}
\end{document}
carol wrote:[…] By the way, why does it happen to the list of tables and not list of figures? […]
Comment the lines that modify the number width in the LoF and LoT and you will see that it affects both.
carol
Posts: 105
Joined: Wed Dec 24, 2008 7:25 pm

Re: increase space between table number and caption

Post by carol »

if I use

\usepackage{tocloft}
\setlength{\cfttabnumwidth}{3em}

before \begin{document}

I get the following message
/usr/share/texmf/tex/latex/tocloft/tocloft.sty:608:Command \c@lofdepth already defined. \newcounter{lofdepth}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

increase space between table number and caption

Post by localghost »

This is not your first post here and by now you should know that it is always good to build a MWE. Nobody knows the setup of your document. Thus giving specific help becomes difficult.

But in this case you have the luck that this error message is very common and occurs in combination with the subfigure or subfig package (whereby at least the first one is considered obsolete and the second one isn't maintained anymore and causes problems with hyperref). Add an option when loading the package.

Code: Select all

\usepackage[subfigure]{tocloft}
Post Reply