Graphics, Figures & TablesWhy caption is not numbered?

Information and discussion about graphics, figures & tables in LaTeX documents.
paulosousa
Posts: 90
Joined: Sun Jun 24, 2012 8:48 pm

Why caption is not numbered?

Post by paulosousa »

Hello all,

I am making a beamer presentation, I have a problem with the caption of a table and for the figures: they are not numbered... why?
Could anyone please help me?

Code: Select all

\documentclass[12pt, compress]{beamer}
\usepackage{beamerthemeshadow}
\usepackage[english]{babel}
\usepackage[applemac]{inputenc}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage[round]{natbib}
\newcommand{\newblock}{}
\usepackage[font=scriptsize]{caption}

\usetheme{Warsaw}
\usecolortheme[named=purple]{structure}

\begin{document}
\setbeamerfont{frametitle}{size=\small, labelfont=bf} 
\setbeamertemplate{caption}[numbered]

\begin{frame}
\frametitle{Introduction}
\begin{table}[h]
\captionof{table}{TABLE NAME}
\begin{center}
\begin{tabular}{|c|c|}
\hline 
A & B \\ 
\hline 
C & D \\ 
\hline 
\end{tabular} 
\end{center}
\end{table}
\end{frame}

\begin{frame}
\frametitle{Electrophysiology of the heart}
\begin{figure}[h]
\begin{center}
\includegraphics[scale=0.250]{img/img2b.png} 
\caption{... \\ Reproduced from \citep{malmivuo1995bioelectromagnetism}}
\end{center}
\end{figure}
\end{frame}

\begin{frame}
 \tiny   
 \bibliographystyle{abbrvnat}
 \bibliography{references}
\end{frame}

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Why caption is not numbered?

Post by Johannes_B »

Besides a few errors all captions are there. I think you should know how important a proper minimal working example is by now.

Have a look at your code, i made some adjustments.

Code: Select all

\documentclass[12pt, compress]{beamer}
\usepackage{beamerthemeshadow}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage[round]{natbib}
%\newcommand{\newblock}{}%JB: Already defined
\usepackage[font=scriptsize]{caption}

\usetheme{Warsaw}
\usecolortheme[named=purple]{structure}

\begin{document}
\setbeamerfont{frametitle}{size=\small,
%labelfont=bf%JB: Undefinded
}
\setbeamertemplate{caption}[numbered]

\begin{frame}
	\frametitle{Introduction}
	\begin{table}[h]%Why the placement specifier?
		\captionof{table}{TABLE NAME}
%		\begin{center}%JB: use
		\centering
		%instead
			\begin{tabular}{|c|c|}
				\hline
				A & B \\
				\hline
				C & D \\
				\hline
			\end{tabular}
%		\end{center}
	\end{table}
\end{frame}

\begin{frame}
	\frametitle{Electrophysiology of the heart}
	\begin{figure}[h]%Why the placement specifier?
%		\begin{center}%JB: use
		\centering
		%instead
		\includegraphics[width=.7\textwidth]{example-image}
		\caption{... }

			%JB the other one gave me an error
				Reproduced from \citep{malmivuo1995bioelectromagnetism}
		
%		\end{center}
	\end{figure}
\end{frame}

\end{document}
Why do you need captions in a presentation? You don't need to refer to them, you can oint on them and tell what's going on in the picture.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
paulosousa
Posts: 90
Joined: Sun Jun 24, 2012 8:48 pm

Why caption is not numbered?

Post by paulosousa »

Running exactly your code I got no numbered table even picture, please see the uploaded attachment ... (sorry for the picture size!) I am missing something?
Screen Shot 2014-08-08 at 16.19.25.png
Screen Shot 2014-08-08 at 16.19.25.png (98.4 KiB) Viewed 14846 times
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Why caption is not numbered?

Post by Johannes_B »

Running exactly my code i get the same result as i have when clicking on »open in wirtelatex« just above my code. Please do so as well and try to figure out any any differences. I really need to hear back from you, cause either you had a really bad day, or i did.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
paulosousa
Posts: 90
Joined: Sun Jun 24, 2012 8:48 pm

Re: Why caption is not numbered?

Post by paulosousa »

Johannes, sorry but don't understand what do you mean.
I am using TeXmaker...
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Why caption is not numbered?

Post by Johannes_B »

Take your time ...

You said you ran my code exactely, which i did not (and still don't) believe you. Please click on »Open in writelatex« just above the code box in one of my previous posts to really run the code i gave you. Apart from the captions, there is one big difference.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: Why caption is not numbered?

Post by Stefan Kottwitz »

The editor is not relevant. Perhaps you have an older version of the beamer package, if your version does not what Johannes' version and writeLaTeX does. In that case you could update, possibly your whole TeX installation so all would be up to date.

Stefan
LaTeX.org admin
paulosousa
Posts: 90
Joined: Sun Jun 24, 2012 8:48 pm

Why caption is not numbered?

Post by paulosousa »

I will update but if I remove

Code: Select all

\usepackage[font=scriptsize]{caption}
then the numbered comes back!
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: Why caption is not numbered?

Post by Stefan Kottwitz »

So it's a compatibility issue with caption and beamer. I remember it from some time ago, beamer had its own caption features and it did not work together. The authors should have fixed it.

So you can work without caption, or update to use both later together. I think it's solved now?

Stefan
LaTeX.org admin
paulosousa
Posts: 90
Joined: Sun Jun 24, 2012 8:48 pm

Re: Why caption is not numbered?

Post by paulosousa »

Stefan, I am downloading MacTeX.pkg to update it ...
Post Reply