如何添加强制嵌套表格

如何添加强制嵌套表格

我有一些数据表,我想添加强制嵌套表,即如下所示:

在此处输入图片描述

读完评论后 tex.stackexchange.com/a/5770,这个解决方案不适合我的目的:1-我需要在标题表而不是两边的图形中显示。2-使用图形标签时表格不会显示。

在此处输入图片描述

代码 :

                \documentclass[a4paper,12pt]{article}
                \usepackage[margin=2cm]{geometry}
                \usepackage{adjustbox}
                \usepackage{multirow}
                \usepackage{graphicx}
                \usepackage{amsmath}
                \usepackage{algorithm}
                \usepackage[noend]{algpseudocode}
                \usepackage{array}
                \usepackage{makecell}
                        \usepackage[utf8]{inputenc}
                        \usepackage[T1]{fontenc}
                        \usepackage{lmodern}
                        \usepackage{graphicx}
                        \usepackage{caption}

                \begin{document}

                \begin{figure}
                    \centering
                    \begin{minipage}{0.45\textwidth}
                        \centering
                        \begin{table}
                        \begin{tabular}{|c|c|c|c|}
                            \hline
                            \multirow{2}{*}{\thead{Data \\ I}} & \multirow{2}{*}{P} &\multirow{2}{*}{\thead{A \\ 0T}} & \multirow{2}{*}{CT}\\
                             & & & \\ 
                            \hline
                            AAA&65.77&85.42&51.35\\
                            AAT&4.6&59.4&0.6\\
                            \hline
                            Mean&39.8&39.8&39.8\\
                            \hline
                            \end{tabular}
                        \end{table}
                        \caption{Table 1}
                    \end{minipage}\hfill
                    \begin{minipage}{0.45\textwidth}
                        \centering
                        \includegraphics[width=0.9\textwidth]{example-image-b} % second figure itself
                        \caption{second figure}
                    \end{minipage}
                \end{figure}

                \end{document}

答案1

感谢@Torbjørn T

解决方案是:

    \documentclass[a4paper,12pt]{article}
    \usepackage[margin=2cm]{geometry}
    \usepackage{adjustbox}
    \usepackage{multirow}
    \usepackage{graphicx}
    \usepackage{amsmath}
    \usepackage{algorithm}
    \usepackage[noend]{algpseudocode}
    \usepackage{array}
    \usepackage{makecell}
            \usepackage[utf8]{inputenc}
            \usepackage[T1]{fontenc}
            \usepackage{lmodern}
            \usepackage{graphicx}
            \usepackage{caption}

    \begin{document}

    \begin{table}

        \centering
        \begin{minipage}{0.45\textwidth}
            \centering

            \begin{tabular}{|c|c|c|c|}
                \hline
                \multirow{2}{*}{\thead{Data \\ I}} & \multirow{2}{*}{P} &\multirow{2}{*}{\thead{A \\ 0T}} & \multirow{2}{*}{CT}\\
                 & & & \\ 
                \hline
                AAA&65.77&85.42&51.35\\
                AAT&4.6&59.4&0.6\\
                \hline
                Mean&39.8&39.8&39.8\\
                \hline
                \end{tabular}

            \caption{Average errors}
        \end{minipage}\hfill
        \begin{minipage}{0.45\textwidth}
            \centering
            \centering

            \begin{tabular}{|c|c|c|c|}
                \hline
                \multirow{2}{*}{\thead{Data \\ I}} & \multirow{2}{*}{P} &\multirow{2}{*}{\thead{A \\ 0T}} & \multirow{2}{*}{CT}\\
                 & & & \\ 
                \hline
                AAA&65.77&85.42&51.35\\
                AAT&4.6&59.4&0.6\\
                \hline
                Mean&39.8&39.8&39.8\\
                \hline
                \end{tabular}

            \caption{Average success}
        \end{minipage}

    \end{table}
    \end{document}

相关内容