我怎样才能为底部的这两个图形添加单一标题?

我怎样才能为底部的这两个图形添加单一标题?

我试过了\caption{\label{fig:your-figure}Caption goes here.}。但是没有用。有人能帮忙吗?

\documentclass[10pt, blue]{beamer}
\mode<presentation>
{
  \usetheme{default}      % or try Darmstadt, Madrid, Warsaw, ...
  \usecolortheme{default} % or try albatross, beaver, crane, ...
  \usefonttheme{default}  % or try serif, structurebold, ...
  \setbeamertemplate{navigation symbols}{}
  \setbeamertemplate{caption}[numbered]
} 

\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\PassOptionsToPackage{demo}{graphicx}
\begin{document}
\begin{frame}
    \centering
    \begin{tabular}{c}
        (a)\\
        \includegraphics[height=3.5cm, width=9cm]{black1}
    \end{tabular}

    \vspace{0.01em}
    \begin{tabular}{c}
        (b)\\
        \includegraphics[height=3.5cm, width=9cm]{black1}
    \end{tabular}
\end{frame}

\end{document}

答案1

在此处输入图片描述

要添加标题,您需要将图像放在figure环境中。使用是tabular多余的:

\documentclass[10pt, blue, demo]{beamer}
\mode<presentation>
{
  \usetheme{default}      % or try Darmstadt, Madrid, Warsaw, ...
  \usecolortheme{default} % or try albatross, beaver, crane, ...
  \usefonttheme{default}  % or try serif, structurebold, ...
  \setbeamertemplate{navigation symbols}{}
  \setbeamertemplate{caption}[numbered]
}

\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
%\PassOptionsToPackage{demo}{graphicx}
\begin{document}
\begin{frame}
\begin{figure}
    \centering
%    \begin{tabular}{c}
        (a)\\
        \includegraphics[height=3.5cm, width=9cm]{black1}
%    \end{tabular}

    \smallskip
%    \begin{tabular}{c}
        (b)\\
        \includegraphics[height=3.5cm, width=9cm]{black1}
%    \end{tabular}
\caption{Caption goes here.}
    \label{fig:your-figure}
\end{figure}
\end{frame}

答案2

你可以使用这个subcaption

\documentclass[10pt, blue]{beamer}
\mode<presentation>
{
  \usetheme{default}      % or try Darmstadt, Madrid, Warsaw, ...
  \usecolortheme{default} % or try albatross, beaver, crane, ...
  \usefonttheme{default}  % or try serif, structurebold, ...
  \setbeamertemplate{navigation symbols}{}
  \setbeamertemplate{caption}[numbered]
} 

\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\PassOptionsToPackage{demo}{graphicx}

\usepackage{subcaption}

\begin{document}

\begin{figure}
    \begin{subfigure}{1\textwidth}\centering
        \caption{This is Caption a}
            \includegraphics[height=3.5cm, width=9cm]{black1}
    \end{subfigure}
    \begin{subfigure}{1\textwidth}\centering
        \caption{This is Caption b}
            \includegraphics[height=3.5cm, width=9cm]{black1}
    \end{subfigure} 
\caption{This is a caption for a and b}
\end{figure}

\end{document}

答案3

您没有环境table,因此\caption实际上没有任何内容可以添加标题。要么将两个tabulars 封装在一个table环境中,要么(我建议在演示中这样做)干脆忘掉\caption,将描述写成一行简单的文本。

相关内容