如何为表格内的图形添加标题

如何为表格内的图形添加标题

我想给表格中的图片添加标题。如果我使用\begin{figure}...\caption{caption} \end{figure},会出现编译错误。有人能帮我解决这个问题吗?

在此处输入图片描述

这是我的代码:

\documentclass[compress]{beamer} 
\usetheme{Warsaw}
\usepackage{setspace} 
\usepackage[hang,footnotesize]{caption}
\usepackage[subrefformat=parens]{subcaption}
\captionsetup{compatibility=false}
\usepackage{amsmath}
\DeclareMathOperator{\sinc}{sinc}

\setbeamercolor{page number in head/foot}{fg=white}
\setbeamerfont{page number in head/foot}{size=\tiny}
\setbeamertemplate{page number in head/foot}[totalframenumber]

\title[]{Beamer title}
\author[]{Author name}

\begin{document}
\begin{frame}{Frame title }
    \begin{tabular}{ll}
        \begin{tabular}{c}
            %\begin{figure}
               \includegraphics[width=0.4\linewidth]{sample.jpg}
            %    \caption{Caption of figure} 
            %\end{figure} 
        \end{tabular} 
        &
        \begin{tabular}{l}
            \parbox{0.5\linewidth}{\footnotesize 
                \begin{itemize}
                    \item Some explanation about figure with more than one lines. 
                    \item Some explanation about figure with more than one lines. 
                    \item Some explanation about figure with more than one lines. 
                \end{itemize}
            }
        \end{tabular}
    \end{tabular}
\end{frame}
\end{document}

答案1

您可以使用caption位于\captionof{figure}{<caption>}块环境中(如minipage):

在此处输入图片描述

\documentclass[compress]{beamer} 

\usetheme{Warsaw}
\usepackage[hang,footnotesize]{caption}

\setbeamercolor{page number in head/foot}{fg=white}
\setbeamerfont{page number in head/foot}{size=\tiny}
\setbeamertemplate{page number in head/foot}[totalframenumber]

\begin{document}

\begin{frame}{Frame title }
  \begin{tabular}{ c c }
    \begin{minipage}{0.4\linewidth}
      \centering
      \includegraphics[width=\linewidth]{example-image}
      \captionof{figure}{Caption of figure} 
    \end{minipage} 
    &
      \parbox{0.5\linewidth}{\footnotesize 
      \begin{itemize}
        \item Some explanation about figure with more than one lines. 
        \item Some explanation about figure with more than one lines. 
        \item Some explanation about figure with more than one lines. 
      \end{itemize}
    }
  \end{tabular}
\end{frame}

\end{document}

请注意,在演示文稿中使用“浮动”并不像在文章中那样具有影响力/引用能力。观看演示文稿的人没有办法四处寻找图表或表格。最好在图表中包含典型的“图表:”或“表格:”引用的同时给出一个可以理解的适当标题。

相关内容