我想在我的文档中并排放置两个表格,并为它们添加 (a) 和 (b) 子标题,以及一个全局标题“表格 1. Blahblahblah”(仅跨越其中一列)。目前,我只能将表格与独立的标题一起放置(如下图所示)。我尝试了 subcaption 包和 subtable,但它声称 subtable 环境未定义。我也尝试了 subfigure 包,但它与 subfig 包冲突。
\documentclass[conference]{IEEEtran}
\thispagestyle{plain} % To force page numbering when using conference IEEEtran
\pagestyle{plain} % To force page numbering when using conference IEEEtran
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\newcommand{\subfigureautorefname}{\figureautorefname} % For autoref to name subfloats as Figure
\renewcommand{\tablename}{Table}
%%%%%%%%%% FIGURES %%%%%%%%%%%
\usepackage[justification=centering]{caption} % Figures caption
\usepackage{graphicx}
\captionsetup{labelsep = period} % Figure 2. Caption (rather than Figure 2: Caption)
\usepackage{float} % To place figures where I want with [H]
\usepackage{subfig} % For subfigures
\renewcommand{\figurename}{Fig.} % Fig.2 (rather than Figure 2)
\usepackage[export]{adjustbox}
\begin{document}
\begin{table}[H]
\centering
\begin{subfloat}
\centering
\begin{tabular}{|c|c|}
\hline
\textbf{h [m]} & \textbf{dim [m]} \\ \hline
30 & 0.75 \\ \hline
50 & 1.25 \\ \hline
70 & 1.75 \\ \hline
100 & 2.50 \\ \hline
\end{tabular}
\caption{Minimum dimension of an object for it to be detected by the FFT algorithm at different heights}
\label{tab:dimFFT}
\end{subfloat}%
\begin{subfloat}
\centering
\begin{tabular}{|c|c|}
\hline
\textbf{h [m]} & \textbf{dim [m]} \\ \hline
30 & 0.28 \\ \hline
50 & 0.47 \\ \hline
70 & 0.66 \\ \hline
100 & 0.94 \\ \hline
\end{tabular}
\caption{Minimum dimension of an object for it to be detected by the GMM algorithm at different heights}
\label{tab:dimGMM}
\end{subfloat}
\end{table}
\end{document}
我目前得到的是:
我想要下面这样的内容,但添加(a)和(b)子标题:
谢谢
答案1
或使用floatrow
(这样可以轻松添加侧边字幕):
我猜你想让子表的行显示在两列中。以下是我针对该floatrow
版本注释的代码:
\documentclass[conference]{IEEEtran}
\thispagestyle{plain} % To force page numbering when using conference IEEEtran
\pagestyle{plain} % To force page numbering when using conference IEEEtran
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\newcommand{\subfigureautorefname}{\figureautorefname} % For autoref to name subfloats as Figure
\renewcommand{\tablename}{Table}
%%%%%%%%%% FIGURES %%%%%%%%%%%
\usepackage[justification=centering]{caption} % Figures caption
\usepackage{graphicx}
\captionsetup{labelsep = period} % Figure 2. Caption (rather than Figure 2: Caption)
%\usepackage{float} % To place figures where I want with [H]
\renewcommand{\figurename}{Fig.} % Fig.2 (rather than Figure 2)
\usepackage[export]{adjustbox}
\usepackage{caption, subcaption, floatrow}
\begin{document}
\begin{table*}%[H]
\centering
\captionsetup[subtable]{position = below}
\captionsetup[table]{position=top}
\caption{Blahblah}
\begin{subtable}{0.3\linewidth}
\centering
\begin{tabular}{|c|c|}
\hline
\textbf{h [m]} & \textbf{dim [m]} \\ \hline
30 & 0.75 \\ \hline
50 & 1.25 \\ \hline
70 & 1.75 \\ \hline
100 & 2.50 \\ \hline
\end{tabular}
\caption{Minimum dimension of an object for it to be detected by the FFT algorithm at different heights}
\label{tab:dimFFT}
\end{subtable}%
\hspace*{4em}
\begin{subtable}{0.3\linewidth}
\centering
\begin{tabular}{|c|c|}
\hline
\textbf{h [m]} & \textbf{dim [m]} \\ \hline
30 & 0.28 \\ \hline
50 & 0.47 \\ \hline
70 & 0.66 \\ \hline
100 & 0.94 \\ \hline
\end{tabular}
\caption{Minimum dimension of an object for it to be detected by the GMM algorithm at different heights}
\label{tab:dimGMM}
\end{subtable}
\end{table*}
%
% \begin{table*}%[H]
% \centering
% \floatsetup[subtable]{capposition=beside, capbesideposition=bottom, capbesidesep=none}
% \floatsetup[table]{capposition= top}
% \captionsetup[subtable]{justification =justified}
% \ttabbox[\FBwidth]
% {\begin{subfloatrow}
% \ttabbox[1.25\FBwidth]{\caption{Minimum dimension of an object for it to be detected by the FFT algorithm at different heights}
% \label{tab:dimFFT1}}%
% {\begin{tabular}{|c|c|}
% \hline
% \textbf{h [m]} & \textbf{dim [m]} \\ \hline
% 30 & 0.75 \\ \hline
% 50 & 1.25 \\ \hline
% 70 & 1.75 \\ \hline
% 100 & 2.50 \\ \hline
% \end{tabular}}
% \ttabbox[1.25\FBwidth]{ \caption{Minimum dimension of an object for it to be detected by the GMM algorithm at different heights}
% \label{tab:dimGMM1}}
% {\begin{tabular}{|c|c|}
% \hline
% \textbf{h [m]} & \textbf{dim [m]} \\ \hline
% 30 & 0.28 \\ \hline
% 50 & 0.47 \\ \hline
% 70 & 0.66 \\ \hline
% 100 & 0.94 \\ \hline
% \end{tabular}}
% \end{subfloatrow}}%
% {\caption{Blahblah}}
% \end{table*}
\end{document}