# How to tweak the LOF and LOT without using any packages?

The list of figures/tables in default book class looks like:

Default looking:

List of Figures

1.1 Snapshots ..................  2
1.2 Snapshots ..................  4
1.3 Snapshots ..................  6
2.1 Snapshots .................. 12
2.2 Snapshots .................. 23
2.3 Snapshots .................. 32


What I want to tweak is like:

List of Figures

Figure 1.1 Snapshots ..................  2
Figure 1.2 Snapshots ..................  4
Figure 1.3 A very long caption:  blabla
blabla blabla ..............  6
% skip = 1em
Figure 2.1 Snapshots .................. 12
Figure 2.2 Snapshots .................. 23
Figure 2.3 Snapshots .................. 32

1. Group Figures/Tables by chapter with a small skip 1 em
2. Add Figure or Table before each entries.

So how to implement this?

Update 1:

Using the codes by Werner, the Figure and Table are appended to the begin of LOT, LOF entries, however, the captions are not aligned, how to solve this minor issue?

Similar:

-
The default book class does add space between entries in the LoF & LoT (10pt). You must be doing something different to have no space between chapter-specific floats. –  Werner Feb 8 '13 at 2:30
request number 2 is quite similar to Add the word "Algorithm" before each entry in the List of Algorithms –  cmhughes Feb 8 '13 at 2:32

1. The default book does insert a gap in the LoF & LoT between every chapter. See the chapter-making macro from book.cls:

\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter.}%
{\protect\numberline{\thechapter}#1}%
\else
\fi
\else
\fi
\chaptermark{#1}%
\if@twocolumn
\else
\fi}


If you wish to change this to 1em, you can use etoolbox to patch \@chapter or, without package, copy the definition of \@chapter and replace the \addvspace lengths with 1em. Here's the etoolbox patch:

\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\@chapter}{10\p@}{1em}{}{}% for List of Figures
\patchcmd{\@chapter}{10\p@}{1em}{}{}% for List of Tables
\makeatother

2. Adding Figure and Table before your LoF and LoT entries, respectively, follows a similar discussion as can be found in Add the word “Algorithm” before each entry in the List of Algorithms:

\documentclass[oneside]{book}
\newcommand{\myfig}{\begin{figure}\caption{A figure caption}\end{figure}}
\newcommand{\mytab}{\begin{table}\caption{A table caption}\end{table}}
\let\oldlistoffigures\listoffigures
\let\oldlistoftables\listoftables
\renewcommand{\listoffigures}{%
\begingroup%
\let\oldnumberline\numberline%
\renewcommand{\numberline}{\figurename~\oldnumberline}%
\oldlistoffigures%
\endgroup}%
\renewcommand{\listoftables}{%
\begingroup%
\let\oldnumberline\numberline%
\renewcommand{\numberline}{\tablename~\oldnumberline}%
\oldlistoftables%
\endgroup}%
\begin{document}
\listoffigures
\listoftables
\chapter{A chapter}\myfig\mytab\myfig\mytab\myfig\mytab
\chapter{A chapter}\myfig\mytab\myfig\mytab\myfig\mytab
\chapter{A chapter}\myfig\mytab\myfig\mytab\myfig\mytab
\chapter{A chapter}\myfig\mytab\myfig\mytab\myfig\mytab
\chapter{A chapter}\myfig\mytab\myfig\mytab\myfig\mytab
\end{document}

-
It works, however, the Figs/Tabs captions are not aligned in terms of vertical position, how to figure this out? –  KOF Feb 10 '13 at 16:33