I'm really in love with the TOC one gets using the accepted answer at Adding a per-chapter image along with group of entries in ToC.
However, instead of having sections in my TOC, I'd like to include brief descriptions of the chapter contents. But try as I might, I can't get these descriptions to not overwrite the images. I've tried the following, yet none work:
- Martin's answer at Table of Contents with additional description of entries
- The
\cftchapterprecistoc
option in thetocloft
package. - Passing a
\resizebox
to\cftchapterprecistoc
Is there a way to get this text to behave nicely, and stay away from the images? Here's an example of what I'm talking about:
\documentclass{scrbook}
\usepackage{geometry}% http://ctan.org/pkg/geometry
\usepackage{titletoc}% http://ctan.org/pkg/titletoc
\usepackage[export]{adjustbox}% http://ctan.org/pkg/adjustbox
\usepackage{xparse}% http://ctan.org/pkg/xparse
\usepackage{titlesec}
\usepackage{tocloft}
\NewDocumentCommand{\rtocstuff}{O{10pt} m O{80pt}}{% \rtocstuff[<gap>]{<content>}[<width>
\titlecontents{chapter}
[0pt]% left margin indent
{\bigskip\bfseries}% chapter ToC formatting
{\makebox[1.5em][l]{\thecontentslabel}}% chapter label (numbered)
{\hspace*{1.5em}}% chapter label (unnumbered)
{\titlerule*[1pc]{.}% dotted contents line
\thecontentspage% ToC page number
\hspace*{#1}% gap between page number & <content>
\smash{% remove vertical height of image
\raisebox{1.5ex}{% align with top of character
\hspace*{#3}% space for <content>
\llap{% left overlap
#2\hspace*{#1}% actual <content>
}}}}%
\titlecontents{section}
[0pt]% left margin indent
{\normalfont}% section ToC formatting
{\hspace*{1.5em}\makebox[2.3em][l]{\thecontentslabel}}% section label (numbered)
{\hspace*{3.8em}}% section label (unnumbered)
{\titlerule*[1pc]{.}% dotted contents line
\thecontentspage% ToC page number
\hspace*{#1}% gap between page number & <content>
\hspace*{#3}% gap for <content>
}
}
\NewDocumentCommand{\ltocstuff}{O{80pt} m O{10pt}}{% \ltocstuff[<width>]{<content>}[<gap>]
\titlecontents{chapter}
[0pt]% left margin indent
{\bigskip\bfseries}% chapter ToC formatting
{\smash{% remove vertical height of image
\raisebox{1.5ex}{% align with top of character
\rlap{% right overlap
#2% actual content
}\hspace*{#1}% space for <content>
}}%
\hspace*{#3}% gap between <content> and ToC entries
\makebox[1.5em][l]{\thecontentslabel}}% chapter label (numbered)
{\smash{% remove vertical height of image
\raisebox{1.5ex}{% align with top of character
\rlap{% right overlap
#2% actual <content>
}\hspace*{#1}% space for <content>
}}%
\hspace*{1.5em}}% chapter label (unnumbered)
{\titlerule*[1pc]{.}% dotted contents line
\thecontentspage% ToC page number
}
\titlecontents{section}
[0pt]% left margin indent
{\normalfont}% section ToC formatting
{\hspace*{#1}% space for <content>
\hspace*{#3}% gap between <content> and ToC entries
\hspace*{1.5em}\makebox[2.3em][l]{\thecontentslabel}}% section label (numbered)
{\hspace*{3.8em}}% section label (unnumbered)
{\titlerule*[1pc]{.}% dotted contents line
\thecontentspage% ToC page number
}
}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\newcommand{\ccpt}[1]{\cftchapterprecistoc{#1}}
\begin{document}
\setcounter{tocdepth}{0}
\contentsmargin{0pt}% Remove right margin in ToC
\tableofcontents
\rtocstuff{\includegraphics[valign=T,width=70pt]{tiger}}
\chapter{Coordinates of points}
\ccpt{We will explore how to find the coordinates of various points in the 2-dimensional and 3-dimensional Euclidean spaces.}
\section{Rectangular coordinates} \lipsum[1]
\section{Projections of a segment on the axes} \lipsum[2]
\section{Distance between two points} \lipsum[3]
\section{The mid-point of a segment} \lipsum[4]
\section{Division of a segment in any ratio} \lipsum[5]
\section{Oblique coordinates} \lipsum[6]
\ltocstuff{\includegraphics[valign=T,width=70pt]{tiger}}
\chapter{The locus of an equation}
\ccpt{We will explore how to find the coordinates of various points in the 2-dimensional and 3-dimensional Euclidean spaces.}
\section{First illustrations} \lipsum[1]
\section{Curve plotting} \lipsum[2]
\section{Test that a point lie on a curve} \lipsum[3]
\section{Intercepts} \lipsum[4]
\section{Points of intersection of two curves} \lipsum[5]
\section{Oblique coordinates} \lipsum[6]
\rtocstuff{\includegraphics[valign=T,width=70pt]{tiger}}
\chapter{The straight line}
\section{Equation in terms of point and slope} \lipsum[1]
\section{Line through two points} \lipsum[2]
\section{The general equation of first degree} \lipsum[3]
\section{Parallel and perpendicular lines} \lipsum[4]
\section{Angle between two lines} \lipsum[5]
\section{Distance from a point to a line} \lipsum[6]
\end{document}