# How to get thumbnails in a list of figures?

To be honest, I'm not sure if I really want this because I can't imagine how exactly it would look. But maybe someone is interested in this, too, or even has already written code to achieve this: it might be practical or interesting to have small thumbnail previews of a figure in the list of figures next to the caption.

This has already been briefly discussed here List of figures: source below image caption? but without any result so if anybody wants to give it a shot or has already done so: yay! :)

See Heiko's answer for an example image of how this might look.

-

Macro \addtocontents allows something to put into the list of figures:

\begin{figure}
\includegraphics{myimage}
\caption{My figure caption}
\protect\centerline{%
\protect\includegraphics[width=.25\linewidth]{myimage}%
}%
}%
\end{figure}


Variant with vertically centered image between number of figure and caption text:

\documentclass{article}
\usepackage{graphicx}
\newlength{\lofthumbsize}
\setlength{\lofthumbsize}{2em}

\newif\iflofimage
\DeclareRobustCommand*{\lofimage}[2][]{%
\iflofimage
$\vcenter to \lofthumbsize{\vss% \hbox to \lofthumbsize{\hss\includegraphics[{width=\lofthumbsize,height=\lofthumbsize,keepaspectratio=true,#1}]{#2}\hss}% \vss}$%
\fi
\ignorespaces
}
\begin{document}
\lofimagetrue
\listoffigures
\lofimagefalse
\begin{figure}
\caption{\lofimage{foo}Hello World}
\end{figure}
\begin{figure}
\caption{\lofimage{bar}Foobar}
\end{figure}
\end{document}


This looks like this:

-
Wow, I didn't know it was this easy. I tried something like this: \newcommand{\figureincludegraphics}[2][\empty]{\ifthenelse{\equal{#1}{\empty}}{‌​\includegraphics{#2}}{\includegraphics[#1]{#2}}\addtocontents{lof}{\protect\cente‌​rline{\protect\includegraphics[width=\linewidth,height=5em,keepaspectratio=true]{‌​#2}}}} which works but looks pretty awful to be honest. Maybe instead of having a large picture above the respective LoF line, having one at the beginning of the line or between number and caption would look better. Is there a similarly easy way to achieve this? – Christian Nov 15 '12 at 16:04
@Christian \leftline instead of \centerline puts the image at the beginning of the line. If \addtocontents is given after \caption, then the image is put below the respective LoF line. – Heiko Oberdiek Nov 15 '12 at 16:08
I added an example LoF to your answer. Obviously, the variance in the line heights is the main downer currently. In principle it looks almost surprisingly ok though I have to say. I'm astonished nobody ever did this as far as I know. If anybody wants to discuss whether this is a typographical disaster or actually a nice feature, I'd welcome your opinion. – Christian Nov 16 '12 at 16:55
Holy cow you guys, this is awesome! Have you considered turning this into a package? – doncherry Nov 25 '12 at 17:40
@doncherry Flagged as you requested. For a package I personally find the explicit \lofimage solution still too unwieldy. Something automatic would be nicer but also much, much more complex. So maybe some package would be better than none at all; I don't know. – Christian Nov 25 '12 at 22:15

The solution of Heiko looks nice and is easy to implement, however it does not produce exactly what I want. On the printout, the thumbnails are much too small imo. Increasing the size results in rather empty pages...

\documentclass{article}
\usepackage{graphicx}
\newlength{\lofthumbsize}
\setlength{\lofthumbsize}{8em}

\newif\iflofimage
\DeclareRobustCommand*{\lofimage}[2][]{%
\iflofimage
$\vspace*{-1.2\baselineskip} \hbox to .7\columnwidth{\hss\raisebox{1\baselineskip}{\includegraphics[{width=\lofthumbsize,keepaspectratio=true,#1}]{#2}}\hss}%$%
\vspace*{0.2\baselineskip}
\newline
\fi
\ignorespaces
}
\begin{document}
\lofimagetrue

\twocolumn
\begingroup
\let\onecolumn\twocolumn
\listoffigures
\endgroup
\onecolumn

\lofimagefalse
\begin{figure}
\caption{\lofimage{foo}Hello World}
\end{figure}
\begin{figure}
\caption{\lofimage{bar}Foobar}
\end{figure}
\end{document}


And here is how it looks like:

-
That looks pretty nice. I think I'd also introduce a height= argument to prevent portrait images from becoming too large but overall, this seems pretty neat :) One thing is troubling though .... collision avoidance in planes doesn't even use hex grids? ;) – Christian Feb 14 '14 at 13:50
Since I have landscapes only I skipped the height to have all pics aligned above each other... but you'll need height for portraits. Concerning the hex grids, that's the related work only - I know better :) – Alexander Kuenz Feb 14 '14 at 15:27