Adding images to the main TOC
There may be occasions when you want to customize the table of contents - in this minimum working example, it shows how easy it is to add an image to the 'main' table of contents while leaving the short table of contents intact.

\documentclass{book}
\usepackage{graphicx}
\usepackage{shorttoc}
\usepackage{etoolbox}
% bit extra is added - so the sexy image is only added to the
% main toc not the short toc
\newbool{shorttoc}
\makeatletter
\patchcmd{\@startshorttoc}{\bgroup}{\bgroup\booltrue{shorttoc}}{}{}
\makeatother
\newcommand{\tocfig}[2][]{%
\addtocontents{toc}{%
\protect\ifbool{shorttoc}{}{
\ifnum\value{chapter}>0 \bigskip\noindent\fi%
\protect\includegraphics[#1]{#2}\par%
}%
}%
}
\begin{document}
\shorttableofcontents{Short Contents}{0}
\tableofcontents
\tocfig[width=\textwidth]{./images/ch1.jpg}
\chapter{Title 1 }
\section{Section for title 1}
\tocfig[width=\textwidth]{./images/ch2.jpg}
\chapter{Title 2 }
\section{Section for title 2}
\end{document}
|