2

I want to input different pictures to each chapter in table of contents like this image below, but I can't. Is this possible to use tikz to add pictures?

1 Answers1

1

You can use a marginnote as argument to \addtocontents, similar to the answer to the related question How to put image in table of contents?.

The vertical position is more or less the position of the section in the TOC but you can adjust it a bit using \vskip.

To put images on the left you can use \reversemarginpar before the TOC and \normalmarginpar afterwards.

Note that you need a number of compilations (at least 3) for the image to appear in the correct position.

\documentclass{article}
\usepackage{marginnote}
\reversemarginpar
\usepackage{graphicx}
\begin{document}
\tableofcontents
\normalmarginpar
\section{Functions and Limits}
\subsection{Four Ways to Represent a Function}
\addtocontents{toc}{\protect\marginnote{\vskip-9mm\includegraphics[width=3cm]{example-image}}}
\subsection{Mathematical Models: A Catalog of Essential Functions}
\subsection{New Functions from Old Functions}
\subsection{The Tangent and Velocity Problems}
\subsection{The Limit of a Function}
\subsection{Calculating Limits Using the Limit Laws}
\subsection{The Precise Definition of a Limit}
\subsection{Continuity}
\subsection*{Review}
\addcontentsline{toc}{subsection}{\protect\numberline{}Review}
\end{document}

enter image description here

Marijn
  • 37,699