The following code is a starting point and can be modified for the personal settings.
First some explanation. To provide a list of figures or tables you need an extra file to save the captions. That's equal to the toc
file which is need by tableofcontents
. beamer
uses a special way to create the toc. The reason is very simple -- It's the only way to setup so many user options. However the following part is only a basic. A full implementation with all beamer
features leads to a new package. Up to know I think it's not useful to have a list of figures or so.
First of all we make sure that beamer
opens a file to save all entries of caption separated by list of figures (lof) and by list of tables (lot).
\AtEndDocument{%
\clearpage
\beamer@tempcount=\c@page\advance\beamer@tempcount by -1%
\if@filesw
\immediate\write\@auxout{\string\@writefile{lof}%
{\noexpand\headcommand{\noexpand\beamer@partpages{\the\beamer@partstartpage}{\the\beamer@tempcount}}}}%
\newwrite\tf@lof
\immediate\openout\tf@lof\jobname.lof\relax
\immediate\write\@auxout{\string\@writefile{lot}%
{\noexpand\headcommand{\noexpand\beamer@partpages{\the\beamer@partstartpage}{\the\beamer@tempcount}}}}%
\newwrite\tf@lot
\immediate\openout\tf@lot\jobname.lof\relax
\fi
}
Next step is to tell beamer
that all captions must be written in the lof
or lot
file. Therefor the internal command \beamer@makecaption
must be changed.
The new part is:
\def\@tempa{#1}
\def\@tempb{figure}
\ifx\@tempa\@tempb
\addtocontents{lof}{\protect\listoffigureformat{\insertcaptionnumber}{\insertcaption}}{}{}%
\else
\addtocontents{lot}{\protect\listoffigureformat{\insertcaptionnumber}{\insertcaption}}{}{}%
\fi%
Here is a simple test which test whether the input is a figure or something else. Of course this test can be more clearer to test other types too.
The complete redefinition looks as follows:
\long\def\beamer@makecaption#1#2{%
\def\insertcaptionname{\csname#1name\endcsname}%
\def\insertcaptionnumber{\csname the#1\endcsname}%
\def\insertcaption{#2}%
\def\@tempa{#1}
\def\@tempb{figure}
\ifx\@tempa\@tempb
\addtocontents{lof}{\protect\listoffigureformat{\insertcaptionnumber}{\insertcaption}}{}{}%
\else
\addtocontents{lot}{\protect\listoffigureformat{\insertcaptionnumber}{\insertcaption}}{}{}%
\fi%
\nobreak\vskip\abovecaptionskip\nobreak
\sbox\@tempboxa{\usebeamertemplate**{caption}}%
\ifdim \wd\@tempboxa >\hsize
\usebeamertemplate**{caption}\par
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\nobreak\vskip\belowcaptionskip\nobreak}
Now the contents will be write in the external file with the command
\addtocontents{lot}{\protect\listoffigureformat{\insertcaptionnumber}{\insertcaption}}{}{}%
whereby the command \listoffigureformat
is currently undefined. So I defined the command to format the output of listoffigures
:
\def\listoffigureformat#1#2{#1:~#2\par}
You see it's very simple.
The last step is the definition of \listoffigures
whereby the internal command \@starttoc
is used to read the file \jobname.lof
.
\def\listoffigures{%
\frame{
\frametitle{List of Figures}
\@starttoc{lof}%
}
}
Now the complete example.
\documentclass{beamer}
\makeatletter
\AtEndDocument{%
\clearpage
\beamer@tempcount=\c@page\advance\beamer@tempcount by -1%
\if@filesw
\immediate\write\@auxout{\string\@writefile{lof}%
{\noexpand\headcommand{\noexpand\beamer@partpages{\the\beamer@partstartpage}{\the\beamer@tempcount}}}}%
\newwrite\tf@lof
\immediate\openout\tf@lof\jobname.lof\relax
\immediate\write\@auxout{\string\@writefile{lot}%
{\noexpand\headcommand{\noexpand\beamer@partpages{\the\beamer@partstartpage}{\the\beamer@tempcount}}}}%
\newwrite\tf@lot
\immediate\openout\tf@lot\jobname.lof\relax
\fi
}
\long\def\beamer@makecaption#1#2{%
\def\insertcaptionname{\csname#1name\endcsname}%
\def\insertcaptionnumber{\csname the#1\endcsname}%
\def\insertcaption{#2}%
\def\@tempa{#1}
\def\@tempb{figure}
\ifx\@tempa\@tempb
\addtocontents{lof}{\protect\listoffigureformat{\insertcaptionnumber}{\insertcaption}}{}{}%
\else
\addtocontents{lot}{\protect\listoffigureformat{\insertcaptionnumber}{\insertcaption}}{}{}%
\fi%
\nobreak\vskip\abovecaptionskip\nobreak
\sbox\@tempboxa{\usebeamertemplate**{caption}}%
\ifdim \wd\@tempboxa >\hsize
\usebeamertemplate**{caption}\par
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\nobreak\vskip\belowcaptionskip\nobreak}
\def\listoffigureformat#1#2{#1:~#2\par}
\def\listoffigures{%
\frame{\frametitle{List of Figures}
\@starttoc{lof}%
}
}
\makeatother
\begin{document}
\listoffigures
\begin{frame}
\color{blue}
\begin{figure}
\rule{3cm}{3cm}
\caption{fig 1}
\end{figure}
\end{frame}
\begin{frame}
\begin{figure}
\color{green}
\rule{3cm}{3cm}
\caption{fig 2}
\end{figure}
\end{frame}
\begin{frame}
\begin{figure}
\color{blue}
\rule{3cm}{3cm}
\caption{fig 3}
\end{figure}
\end{frame}
\begin{frame}
\begin{figure}
\color{yellow}
\rule{3cm}{3cm}
\caption{fig 4}
\end{figure}
\end{frame}
\end{document}
![](https://i.stack.imgur.com/ei0du.png)
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](https://i.stack.imgur.com/t2Cz6.png)
Best Answer
The package
newfloat
offers you a simple interface:Full example: