\captionof{figure} 不带编号

\captionof{figure} 不带编号

如何在图中显示数字?我正在使用

\setbeamertemplate{caption}[numbered] 

还是一样。请帮帮我。

\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

像这样?

在此处输入图片描述

  • beamer有自己的字幕机制,因此caption不建议使用包
  • 将图像放在figure环境中(在 Beamer 中不是浮动的)
  • 添加缺失的{标题命令
\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}

相关内容