Good day,
I changed the font size of 'List of Figures' using:
\usepackage{tocloft}
\renewcommand\cftloftitlefont{\huge}
But how can I now make the title 'List of Figures' bold?
table of contents
Good day,
I changed the font size of 'List of Figures' using:
\usepackage{tocloft}
\renewcommand\cftloftitlefont{\huge}
But how can I now make the title 'List of Figures' bold?
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}
The \caption
has two arguments - one optional and the other mandatory. The contents of optional argument (which is enclosed within []
) is used for the list of figures (if given). If you want to put custom (short) description in the list of figures, use it in the optional argument like:
\caption[<custom string>]{<regular caption>}
A sample code:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\tableofcontents
\listoffigures
\section{some section}
\begin{figure}[htb]
\centering
\includegraphics[width=2cm]{example-image-a}
\caption[Short caption]{Here comes the long caption}
\end{figure}
\end{document}
Best Answer
I'd guess