# List of Figures & Tables - how to move caption label into caption itself

I'm using the article document class (as a base) and the caption package. I essentially need to change my LoF format from the default

List of Figures
1 Multiline caption multiline caption multiline caption multiline caption multiline caption
multiline caption multiline caption
2 Multiline caption multiline caption multiline caption multiline caption multiline caption
multiline caption multiline caption


to the following:

List of Figures
Figure 1. Multiline caption multiline caption multiline caption multiline caption multiline
caption multiline caption multiline caption
Figure 2. Multiline caption multiline caption multiline caption multiline caption multiline
caption multiline caption multiline caption


I also need to do the same for my LoT format.

By label I mean the numbers indicating the index of the figure/table.

I'm assuming it's not possible to get the desired output while still using the labels, so how would I move the labels into their captions, remove the labels themselves, and remove the indent? (If it is possible to "inline" the label with its caption then that's all I need.)

If it's not possible to modify \listoffigures and \listoftables to do so, how would I create the needed environments to do so?

Some base LaTeX to build on top of:

\documentclass{article}

\usepackage[
justification=raggedright, singlelinecheck=false
]{caption}

\begin{document}

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

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

\listoffigures
\listoftables

\end{document}


An image of the (approximate) desired output format in Word:

Edit: My revised version of the accepted answer:

% Set formatting for the LoF ande LoT (fig/tab numbers >999 will clip caption)
\newlength{\mylen}
% Set formatting for LoF
\renewcommand{\cftfigpresnum}{Figure } % goes before figure number
\renewcommand{\cftfigaftersnum}{.} % Goes after figure number
\settowidth{\mylen}{\cftfigpresnum} % space required to print \cftfigpresnum
\addtolength{\mylen}{\cftfignumwidth} % plus space for the number
\cftsetindents{figure}{0pt}{0pt} % Remove caption indent, and flush entries with title
\renewcommand{\cftfigaftersnumb}{\hspace{\mylen}} % add space after the zero-spaced number
\setlength{\cftbeforefigskip}{0.5\baselineskip} % Add small gap between LoF entries
% Set formatting for LoT
\renewcommand{\cfttabpresnum}{Table }
\renewcommand{\cfttabaftersnum}{.}
\settowidth{\mylen}{\cfttabpresnum}
\cftsetindents{table}{0pt}{0pt}
\renewcommand{\cfttabaftersnumb}{\hspace{\mylen}}
\setlength{\cftbeforetabskip}{0.5\baselineskip}

• Your question is very unclear, you should provide a small complete test document. It appears that the only thing you want to do is prefix the entries with Figure  but that seems completely unrelated to processing of \label – David Carlisle Nov 20 '18 at 16:55
• I'm using the term "label" informally to refer to the figure numbers. I want to do something similar to tex.stackexchange.com/q/12865/156666, but I want the "Figure <number>." to be inline with the caption. – TakingItCasual Nov 20 '18 at 17:16
• but still you are asking how to modify your existing code without saying what that is, caption formatting is highly dependent on the document class you are using and any related packages such as caption that you may have loaded. So not really possible to suggest anything just from the ascii sketch shown. – David Carlisle Nov 20 '18 at 17:24
• By default tocloft makes no changes to the ToC. It only makes changes to the ToC, LoF, or LoT that you tell it to. Please show your code. – Peter Wilson Nov 20 '18 at 19:02
• @TakingItCasual don't link to an external site, your question and any answers are archived here forever and will not make sense if they are based on a changing link, make a small test document preferably using a standard class that shows the problem and say what output you want and add it to the question as a code block. – David Carlisle Nov 20 '18 at 19:06

Try this (less any typos):

\documentclass{article}
\usepackage{tocloft}
\newlength{\mylen} % a scratch length
\renewcommand{\cftfigpresnum}{Figure } % goes before figure number
\settowidth{\mylen}{\cftfigpresnum} % space required to print \cftfigpresnum
\addtolength{\mylen}{\cftfignumwidth} % plus space for the number
\setlength{\cftfignumwidth}{0em} % but make this zero
\renewcommand{\cftfigaftersnumb}{\hspace{\mylen}} % add space after the zero-spaced number
\renewcommand{\cfttabpresnum}{Table } % repeat above for Tables
\settowidth{\mylen}{\cfttabpresnum}
\setlength{\cfttabnumwidth}{0em}
\renewcommand{\cfttabaftersnumb}{\hspace{\mylen}}

\begin{document}
\section{A section}
Some text

\begin{figure}
\centering
A FIGURE
\caption{A very long caption for a figure where the caption will extend over one
line in the LoF hopefully like this}
\end{figure}
\begin{table}
\centering
A TABLE
\caption{Table caption}
\end{table}

\end{document}


All the fiddling about with lengths is to make the LoF and LoT multiline entries print with the second and later lines aligned with (in your words) the label.

Read the tocloft documentation (> texdoc tocloft) for more information.

• Any idea how to get rid of the "Overfull \hbox" warnings I'm getting for every LoF and LoT entry? – TakingItCasual Nov 21 '18 at 8:51
• @TakingItCasual The number (and whatever you add to it) is typeset in an \hbox of given width (\cftfignumwidth in this case) followed by the caption text in a rectangular format. As you want the number and text be be all left justified this can be done with a zero \cftfignumwidth and hence the overfull warnings. The typeset output is OK except if you use a draft class option. Perhaps someone else will be able to help you but I think that on the whole you have got something that works. – Peter Wilson Nov 23 '18 at 19:25