5

I want to put two tables side by side in my document, with (a) and (b) subcaptions for them, and also a global caption "Table 1. Blahblahblah" (spanning to one of the columns only). At the moment I am only able to put the tables with independent captions (as seen in the image below). I've tried the subcaption package and subtable but it claims that subtable environment was undefined. I've also tried the subfigure package but it clashes with the subfig package.

\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}

What I currently get:

My current result

I want something like this below but adding (a) and (b) subcaptions:

enter image description here

Thank you

4

It works with either subcaption: enter image description here

or with floatrow (which makes it easy to have side captions):

enter image description here

I supposed you wanted the row of subtables to be display across both columns. Here's the code, which I commented for the floatrow version:

\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}
  • Thank you, your first option is exactly what I want. However, I get this error when adding the subcaption package. I need the subfig package for some other figures I have with subfloats. Package subcaption Error: This package can't be used in cooperation(subcaption) with the subfig package. \endinput}{} – Zynk Jul 28 '16 at 15:07
  • And you really can't do without subfig? – Bernard Jul 28 '16 at 16:28
  • How then can I put my images with subfloat? It doesn't work without subfig and I don't know another way... – Zynk Jul 29 '16 at 10:06
  • But why do you need subfloat? Subcaption also has a subfigureenvironment, you can define new subfloat types. Floatrow (which cooperates with subcaption, but has more possibilities) has its own commands too. – Bernard Jul 29 '16 at 11:15
0

I'm not sure if you're supposed to load caption and to modify the appearance of table captions. For instance, IEEEtran wants table captions above tables and not below.

Moreover, upon usage of caption you get the warning

Package caption Warning: Unsupported document class (or package) detected,
(caption)                usage of the caption package is not recommended.
See the caption package documentation for explanation.

You can use subfig, though.

Anyway, what you need is the table* environment:

\documentclass[conference]{IEEEtran}
\usepackage[utf8]{inputenc}

\usepackage{lipsum} % just for the example

\usepackage[caption=false]{subfig}
\usepackage{hyperref}

\thispagestyle{plain}   % To force page numbering when using conference IEEEtran
\pagestyle{plain}   % To force page numbering when using conference IEEEtran

\renewcommand{\figurename}{Fig.}  % Fig.2 (rather than Figure 2)
\newlength{\savecw}

\begin{document}

\lipsum

\begin{table*}
\centering

\setlength{\savecw}{\columnwidth}

\caption{Global caption}\label{whatever}

\subfloat[%
  Minimum dimension of an object for it to be detected by the 
  FFT algorithm at different heights\label{tab:dimFFT}%
]{%
  \begin{minipage}{\savecw}
  \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}
  \end{minipage}%
}% end of subfloat
\hfill
\subfloat[%
  Minimum dimension of an object for it to be detected by the
  GMM algorithm at different heights\label{tab:dimGMM}%
]{%
  \begin{minipage}{\savecw}
  \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}
  \end{minipage}%
}% end of subfloat  

\end{table*}

\lipsum[1-12]

\end{document}

enter image description here

  • Thank you for your answer, but I think I didn't express myself clearly. What I want is to put two tables side by side in the same column. Also, their subcaptions should be (a) and (b) and only have one global "Table I" for both of them. See my edited answer. – Zynk Jul 28 '16 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.