1

how to show number in figure?. I am using

\setbeamertemplate{caption}[numbered] 

still the same. please help me.

\documentclass{beamer}
\setbeamertemplate{caption}[numbered]
\usepackage{tikz}
\usepackage{epsfig}
\usepackage{ragged2e}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{graphicx}
%\usepackage{graphtex}
\usepackage{caption} 
\usepackage{float,rotating,subfigure}
\useinnertheme[shadow=true]{rounded}
\hfuzz=20pt
\vfuzz=20pt
\hbadness=5000
\vbadness=\maxdimen


\newtheorem{thm}{Theorem}[section]
\newtheorem{defn}[thm]{Definition}
\newtheorem{exa}[thm]{Example}
\newtheorem{obs}[thm]{Observation}
%\newtheorem{note}[thm]{note}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{lem}[thm]{Lemma}
\newtheorem{pro}[thm]{Proposition}
\newtheorem{ill}[thm]{Illustration}
\newtheorem{con}[thm]{Conjecture}
\newtheorem{remark}[thm]{Remark}
\newcommand{\pt}{{$\!\!\!$\bf.$\,$ }}        
\usetheme{Copenhagen}

\begin{document}
\begin{frame}
\begin{exa}\vspace{20pt} \rm
    Figure 1 shows a digraph $G$ of order 4. $G$ has a set of vertices $X=\{x_1,x_2,x_3,x_4 \}$, and a set of arcs $U=\{u_1,u_2,u_3,u_4,u_5,u_6 \}$, where  $u_1=(x_1,x_2)$, $u_2=(x_1,x_3)$, $u_3=(x_2,x_4)$, $u_4=(x_3,x_4)$, $u_5=(x_4,x_1)$, and $u_6=(x_4,x_4)$ and a loop $u_6$.
\end{exa}

\begin{center}
    \begin{tikzpicture}[shorten >=2pt] 
    \tikzstyle{vertex} = [circle,draw=black!45,minimum size=10mm]

    \node[vertex]   (v3) at (4,2)   {$x_3$};
    \node[vertex]   (v2) at (0,2)   {$x_2$};
    \node[vertex]   (v1) at (2,2)   {$x_1$};
    \node[vertex]   (v4) at (2,4)   {$x_4$};

    \draw   [blue,->](v4) to [loop right] node[right] {} (v4); 
    \draw   [blue,->] (v1)--(v3);
    \draw   [blue,->] (v4)--(v1);
    \draw   [blue,->] (v1)--(v2);
    \draw   [blue,->] (v2)--(v4);
    \draw   [blue,->] (v3)--(v4);
    \end{tikzpicture}
\end{center}
\begin{center}
\captionof{figure}A digraph $G$ of order 4.}
\end{center}
\end{frame}

\end{document}
1
  • 1
    Welcome to TeX.SE!
    – Zarko
    Mar 29 '20 at 8:16
2

Like this?

enter image description here

  • beamer has own mechanism for captions, so use caption package is not advisible
  • enclose your image in figure environment (which in beamer is not float)
  • add missing { in caption command
\documentclass{beamer}
\setbeamertemplate{caption}[numbered]
\usepackage{tikz}
%\usepackage{epsfig}
\usepackage{ragged2e}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
%\usepackage{graphicx} %    loaded by beamer
%\usepackage{graphtex}
%\usepackage{caption}
\usepackage{float,rotating,subfigure}% float: not needed, 
                                     % subfigure: obsolete, rather use subfig or subcaption
\useinnertheme[shadow=true]{rounded}
\hfuzz=20pt
\vfuzz=20pt
\hbadness=5000
\vbadness=\maxdimen


\newtheorem{thm}{Theorem}[section]
\newtheorem{defn}[thm]{Definition}
\newtheorem{exa}[thm]{Example}
\newtheorem{obs}[thm]{Observation}
%\newtheorem{note}[thm]{note}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{lem}[thm]{Lemma}
\newtheorem{pro}[thm]{Proposition}
\newtheorem{ill}[thm]{Illustration}
\newtheorem{con}[thm]{Conjecture}
\newtheorem{remark}[thm]{Remark}
\newcommand{\pt}{{$\!\!\!$\bf.$\,$ }}
\usetheme{Copenhagen}

\begin{document}
\begin{frame}
\begin{exa}\vspace{20pt} \rm
    Figure 1 shows a digraph $G$ of order 4. $G$ has a set of vertices $X=\{x_1,x_2,x_3,x_4 \}$, and a set of arcs $U=\{u_1,u_2,u_3,u_4,u_5,u_6 \}$, where  $u_1=(x_1,x_2)$, $u_2=(x_1,x_3)$, $u_3=(x_2,x_4)$, $u_4=(x_3,x_4)$, $u_5=(x_4,x_1)$, and $u_6=(x_4,x_4)$ and a loop $u_6$.
\end{exa}

\begin{figure}% <---
    \begin{tikzpicture}[shorten >=2pt]
    \tikzstyle{vertex} = [circle,draw=black!45,minimum size=10mm]

    \node[vertex]   (v3) at (4,2)   {$x_3$};
    \node[vertex]   (v2) at (0,2)   {$x_2$};
    \node[vertex]   (v1) at (2,2)   {$x_1$};
    \node[vertex]   (v4) at (2,4)   {$x_4$};

    \draw   [blue,->](v4) to [loop right] node[right] {} (v4);
    \draw   [blue,->] (v1)--(v3);
    \draw   [blue,->] (v4)--(v1);
    \draw   [blue,->] (v1)--(v2);
    \draw   [blue,->] (v2)--(v4);
    \draw   [blue,->] (v3)--(v4);
    \end{tikzpicture}
\caption{A digraph $G$ of order 4.} % <---
\end{figure}% <---
\end{frame}

\end{document}
1
  • thank you so much @Zarko.
    – El Numeral
    Mar 29 '20 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.