[Tex/LaTex] List of figures and list of tables overlaps figure/table indices with proceeding text when double figures are used

indentationtable of contents

I have a list of figures, automatically generated using the \listoffigures command, The list is three numbers deep, and when i get double figures in one, it overlaps with text e.g.

1.2.12 My figure caption

Only the last "2" in the number and "M" from "My" overlap one another. How can I fix this please. I'm using a class that redefines \listoffigures but I don't think it does anything.

The problem seems to be because the system doesn't know to modify the lot of lof when \numberwithin{figure}{section}

i gather that the tocloft package might be able to fix this for me but it seems like overkill for such a simple problem.

Any ideas? thanks

Here's an example code:

\documentclass{book}
\usepackage{amsmath}
%\usepackage[titles]{tocloft}


\numberwithin{figure}{section}


\begin{document}

\listoffigures

\chapter{my first chapter}

\section{hello}

\begin{figure}
    \caption{stuff}
    \label{fig:first1}
\end{figure}

\begin{figure}
    \caption{stuff}
    \label{fig:first2}
\end{figure}

\begin{figure}
    \caption{stuff}
    \label{fig:first3}
\end{figure}

\begin{figure}
    \caption{stuff}
    \label{fig:first4}
\end{figure}

\begin{figure}
    \caption{stuff}
    \label{fig:first5}
\end{figure}

\begin{figure}
    \caption{stuff}
    \label{fig:first6}
\end{figure}

\begin{figure}
    \caption{stuff}
    \label{fig:first7}
\end{figure}

\begin{figure}
    \caption{stuff}
    \label{fig:first8}
\end{figure}

\begin{figure}
    \caption{stuff}
    \label{fig:first9}
\end{figure}

\begin{figure}
    \caption{stuff}
    \label{fig:first10}
\end{figure}

\begin{figure}
    \caption{stuff}
    \label{fig:first11}
\end{figure}


\end{document}

Best Answer

Add the following to your preamble:

\makeatletter
\renewcommand*\l@figure{\@dottedtocline{1}{1.5em}{3em}}% 3em instead of 2.3em
\let\l@table\l@figure
\makeatother

EDIT: Added fix for tables.