# How to get rid of "hang" in the list of figures when Figure label is added to LoF

I added figure label to the LoF but the caption is hanged, this is my MWE:

\documentclass{book}
\usepackage{amsmath}
%i tried this solution
\usepackage[titles]{tocloft}
\cftsetindents{figure}{0em}{2.5em}
\cftsetindents{table}{0em}{2.5em}
\begin{document}
{%                    to add label/ figure  to LoF
\let\oldnumberline\numberline%
\renewcommand{\numberline}{\figurename~\oldnumberline}%

\listoffigures%

}
\begin{figure}
\caption{stuff The second  instruction, i.e., the resetting of the indentation amount for the entries in the List of Tables, isn't strictly necessary for your}
\label{fig:first9}
\end{figure}

\begin{figure}
\caption{stufThe second  instruction, i.e., the resetting of the indentation amount for the entries in the List of Tables, isn't strictly necessary for you}
\label{fig:first11}
\end{figure}

\end{document}

The package tocloft offers commands to achieve what you want without modifying the meaning of \numberline.

You can simply use \listoffigures and add the following lines to your preamble:

\renewcommand\cftfigpresnum{\figurename~}
\newlength\mylength
\settowidth\mylength{\cftfigpresnum}

MWE:

\documentclass{book}
\usepackage{amsmath}
%i tried this solution
\usepackage[titles]{tocloft}
\cftsetindents{figure}{0em}{2.5em}
\renewcommand\cftfigpresnum{\figurename~}
\newlength\mylength
\settowidth\mylength{\cftfigpresnum}

\cftsetindents{table}{0em}{2.5em}
\begin{document}

\listoffigures

\begin{figure}
\caption{stuff The second  instruction, i.e., the resetting of the indentation amount for the entries in the List of Tables, isn't strictly necessary for your}
\label{fig:first9}
\end{figure}

\begin{figure}
\caption{stufThe second  instruction, i.e., the resetting of the indentation amount for the entries in the List of Tables, isn't strictly necessary for you}
\label{fig:first11}
\end{figure}

\end{document}

Output:

If you need the same behaviot for \listoftables add the following lines, as well:

\renewcommand\cfttabpresnum{\tablename~}
\settowidth\mylength{\cfttabpresnum}