0

I hope my final table to be like:

| SUBTBL1 | SUBTBL2 |
| SUBTBL3 | SUBTBL4 |

and it is, but part of the table overlaps with the text, what should i do? enter image description here

Here is my preamble :

\documentclass[lettersize,journal]{IEEEtran}
\usepackage{amsmath,amsfonts}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{array}
\usepackage[caption=false,font=normalsize,labelfont=sf,textfont=sf]{subfig}
\usepackage{textcomp}
\usepackage{stfloats}
\usepackage{multirow}
\usepackage{url}
\usepackage{verbatim}
\usepackage{graphicx}
\usepackage{diagbox}
\usepackage{booktabs}
\usepackage{cite}
\usepackage{caption}
\hyphenation{op-tical net-works semi-conduc-tor IEEE-Xplore}

Here is my code:

    \begin{table}[th]
    \centering
    \caption{Result}
    \begin{tabular}{c c}
    \begin{minipage}[b]{0.48\textwidth}\centering
    \resizebox{1.\textwidth}{!}{
    \begin{tabular}{cccccccccc}
    \toprule
    %\hline
    \multirow{2}{*}{K} & \multicolumn{3}{c}{t = 0.1}   & \multicolumn{3}{c}{t = 1}  & \multicolumn{3}{c}{t = 5}           \\
    \cmidrule(lr){2-4} \cmidrule(lr){5-7} \cmidrule(lr){8-10}
& Prc.\% & Rec.\% & F1-Mea.\% & Prc.\% & Rec.\% & F1-Mea.\% & Prec.\% & Rec.\% & F1-Mea.\%\\ \toprule
0.2    & 99.94 & 99.99 & 99.96  & 99.77       & 99.98      & 99.87    & 94.93    &  99.90    &   97.35        \\
0.5    & 99.91  & 99.99   & 99.94   & 99.93        &99.99         & 99.95    & 73.20       &99.62         & 84.39  \\
0.8   &  \textbf{99.95} &  \textbf{99.99 } & \textbf{99.96}  &  99.93      &  99.99       &   99.95    & 99.70      & 99.99        &  99.84  \\ \toprule
\end{tabular}}
\caption{(a)}
\end{minipage}

&

\begin{minipage}[b]{0.48\textwidth}\centering
\resizebox{1.\textwidth}{!}{
\begin{tabular}{cccccccccc}
\toprule
\multirow{2}{*}{K} & \multicolumn{3}{c}{t = 0.1}   & \multicolumn{3}{c}{t = 1}  & \multicolumn{3}{c}{t = 5}           \\
\cmidrule(lr){2-4} \cmidrule(lr){5-7} \cmidrule(lr){8-10}
& Prec.\% & Rec.\% & F1-Mea.\% & Prc.\% & Rec.\% & F1-Mea.\% & Prc.\% & Rec.\% & F1-Mea.\%\\ \toprule
0.2    & 92.19  &  93.27  &  92.72 & \textbf{92.54}   &  \textbf{93.62} &  \textbf{93.07}   & 91.53  & 92.58   & 92.05  \\
0.5    & 92.03   & 93.10    & 92.56 & \textbf{92.54}   &  \textbf{93.62} &  \textbf{93.07} & 91.53       & 92.58  &92.05 \\
0.8   &92.36 &  93.45  &   92.90   & \textbf{92.54}   &  \textbf{93.62} &  \textbf{93.07}  &  91.86   & 92.93   &  92.39    \\ \toprule
\end{tabular}}
\caption{(b)}
\end{minipage}

\\

\begin{minipage}[b]{0.48\textwidth}\centering
\resizebox{1.\textwidth}{!}{
\begin{tabular}{cccccccccc}
\toprule
%\hline
\multirow{2}{*}{K} & \multicolumn{3}{c}{t = 0.1}   & \multicolumn{3}{c}{t = 1}  & \multicolumn{3}{c}{t = 5}           \\
\cmidrule(lr){2-4} \cmidrule(lr){5-7} \cmidrule(lr){8-10}
& Prec.\% & Rec.\% & F1-Mea.\% & Prec.\% & Rec.\% & F1-Mea.\% & Prec.\% & Rec.\% & F1-Mea.\%\\ \toprule
0.2    & 99.85 & 94.45  &   97.07  &  99.85    &  99.55  & 99.69 & \textbf{99.85} & \textbf{99.98}  & \textbf{99.91}     \\
0.5    & 99.89 & 99.25   & 99.56    &  99.85   &  99.73  & 99.78   & \textbf{99.85} & \textbf{99.98}  & \textbf{99.91} \\
0.8   &  99.91 & 94.09   & 96.91     &  99.83   &   95.65  &  97.69  & \textbf{99.85} & \textbf{99.98}  & \textbf{99.91} \\ \toprule
\end{tabular}}
\caption{(c)}
\end{minipage}

