30

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.

2 Answers 2

30

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

\begin{figure}
  \includegraphics{myimage}
  \caption{My figure caption}
  \addtocontents{lof}{%
    \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}$%
    \quad
  \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:

example list of figures

10
  • 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\centerline{\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, 2012 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. Nov 15, 2012 at 16:08
  • 1
    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, 2012 at 16:55
  • 2
    Holy cow you guys, this is awesome! Have you considered turning this into a package?
    – doncherry
    Nov 25, 2012 at 17:40
  • 3
    @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, 2012 at 22:15
6

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...

Here is my adapted version:

\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: List of Figures with Thumbs http://www.img-load.de/images-i1536106bumrve.png

3
  • 1
    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, 2014 at 13:50
  • 1
    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 :) Feb 14, 2014 at 15:27
  • The link in the this question is broken. Please include images directly in the post. Jan 10, 2021 at 11:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .