7

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:

enter image description here

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:

4
  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.}%
                             \addcontentsline{toc}{chapter}%
                                       {\protect\numberline{\thechapter}#1}%
                           \else
                             \addcontentsline{toc}{chapter}{#1}%
                           \fi
                        \else
                          \addcontentsline{toc}{chapter}{#1}%
                        \fi
                        \chaptermark{#1}%
                        \addtocontents{lof}{\protect\addvspace{10\p@}}% Insert gap in LoF
                        \addtocontents{lot}{\protect\addvspace{10\p@}}% Insert gap in LoT
                        \if@twocolumn
                          \@topnewpage[\@makechapterhead{#2}]%
                        \else
                          \@makechapterhead{#2}%
                          \@afterheading
                        \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:

    enter image description here

    \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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.