表格内有图表的表格

表格内有图表的表格

我试图将一个图形(使用 \tabular)放入表格(\tabular)中:

我已经尝试过代码:

\begin{tabular}{cc}
    \begin{figure}
        \begin{tabular}{ccc}
            \includegraphics[width=0.16\linewidth]{example-image} &  
            \includegraphics[width=0.16\linewidth]{example-image} &
            \includegraphics[width=0.16\linewidth]{example-image}
        \end{tabular}
        \caption{Some text}
    \end{figure}
    &
    \begin{figure}
        \begin{tabular}{ccc}
            \includegraphics[width=0.16\linewidth]{example-image} &  
            \includegraphics[width=0.16\linewidth]{example-image} &
            \includegraphics[width=0.16\linewidth]{example-image}
        \end{tabular}
        \caption{Some text}
    \end{figure}
\end{tabular}

\begin{table}{cc}
    \begin{figure}
        \begin{subfigure}
            \includegraphics[width=0.16\linewidth]{example-image}
        \end{subfigure}
        \begin{subfigure}
            \includegraphics[width=0.16\linewidth]{example-image}
        \end{subfigure}
                \begin{subfigure}
            \includegraphics[width=0.16\linewidth]{example-image}
        \end{subfigure}
        \caption{Some text}
    \end{figure}
&
    \begin{figure}
        \begin{subfigure}
            \includegraphics[width=0.16\linewidth]{example-image}
        \end{subfigure}
        \begin{subfigure}
            \includegraphics[width=0.16\linewidth]{example-image}
        \end{subfigure}
                \begin{subfigure}
            \includegraphics[width=0.16\linewidth]{example-image}
        \end{subfigure}
        \caption{Some text}
    \end{figure}
\end{table}

这两个代码块都会出错。

我试图让它看起来像这样: 在此处输入图片描述

谢谢!

答案1

欢迎来到 TeX:SE!

借助tabularx包:

\documentclass{article}
\usepackage{geometry}
\usepackage{tabularx}
\usepackage{graphicx}

\begin{document}
    \begin{figure}[ht]
    \setkeys{Gin}{width=0.32\linewidth}
\begin{tabularx}{\linewidth}{@{} XX @{}}
    \includegraphics{example-image-duck}\hfill 
    \includegraphics{example-image-duck}\hfill
    \includegraphics{example-image-duck}
%
   \caption{Some text}
    &   \includegraphics{example-image-duck}\hfill
        \includegraphics{example-image-duck}\hfill
        \includegraphics{example-image-duck} 
%
        \caption{Some text}
\end{tabularx}
    \end{figure}
\end{document}

在此处输入图片描述

答案2

这是一个不需要任何tabular类似结构的解决方案。

在此处输入图片描述

\documentclass{article} 
\usepackage{graphicx} % for '\includegraphics' macro
\usepackage{caption}  % for '\captionof' macro
\begin{document}

\noindent     
\begin{minipage}[t]{0.48\textwidth}
    \includegraphics[width=0.32\linewidth]{example-image}\hfill  
    \includegraphics[width=0.32\linewidth]{example-image}\hfill
    \includegraphics[width=0.32\linewidth]{example-image}
\captionof{figure}{Some text}
\end{minipage}\hfill
\begin{minipage}[t]{0.48\textwidth}
    \includegraphics[width=0.32\linewidth]{example-image}\hfill  
    \includegraphics[width=0.32\linewidth]{example-image}\hfill
    \includegraphics[width=0.32\linewidth]{example-image}
\captionof{figure}{Some more text}
\end{minipage}
\end{document}

或者,如果您希望将图像放置在figure浮点数中,则可以使用以下代码:

\begin{figure}   
\begin{minipage}[t]{0.48\textwidth}
    \includegraphics[width=0.32\linewidth]{example-image}\hfill  
    \includegraphics[width=0.32\linewidth]{example-image}\hfill
    \includegraphics[width=0.32\linewidth]{example-image}
\caption{Some text}
\end{minipage}\hfill
\begin{minipage}[t]{0.48\textwidth}
    \includegraphics[width=0.32\linewidth]{example-image}\hfill  
    \includegraphics[width=0.32\linewidth]{example-image}\hfill
    \includegraphics[width=0.32\linewidth]{example-image}
\caption{Some more text}
\end{minipage}
\end{figure}

相关内容