1

I'd like to customize the list of figures and tables with a similar design to this:

Modifying mini-toc content

Does somebody know how to do a similar design for a list of tables/images?

lom
  • 15

1 Answers1

3

titletoc package can also be used to customize the list of figures and tables. From the documentation of \dottedcontents and \titlecontents commands:

"section" is the section name without backslash: part, chapter, section, etc. figure and table are allowed, too. (The backlash is omitted because we are dealing with the concept and not the \part, \section, etc. macros themselves. Furthermore, figure and table are environments.)

You can easily adapt the code in the mentioned answer to get the desired result:

\titlecontents{figure}
  [0em]{\vspace*{2\baselineskip}}
  {\parbox{4.5em}{%
    \hfill\Huge\sffamily\bfseries\color{myred}\thecontentspage}%
   \vspace*{-2.3\baselineskip}\leftbar\textsc{\small Figure~\thecontentslabel}\\\sffamily}
  {}{\endleftbar}

enter image description here


EDIT 1:

For further customization, you can extract the value of current chapter from the macro \thecontentslabel, e.g.:

\makeatletter
\titlecontents{figure}
  [0em]{\vspace*{2\baselineskip}}
  {\parbox{4.5em}{%
    \hfill\Huge\sffamily\bfseries\color{myred}\thecontentspage}%
   \vspace*{-2.3\baselineskip}\leftbar 
   \textsc{\small \chaptername~\expandafter\@car\thecontentslabel\@nil\ // %
     Figure~\thecontentslabel}\\\sffamily}
  {}{\endleftbar}
\makeatother

EDIT 2:

You can insert any kind of material into a lof via \addtocontents. E.g., you can define a command \updatemylof invoked after a \chapter to insert a title into your lof which is formatted like a section. Maybe you can customize this approach to your needs. Code:

\documentclass{book}
\usepackage{xcolor,framed,titletoc,lmodern}

\definecolor{myred}{RGB}{127,0,0}
\definecolor{myyellow}{RGB}{169,121,69}

\renewenvironment{leftbar}{%
  \def\FrameCommand{%
    \hspace{6em}%
    {\color{myyellow}\vrule width 2pt depth 6pt}%
    \hspace{1em}%
  }%
  \MakeFramed{\parshape 1 0cm \dimexpr\textwidth-6em\relax\FrameRestore}\vskip2pt\relax
  }
 {\endMakeFramed}

\titlecontents{chapter}
  [0em]{\vspace*{2\baselineskip}}
  {\parbox{4.5em}{%
    \hfill\Huge\sffamily\bfseries\color{myred}\thecontentspage}%
   \vspace*{-2.3\baselineskip}\leftbar
   \textsc{\small\chaptername~\thecontentslabel}\\\sffamily}
  {}{\endleftbar}
\titlecontents{section}
  [8.4em]
  {\sffamily\contentslabel{3em}}{}{}
  {\hspace{0.5em}\nobreak\itshape\color{myred}\contentspage}
\titlecontents{subsection}
  [8.4em]
  {\sffamily\contentslabel{3em}}{}{}  
  {\hspace{0.5em}\nobreak\itshape\color{myred}\contentspage}

\titlecontents{figure}
  [0em]{\vspace*{2\baselineskip}}
  {\parbox{4.5em}{%
    \hfill\Huge\sffamily\bfseries\color{myred}\thecontentspage}%
   \vspace*{-2.3\baselineskip}\leftbar
   \textsc{\small Figure~\thecontentslabel}\\\sffamily}
  {}{\endleftbar}

\newcommand*\updatemylof{%
  \addtocontents{lof}{\protect\section*{Chapter~\thechapter}}%
}

\begin{document}

\tableofcontents
\listoffigures

\chapter{Beginning to learn design with \LaTeX}
\section{This is a test section}
\subsection{Long subsection title and some other text to span more
  than one line}

\newpage\setcounter{page}{123}% just for the example

\chapter{Beginning to learn design with HTML and some other text to
  span more than one line in the ToC}
\updatemylof

\section{This is a test section}
\subsection{Long subsection title and some other text to span more
  than one line}

\cleardoublepage
\begin{figure}\caption{Caption of figure}\end{figure}
\clearpage
\begin{figure}\caption{Caption of figure}\end{figure}

\chapter{Further learning}
\updatemylof

\begin{figure}\caption{Caption of figure}\end{figure}
\begin{figure}\caption{Caption of figure}\end{figure}

\end{document}

enter image description here

Arash Esbati
  • 7,416
  • Thank you! It works perfectly. Could be possible to include "the chapter+label" between the figures/tables? Chapter 1// figure 1.1//figure 1.2// Chapter 2//figure 2.1//figure 2.2 – lom Aug 17 '15 at 09:04
  • @lom - See Edit in the answer above. – Arash Esbati Aug 17 '15 at 11:56
  • Thanks but this is not exactly what I want. I would like to include each group of figures/tables after their 'Chapter+label'. I did not explain it in a proper way on the last comment (I'm sorry): Chapter 1 \ figure 1.1\ figure 1.2\ Chapter 2 \ figure 2.1\ figure 2.2 – lom Aug 17 '15 at 15:02
  • @lom - And chances are good that I still don't understand what you are looking for. Check edit 2 in my answer. – Arash Esbati Aug 17 '15 at 17:13