List of Figures - how to add caption label

I'm using the caption package. In the List-Of-Figures I get only the numbers, but I also want to have the prefix. It currently looks like that:

List of Figures
1 Caption of Figure 1........1
2 Caption of Figure 2........9

And I want it to look like:

List of Figures
Figure 1: Caption of Figure 1...1
Figure 2: Caption of Figure 2...9

The same format is already used for the captions themselves.

-

You could use the tocloft package; an example:

\documentclass{book}
\usepackage{tocloft}

\newlength{\mylen}

\renewcommand{\cftfigpresnum}{\figurename\enspace}
\renewcommand{\cftfigaftersnum}{:}
\settowidth{\mylen}{\cftfigpresnum\cftfigaftersnum}

\begin{document}

\listoffigures
\begin{figure}[!ht]
\centering
\rule{2cm}{2cm}
\caption{test figure one}
\label{fig:test1}
\end{figure}
\begin{figure}[!ht]
\centering
\rule{2cm}{2cm}
\caption{test figure two}
\label{fig:test2}
\end{figure}

\end{document}

If you want tocloft to use default LaTeX formatting (so it won't "mess up" for example the layout of your table of contents and so on) you can use the titles option of the package:

\usepackage[titles]{tocloft}
-
This works well, except that tocloft seems to ruin the format of LOF and LOT. But I will figure that out. Thank you very much. – MiKa Mar 7 '11 at 18:00

To achieve what you're aiming for without loading the tocloft package, one has to patch an instruction in LaTeX's internal \@caption macro and redefine the internal macros \l@figure and \l@table.

The following MWE shows how to do this; note that the patching is done with the command \patchcmd provided by the etoolbox package. (If, for some reason, you don't want to use the \patchcmd instruction, you will need to copy and paste the entire definition of \@caption from the file latex.ltx into your preamble and replace the string \csname the#1\endcsname with \csname fnum@#1\endcsname:, leaving the other instructions unchanged.)

\documentclass{article}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@caption}{\csname the#1\endcsname}{\csname fnum@#1\endcsname:}{}{}
\renewcommand*\l@figure{\@dottedtocline{1}{1.5em}{4.5em}} % default for 3rd arg: 2.3em
\let\l@table\l@figure % as in article.cls
\makeatother

\begin{document}
\listoffigures
\listoftables

\begin{figure}[h]
\caption{A figure}
\centering xyz
\end{figure}

\begin{table}[h]
\caption{Some table}
\centering abc
\end{table}
\end{document}

-
Why would want not to use tocloft? – Martin Schröder Jan 23 '12 at 20:03
@MartinSchröder well, it's giving me an error in Overleaf when I try to use it. – Seanny123 Mar 30 '15 at 1:41
@Seanny123 - Please provide more information about the document class you use, how you load the tocloft package, and the error(s) you get. – Mico Mar 30 '15 at 1:50

When you caption your figure, there's an optional argument that's designed for the list of figures.

\caption[short title]{Long caption describing the figure.}

This will display the short title as the title in the list of figures, and the long caption as the actual caption of your figure. It is perfectly acceptable for these both to be the same.

It is designed this way as many figures, particularly in scientific publications have long captions describing everything that is in the figure. All of this wouldn't fit into the list of figures, so there is a separate title for that purpose.

It is optional because you don't need it if you are not including a list of figures.

-
Just noticed that you're using the caption package, what I have described is the default. I would guess that the syntax for the caption package is similar (if not exactly the same). – Dom Mar 7 '11 at 16:45
a tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button (with "101010" on it). – Hendrik Vogt Mar 7 '11 at 17:17
Thank you very much @Dom, but that's not what I'm looking for. – MiKa Mar 7 '11 at 18:00
Sorry @MiKa, just re-read, and realised I hadn't understood the question, oh well. Thanks for the pointer on how to make it look like code @Hendrik Vogt. – Dom Mar 7 '11 at 21:49
no problem, luckily somebody found a solution to my problem. Thanks for trying!!! – MiKa Mar 8 '11 at 12:08