3

If I use the caption package with beamer frames, I get a 'missing number treated as zero'.

The following compiles with texlive, but if I uncomment the \usepackage{caption} line, I get the error.

\documentclass[10pt]{beamer}

\usetheme{metropolis} \usepackage{appendixnumberbeamer}

% \usepackage{caption}

\title{Error} \author{Author} \institute{Stack Overflow}

\begin{document}

\maketitle

\begin{frame} \frametitle{Introduction} \begin{columns} \begin{column}{0.5\textwidth} \begin{figure} \includegraphics[width=.9\linewidth]{example-image-duck} \caption{Duck\footnote[frame]{Duck Duck}} \end{figure} \end{column} \begin{column}{0.5\textwidth} \begin{figure} \includegraphics[width=.9\linewidth]{example-image-duck} \caption{Duck\footnote[frame]{Duck Duck}} \end{figure} \end{column} \end{columns} \end{frame}

\end{document}

  • 1
    Hello and welcome. The error is from the [frame] option added to the macro \footnote[frame]{}. Removing this option will make it work : \caption{Duck\footnote{Duck Duck}}. Where did you get this [frame] option? – AndréC Jul 19 '20 at 05:52
  • I think in general beamer is incompatible with caption. beamer already provides caption-related templates to control style of \caption, see beamer manual, sec. 12.6. Hence you can avoid loading caption by make use of those beamer caption templates. – muzimuzhi Z Jul 19 '20 at 05:55
  • 2
    @AndréC \footnote[frame] is supported by beamer to indicate "this footnote should be typeset at the bottom of the frame", see beamer manual, sec. 12.12. Furthermore, although no errors, using \caption{Duck \footnote{Duck Duck}} produces wrong output, in which the width of column is wider than expected. From beamer issue #268, Incompatibility of beamer with caption package, it seems the compatibility issue is never solved. – muzimuzhi Z Jul 19 '20 at 06:00
  • 1
    On the caption side, it do fixed compatibility reported issues with beamer, see here. So if one can reduce the problem to be caption-related, an issue to https://gitlab.com/axelsommerfeldt/caption/-/issues is welcome. @AndréC I checked again, the too-wide column issue is reproducible even without caption. Sorry for my mis-judgement. – muzimuzhi Z Jul 19 '20 at 06:17
  • I wanted my captions to appear without the labels, so I was using caption package. I removed it and set \setbeamertemplate{caption}{\raggedright\insertcaption\par} as mentioned in this question: https://tex.stackexchange.com/a/82460/220753

    Thank you for your replies.

    – oponkork Jul 19 '20 at 06:38
  • 1
    This is an compatibility issue, and I've reported to caption. See https://gitlab.com/axelsommerfeldt/caption/-/issues/84. – muzimuzhi Z Jul 19 '20 at 07:09
  • @oponkork Or you can use \caption{Dock\footnotemark} and then \footnotetext[1]{Duck Duck} outside of columns environment. – muzimuzhi Z Jul 19 '20 at 07:10
  • @muzimuzhiZ Thank you for all this exciting information. – AndréC Jul 19 '20 at 07:51

1 Answers1

1

Some updates:

Thanks to Axel Sommerfeldt, the author of caption, this compatibility issue has been fixed in caption 2020-07-20, and the update is already installable in TeX Live. MiKTeX users might need to wait.

This update even allows the direct use of \footnote in multi-line \caption, which will produces two copies of footnote text at the bottom of frame in plain beamer.

\documentclass[10pt]{beamer}

\usetheme{metropolis} \usepackage{appendixnumberbeamer}

\usepackage{caption}

\begin{document}

\begin{frame} \frametitle{Introduction} \begin{columns}[t] \begin{column}{0.5\textwidth} \begin{figure} \includegraphics[width=.9\linewidth]{example-image} \caption{Duck\footnote[frame]{Duck Duck}} \end{figure} \end{column} \begin{column}{0.5\textwidth} \begin{figure} \includegraphics[width=.9\linewidth]{example-image} \caption{Duck Duck Duck Duck Duck Duck\footnote[frame]{Duck Duck}} \end{figure} \end{column} \end{columns} \end{frame}

\end{document}

enter image description here

muzimuzhi Z
  • 26,474