&

\begin{minipage}[b]{0.48\textwidth}\centering
\resizebox{1.\textwidth}{!}{
\begin{tabular}{cccccccccc}
\toprule
%\hline
\multirow{2}{*}{K} & \multicolumn{3}{c}{t = 0.1}   & \multicolumn{3}{c}{t = 1}  & \multicolumn{3}{c}{t = 5}           \\
\cmidrule(lr){2-4} \cmidrule(lr){5-7} \cmidrule(lr){8-10}
& Prec.\% & Rec.\% & F1-Mea.\% & Prec.\% & Rec.\% & F1-Mea.\% & Prec.\% & Rec.\% & F1-Mea.\%\\ \toprule
0.2    & 99.99  & 90.47   &  94.99  &  \textbf{99.99}  & \textbf{97.61} &  \textbf{98.78} &  99.99   & 85.71  & 92.30\\
0.5    & 99.99  & 92.85   & 96.28&  \textbf{99.99}  & \textbf{97.61} &  \textbf{98.78} &  99.99      & 88.09   &  93.66\\
0.8   & 99.99 & 92.85  & 96.28   &  \textbf{99.99}  & \textbf{97.61} &  \textbf{98.78}  & 99.99   & 88.09   &  93.66  \\ \toprule
\end{tabular}}
\caption{(d)}
\end{minipage}

\\

\end{tabular}
\end{table}

  • Welcome to TeX.SE. Please read about MWEs. Always post minimal, but complete, working examples. For example, you used \toprule from \usepackage{booktabs} and \multirow from \usepackage{multirow}, but you didn't post your preamble, so anyone else here will have to know or to guess it. That said, I'd considere tables inside minipages or looking for subcaption. – FHZ May 11 '22 at 16:27
  • 2
    From the screenshot you included it appreas as if you're inside of a twocolumn document. If that's correct, you may want to try using table* instead of table. – leandriis May 11 '22 at 16:37
  • You may also want to consider avoiding to rescale your tables as this will lead to inconsistent font sizes throughout your document. For a list of strategies that you can apply in order to make sure an otherwise too wide table fits in the available space, you may want to take a look at: My table doesn't fit; what are my options? – leandriis May 11 '22 at 16:39
  • Thanks, I've tried using table*, but then the table appears on next page not current page. – Kennard Niko May 12 '22 at 00:17

1 Answers1

1

So let's focus here in the organization problem. Therefore, I will compact the tables into a simple one in a separated file named input_tab_A:

\begin{tabular}{lll}
  A & B & C \\
  1 & 2 & 3
\end{tabular}

Separating tabulars into own files allows us to focus in the issue, not in the content. I advice to do it with all too long and too complex tables. If journals require one single tex file, just copy and paste after you finish the hard task of organizing and writing your article.

Next, this answers uses the following links as sources:

Now to the code. I will present more than one method to insert tables. As your issue is related with organization and displacement around text, the lipsum package is used in order to avoid typing text. Sometimes I will insert copies of \input{input_tab_A} to produce some longer table.

The MWE follows

\documentclass[lettersize,journal]{IEEEtran}
\usepackage{float}
\usepackage{lipsum}
\usepackage{caption}
\usepackage{subcaption}
\captionsetup{font=normalsize,labelfont=sf,textfont=sf,position=top}
\begin{document}
\lipsum[1-3]

\begin{minipage}[b]{0.48\linewidth} \centering \begin{table}[H] \captionbox{Legend}[\linewidth]{ \input{input_tab_A} } \end{table} \end{minipage}% \begin{minipage}[b]{0.48\linewidth} \centering \begin{table}[H] \captionbox{Legend}[\linewidth]{ \input{input_tab_A} } \end{table} \end{minipage}

\lipsum[1-3]

\begin{minipage}[b]{0.3\textwidth} \centering \begin{table}[H] \captionbox{!!Error textwidth!!}[\linewidth]{ \input{input_tab_A} } \end{table} \end{minipage}% \begin{minipage}[b]{0.3\textwidth} \centering \begin{table}[H] \captionbox{This table is missing}[\linewidth]{ \input{input_tab_A} } \end{table} \end{minipage}

