86

I am giving a presentation and therefore I am using the beamer class. I have included some figures and it works, but there is no number after "Figure".

My code:

\documentclass{beamer}

\usepackage{graphicx}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{eso-pic}
\usepackage{mathrsfs}
\usepackage{url}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage{hyperref}
\usepackage{booktabs}
\usepackage{wallpaper}
\usepackage{bbm}
\usepackage{cooltooltips}
\usepackage{eso-pic}
\usepackage{everyshi}
\usepackage{calc}
\usepackage{graphicx}
\usepackage{ifthen}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{animate}
\usepackage[singlespacing]{setspace}
\usepackage[absolute,overlay]{textpos}
\usepackage{enumerate}
\usepackage{hyperref}
\newenvironment{changemargin}[2]{%
  \begin{list}{}{%
    \setlength{\topsep}{0pt}%
    \setlength{\leftmargin}{#1}%
    \setlength{\rightmargin}{#2}%
    \setlength{\listparindent}{\parindent}%
    \setlength{\itemindent}{\parindent}%
    \setlength{\parsep}{\parskip}%
  }%
  \item[]}{\end{list}} 
\setbeamercolor{frametitle}{fg=red,bg=white}

\hypersetup{pdfpagemode=FullScreen}
\renewcommand*{\UrlFont}{\normalfont}

\usetheme{Goettingen}
\useinnertheme{circles}
\beamertemplatenavigationsymbolsempty

\setbeamerfont{page number in head/foot}{size=\large}
\setbeamertemplate{footline}[frame number]


%%%
\begin{document}

\frame[plain]{
\titlepage
}

\setbeamertemplate{background canvas}[default]

\frame{
\frametitle{}

\begin{figure}
\begin{center}
\includegraphics[scale=0.2]{varweakness}
\caption{VaR as a quantile}
\end{center}
\end{figure}

}


\end{document}

Which gives the following frame with the figure:

test

(I am not sure what is causing the problem, therefore I did not delete any package.)

How can I get a number, e.g. Figure 1:?

3
  • 2
    You should use \centering instead of \begin{center}\end{center}. Also, you have loaded the graphicx package 3 times and hyperref twice. beamer I believe automatically loads graphicx so you shouldn't need it at all.
    – dustin
    Aug 7, 2013 at 14:54
  • 2
    Others have answered your question, but to note the reasoning. In a presentation, cross-refs by number are usually a bad idea. So the standard beamer settings are not to have any such cross-ref numbers.
    – Joseph Wright
    Aug 7, 2013 at 15:36
  • 3
    @JenBohold Please make your example minimal the next time. Aug 7, 2013 at 18:06

2 Answers 2

132

To achieve numbering of figures, you need to set:

\setbeamertemplate{caption}[numbered]

enter image description here

\documentclass[demo]{beamer}

\setbeamertemplate{caption}[numbered]
\begin{document}

\begin{frame}
  \frametitle{}

  \begin{figure}
    \centering
    \includegraphics{varweakness}
    \caption{VaR as a quantile}
    \label{something}
  \end{figure}

\end{frame}


\end{document}
2
  • I thought it was not recommended to use a floating environment (even though it is not floating here) in a presentation. Shouldn't the ctan.org/pkg/capt-of package be recommended here instead?
    – pluton
    Aug 8, 2013 at 5:32
  • @pluton, I believe that if you put a float inside a frame, it's not going to show up in another slide. The floating freedom is restricted to the other contents in the same frame. Feb 24, 2016 at 14:43
14

You can use the following:

\documentclass{beamer}

\usepackage{lmodern} % get rid of warnings
\usepackage{caption} % improved spacing between figure and caption

\DeclareCaptionLabelSeparator{horse}{:\quad} % change according to your needs
\captionsetup{
  labelsep = horse,
  figureposition = bottom
} 

\setbeamertemplate{caption}[numbered]

\begin{document}

\begin{frame}
  \begin{figure}
    \centering
      \rule{1cm}{1cm}
    \caption{Leprechaun.}
  \end{figure}
\end{frame}

\end{document}

output

Notice that there is no space between the figure number and the colon.

You must log in to answer this question.

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