\begin{table} \captionbox{This table goes through two columns}[\linewidth]{ \input{input_tab_A}\input{input_tab_A} \input{input_tab_A}\input{input_tab_A} \input{input_tab_A}\input{input_tab_A} } \end{table}

\lipsum[1-3]

\begin{table}[!ht] \centering \captionbox{A lot of tables and subtables}[\linewidth]{ \subcaptionbox{First}{ \input{input_tab_A} }\quad \subcaptionbox{Second}{ \input{input_tab_A} }

\subcaptionbox{Third}{
  \input{input_tab_A}
}\quad
\subcaptionbox{Fourth}{
  \input{input_tab_A}
}

} \end{table}

\lipsum[1-7]

\begin{table*}[!ht] \centering \captionbox{A lot of tables and subtables through two columns}[\linewidth]{ \subcaptionbox{First}{ \input{input_tab_A} \input{input_tab_A} \input{input_tab_A} }\quad \subcaptionbox{Second}{ \input{input_tab_A} \input{input_tab_A} \input{input_tab_A} }

\subcaptionbox{Third}{
  \input{input_tab_A}\input{input_tab_A}
  \input{input_tab_A}\input{input_tab_A}
  \input{input_tab_A}\input{input_tab_A}
}\quad
\subcaptionbox{Fourth}{
  \input{input_tab_A}\input{input_tab_A}
  \input{input_tab_A}\input{input_tab_A}
  \input{input_tab_A}\input{input_tab_A}
}

} \end{table*}

\lipsum[1-7]

\begin{figure*} \centering \begin{minipage}[b]{0.3\textwidth} \centering \captionof{table}{First} \input{input_tab_A} \end{minipage}\quad \begin{minipage}[b]{0.3\textwidth} \centering \captionof{table}{Second} \input{input_tab_A} \end{minipage}

\begin{minipage}[b]{0.3\textwidth} \centering \captionof{table}{Third} \input{input_tab_A} \end{minipage} % \begin{minipage}[b]{0.3\textwidth} \centering \captionof{table}{Fourth} \input{input_tab_A} \end{minipage} \end{figure*}

\lipsum[1-10]

\end{document}


Discussion of results

minipage with \linewidth

That's a fine result, each one labeled numericas as table, but only one column. I had to use [H] from float package, that's not elegant (Why should the "H" option not be used in floats?).

enter image description here

minipage with \textwidth

Not nice, tables will certainly far from margins. Bad solution.

enter image description here

table*

Now it is getting better, our very large table fits both columns without disturbing text. Does it go to the next page? -- Yes, this is how the class IEEEtran defines the standard behavior.

enter image description here

table and \subcaptionbox

This solution give us subcaptions! That's look nice, but it is not exactly what you want. It is inside a singe column.

enter image description here

table* and \subcaptionbox

A litte bit closer. Smaller tables can be side bz side, larger tables can't. But it still has the subcaption with letters. Let's try our last move.

enter image description here

figure*, minipage and \captionof

Why not bending the rules in our favor?

The caption package allows us to do the ultimate trick, insert captions of an object inside other environments.

Now we achieve: (1) the desired organization; (2) all tables labeled as table, not as sub-tables; (3) tables crossing columns but not over texts; and (4) keep some elegance avoiding [H].

enter image description here

FHZ
  • 3,939
  • Thanks a lot! But I still have some questions. Is it inevitable to use * if I want to achieve my goal? And is the picture or form sure to go to the next page after using ? In the last method (using figure, minipage and \captionof), if I want the four tables labeled as subtables, what should I do? – Kennard Niko May 13 '22 at 15:55
  • About star: I'm not entirely sure if star is the only method to achive this and I don't know how to edit its behavior properly, since I don't use IEEEtran or other two columns classes quite often and, remember, star is the standard option, check X. FLOATING STRUCTURES, D. Double Column Floats in the manual. Besides, when reading a paper with a large table, placing it at the top of the next page is "the very standard", it is much more clear to the reader than breaking the text in the middle of the page. It doesn't disturb the reading flow. – FHZ May 13 '22 at 16:44
  • About "four tables labeled as subtables": The method "table* and \subcaptionbox" does exactly this. You may indeed use some minipage to organize sub-tables. – FHZ May 13 '22 at 17:23
  • OK, I see. Thank you again! – Kennard Niko May 14 '22 at 00:42
  • @KennardNiko, check this answer to understand the behavior of *. – FHZ May 15 '22 at 19:35