1

Here is the template I use for the following journal. I have problems with all the tables that are perfect in regular latex document. Here is the page with all the tables:

enter image description here

Here is the packages I added and the tables:

% *** MATH PACKAGES ***
%
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{algorithm}
\usepackage{textcomp}
\usepackage{filecontents}
\usepackage{microtype}
\usepackage{float}
\usepackage{adjustbox}
\usepackage{booktabs,makecell,tabularx}
\usepackage{url}
\usepackage{booktabs}
\usepackage{subfigure}
\newcommand{\tvar}[2]{%
    \mathrm{#1}_{\mathrm{#2}}%
}
\renewcommand\theadfont{\small}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{siunitx}
\usepackage[utf8]{inputenc}
\renewcommand{\thetable}{\arabic{table}}
\usepackage{etoolbox}
\usepackage{xparse}
\makeatletter
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}
\begin{document}

\begin{table}[!htb]
    \centering
    \setlength{\tabcolsep}{2pt}
    \small
    \begin{tabularx}{0.6\columnwidth}{@{}c L S[table-format=7.0]*{2}{S[table-format=2.0]}@{}}
        \toprule
        \thead{ID}  &   \thead{UCI Dataset Name} 
        &   {\thead{Samples}}
        &   {\thead{Attributes}} 
        &   {\thead{Classes}}           \\
        \midrule
        DS2 & \textbf {Pfsddfs}- cdfsads dfsdffdss                      & 2222222  & 22    & 5     \\
        DS2 & \textbf {ESSSS} - cdfsads dfsdffdss cdfsads dfsdffdss cdfsads dfsdffdss cdfsads dfsdffdss 
        & 45555  & 9    & 2     \\
        DS3 & \textbf {AAAA} -  cdfsads dfsdffdss cdfsads dfsdffdss cdfsads dfsdffdss  & 22222  & 54     & 7     \\
        DS4 & \textbf {ABBB} - cdfsads dfsdffdss cdfsads dfsdffdss cdfsads dfsdffdss    & 539383  & 28    & 2    \\
        DS5 & \textbf {SSSS}                                & 60000 &  3 & 3       \\

        \bottomrule
    \end{tabularx}
    \caption{Ssdfsdfsddgs dgfgdsg gsdgsfggdfsfgd sdfgfgsd}
    \label{table:2}
\end{table}

    \begin{table}[!htb]
    \centering
    \sisetup{table-format=2.3, table-number-alignment=center, tight-spacing,}% table-column-width =2.5cm 
    \setlength{\tabcolsep}{3pt}
    \small
    \centering

    \sisetup{detect-weight,mode=text}
    \renewrobustcmd{\bfseries}{\fontseries{b}\selectfont}
    \renewrobustcmd{\boldmath}{}
    % abbreviation
    \newrobustcmd{\B}{\bfseries}
    % shorten the intercolumn spaces
    \setlength{\tabcolsep}{4pt}
    \begin{tabular}{l>{\centering}lSSSS}
        \toprule

        \thead {Dataset \\ Name}  & {\thead{No. of processed \\ records} }& {\thead{fsad fsd Trfsdee\\ Acc }} & {\thead{fsdd\\ Acc} }
        & {\thead{dfsadf Alg\\Acc} } & {\thead{dfsfds fsd\\ J48}} \\ [0.5ex]
        \midrule
        Pfds fssdf & 200K to 900K & 0.504 & 0.504 & \B 0.504  & 0.504 \\
        Pfds fssd & 200K to 900K & 0.524 & \B 0.546 & \B 0.546  & 0.498\\
        dfsfs     & 200K to 900K & 0.504 & \B0.832   & \B 0.504 & 0.504 \\
        fssdf     & 200K to 900K & 0.504 & \B0.754   & \B 0.754& 0.702 \\ 
        Codsffdspe  & 200K to 900K & 0.622 & 0.504 & \B 0.504 & 0.676 \\ 
        Codsffdspe & 200K to 900K & 0.563 &  \B0.674 & 0.665 & 0.686 \\ 
        sdfdf  & 200K to 900K & 0.956 & \B 0.957 & 0.956 & 0.945\\
        sdfdf  & 200K to 900K & 0.949 & \B0.504 & \B 0.955 & 0.952\\
        dsa  & 20K to 90K       & 0.895 &  0.798 & \B 0.504 & 0.853\\
        dsa  & 20K to 90K    & 0.924 & 0.834 & \B 0.932
        & 0.927\\
        dsa-2  & 20K to 90K       & 0.899 &  0.906 & \B 0.943 & 0.942\\
        SdsaA-2  & 20K to 90K       & 0.892 &  \B0.947 & \B 0.947 & 0.942\\
        SEdsaA-3  & 20K to 90K       &  0.884 &  0.832 & \B 0.897 & 0.846\\
        [2ex]
        \bottomrule
    \end{tabular}
    \caption{Csdfdfsdfs  CsdfdfsdfsCsdfdfsdfsCsdfdfsdfsCsdfdfsdfs)}
    \label{table:2a}
\end{table}

\begin{table}[!htb]
    \centering
    \sisetup{table-format=2.3, table-number-alignment=center, tight-spacing,}% table-column-width =2.5cm 
    \setlength{\tabcolsep}{3pt}
    \small
    \centering

    \sisetup{detect-weight,mode=text}
    \renewrobustcmd{\bfseries}{\fontseries{b}\selectfont}
    \renewrobustcmd{\boldmath}{}
    % abbreviation
    \newrobustcmd{\B}{\bfseries}
    % shorten the intercolumn spaces
    \setlength{\tabcolsep}{4pt}
    \begin{tabular}{l>{\centering}lSSSS}
        \toprule

        \thead {Dataset \\ Name}  & {\thead{fsddsf \\ records} }& {\thead{Hsfd\\ Acc }} & {\thead{fsdsf\\ Acc} }
        & {\thead{sfdfsd sfdf\\Acc} } & {\thead{fsd fs\\ fsd}} \\ [0.5ex]
        \midrule
        fsdfs fsd & 100K to 900K & 0.504 & 0.547 & \B 0.548  & 0.503 \\
        fsdfs fsd & 200K to 900K & 0.524 &  0.548 & \B 0.550  & 0.498\\
        sfddfs& 200K to 900K & 0.788 & \B0.833   & 0.832 & 0.824 \\
        fddfs& 200K to 900K & 0.680 & 0.757   & \B 0.758& 0.702 \\ 
        Cosdfype  & 200K to 900K & 0.622 & 0.735 & \B 0.735 & 0.676 \\ 
        Cdfspe & 200K to 900K & 0.563 &  0.677 & \B 0.678 & 0.686 \\ 
        Airfsd  & 200K to 900K & 0.956 &  0.959 & \B 0.962 & 0.945\\
        dfsf  & 200K to 500K & 0.949 & \B0.958 & \B 0.958 & 0.952\\
        SfdsEA  & 20K to 90K & 0.895 &  0.802 & \B 0.899 & 0.853\\
        SEfdsA  & 20K to 90K    & 0.924 & 0.836 & \B 0.934 & 0.927\\
        fds-2  & 20K to 90K       & 0.899 &  0.935 & \B 0.943 & 0.942\\
        fds-2  & 20K to 90K       & 0.892 &  0.952 & \B 0.954 & 0.942\\
        Sfds3  & 20K to 90K       &  0.884 &  0.853 & \B 0.897 & 0.846\\
        [2ex]
        \bottomrule
    \end{tabular}
    \caption{fgdfgdsgsf (In \textbf{Bold} thedfgsdfggf)}
    \label{table:2b}
\end{table} 

\begin{table}[!htb]
    \centering
    \sisetup{table-format=2.3, table-number-alignment=center, tight-spacing,}% table-column-width =2.5cm 
    \setlength{\tabcolsep}{3pt}
    \small
    \centering

    \sisetup{detect-weight,mode=text}
    \renewrobustcmd{\bfseries}{\fontseries{b}\selectfont}
    \renewrobustcmd{\boldmath}{}
    % abbreviation
    \newrobustcmd{\B}{\bfseries}
    % shorten the intercolumn spaces
    \setlength{\tabcolsep}{4pt}
    \begin{tabular} {l c c} %{l>{\centering}lSSSS}
        \toprule

        \thead {Dataset \\ Name}  & {\thead{dsaasd add dada (sec) \\ 1000 dsad} } & {\thead{adsdas das ddsa Time (sec) \\ 2000 fdsfds}} \\ [0.5ex]
        \midrule
        dfg gdfs & 22.222 & 4.4222\\
        sdfgg& 22.222 &  4.0222 \\
        sdfggsd  & 22.222  & 22.2226\\ 
        dsfggfd  & 32.355 & 2.277 \\ 
        dfd  & 20.254 & 2.238 \\ 
        [2ex]
        \bottomrule
    \end{tabular}
    %    \end{tabular}
    \caption{fgdfgsd}
    \label{table:3}
\end{table}

\end{document}
3
  • Could you please describe the output you expect? Do you want your tables to appear as if you used a onecolumn documentclass?
    – leandriis
    Aug 12 '19 at 18:14
  • If so, use table* instead of table for all tables, and \begin{tabularx}{0.6\textwidth} instead of \begin{tabularx}{0.6\columnwidth} for the first table.
    – leandriis
    Aug 12 '19 at 18:16
  • Unrelated to the problem, but you might want to consider using some carefulle placed \phantom{0} commands in order to improve the alignment of the second column of your second and third table.
    – leandriis
    Aug 12 '19 at 18:17
2

Off-topic:

  • In your MWE is missed document class. For my MWE I use IEEEtran.
  • From your preamble I considered only packages relevant to your tables (other I remove from my MWE, however check again, if you really need all those packages and if some of them are loaded twice).
  • If article is intended to some IEEE journal, don't reformat their default settings for caption etc.

Tables:

  • I suggest move all new command definition from tables to preamble (for example \newrobustcmd{\B}{\bfseries}.
  • Remove all repeated settings from table (for example \centering, \tabcolsep etc).
  • It is not clear why the width of the first table selected is much smaller than the width of the column.
  • In MWE below I clean-up table codes and and tried to design them in a uniform way.

Your problem:

  • It is not clear (to me), what is your problem. Table design?
\documentclass{IEEEtran}
%\usepackage{amsmath} is supersede by mathtools, 
\usepackage{mathtools}
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}

\usepackage{textcomp}
\usepackage{microtype}

\usepackage{booktabs,makecell,tabularx}
\renewcommand\theadfont{\small}
\renewcommand\theadgape{}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}

\usepackage{siunitx}
\usepackage{etoolbox}
\newrobustcmd{\B}{\bfseries}

\begin{document}

\begin{table}[!htb]
    \small
    \setlength{\tabcolsep}{3pt}
    \caption{Ssdfsdfsddgs dgfgdsg gsdgsfggdfsfgd sdfgfgsd}
    \label{table:2}
\begin{tabularx}{\linewidth}{@{} c L S[table-format=7.0]*{2}{S[table-format=2.0]} @{}}
        \toprule
\thead{ID}  & \thead{UCI Dataset Name} & {\thead{Samples}} & {\thead{Attributes}} & {\thead{Classes}}\\
         \midrule
        DS2 & \textbf{Pfsddfs}- cdfsads dfsdffdss                      & 2222222  & 22    & 5     \\
        DS2 & \textbf{ESSSS} - cdfsads dfsdffdss cdfsads dfsdffdss cdfsads dfsdffdss cdfsads dfsdffdss
        & 45555  & 9    & 2     \\
        DS3 & \textbf{AAAA} -  cdfsads dfsdffdss cdfsads dfsdffdss cdfsads dfsdffdss  & 22222  & 54     & 7     \\
        DS4 & \textbf{ABBB} - cdfsads dfsdffdss cdfsads dfsdffdss cdfsads dfsdffdss    & 539383  & 28    & 2    \\
        DS5 & \textbf{SSSS}                                & 60000 &  3 & 3       \\

        \bottomrule
    \end{tabularx}
\end{table}

    \begin{table}[!htb]
    \sisetup{detect-weight,
             mode=text,
             table-format=2.3}
    \setlength{\tabcolsep}{0pt}
    \caption{Csdfdfsdfs  Csdfdf sdfsCsdf dfsdfs CsdfdfsdfsCs dfdfsdfs)}
    \label{table:2a}
    \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} l c SSSS}
        \toprule
    \thead[b]{Dataset \\ Name}  
        & {\thead[b]{No. of\\ processed \\ records} }
            & {\thead[b]{fsad fsd\\ Trfsdee\\ Acc }} 
                & {\thead[b]{fsdd\\ Acc} }
                    & {\thead[b]{dfsadf\\ Alg\\Acc} } 
                        & {\thead[b]{dfsfds fsd\\ J48}} \\ 
        \midrule
        Pfds fssdf & 200K to 900K & 0.504 & 0.504    & \B 0.504 & 0.504 \\
        Pfds fssd  & 200K to 900K & 0.524 & \B 0.546 & \B 0.546 & 0.498 \\
        dfsfs      & 200K to 900K & 0.504 & \B 0.832 & \B 0.504 & 0.504 \\
        fssdf      & 200K to 900K & 0.504 & \B 0.754 & \B 0.754 & 0.702 \\
        Codsffdspe & 200K to 900K & 0.622 &    0.504 & \B 0.504 & 0.676 \\
        Codsffdspe & 200K to 900K & 0.563 & \B 0.674 &    0.665 & 0.686 \\
        sdfdf      & 200K to 900K & 0.956 & \B 0.957 &    0.956 & 0.945 \\
        sdfdf      & 200K to 900K & 0.949 & \B 0.504 & \B 0.955 & 0.952 \\
        dsa        & 20K to 90K   & 0.895 &    0.798 & \B 0.504 & 0.853 \\
        dsa        & 20K to 90K   & 0.924 &    0.834 & \B 0.932 & 0.927 \\
        dsa-2      & 20K to 90K   & 0.899 &    0.906 & \B 0.943 & 0.942 \\
        SdsaA-2    & 20K to 90K   & 0.892 & \B 0.947 & \B 0.947 & 0.942 \\
        SEdsaA-3   & 20K to 90K   & 0.884 &    0.832 & \B 0.897 & 0.846 \\
        \bottomrule
    \end{tabular*}
\end{table}

\begin{table}[!htb]
    \sisetup{table-format=2.3, 
             detect-weight,
             mode=text}% table-column-width =2.5cm
    \setlength{\tabcolsep}{3pt}
    \small
\caption{fgdfgdsgsf (In \textbf{Bold} thedfgsdfggf)}
\label{table:2b}
     \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}l c SSSS}
        \toprule
\thead {Dataset \\ Name}  
    & {\thead{fsddsf \\ records} }
        & {\thead{Hsfd\\ Acc }} 
            & {\thead{fsdsf\\ Acc} }
                & {\thead{sfdfsd sfdf\\Acc} } 
                    & {\thead{fsd fs\\ fsd}} \\ [0.5ex]
        \midrule
fsdfs fsd & 100K to 900K & 0.504 &    0.547 & \B 0.548 & 0.503 \\
fsdfs fsd & 200K to 900K & 0.524 &    0.548 & \B 0.550 & 0.498 \\
sfddfs    & 200K to 900K & 0.788 & \B 0.833 &    0.832 & 0.824 \\
fddfs     & 200K to 900K & 0.680 &    0.757 & \B 0.758 & 0.702 \\
Cosdfype  & 200K to 900K & 0.622 &    0.735 & \B 0.735 & 0.676 \\
Cdfspe    & 200K to 900K & 0.563 &    0.677 & \B 0.678 & 0.686 \\
Airfsd    & 200K to 900K & 0.956 &    0.959 & \B 0.962 & 0.945 \\
dfsf      & 200K to 500K & 0.949 & \B 0.958 & \B 0.958 & 0.952 \\
SfdsEA    & 20K to 90K   & 0.895 &    0.802 & \B 0.899 & 0.853 \\
SEfdsA    & 20K to 90K   & 0.924 &    0.836 & \B 0.934 & 0.927 \\
fds-2     & 20K to 90K   & 0.899 &    0.935 & \B 0.943 & 0.942 \\
fds-2     & 20K to 90K   & 0.892 &    0.952 & \B 0.954 & 0.942 \\
Sfds3     & 20K to 90K   & 0.884 &    0.853 & \B 0.897 & 0.846 \\
        \bottomrule
    \end{tabular*}
\end{table}

\begin{table}[!htb]
    \caption{fgdfgsd}
    \label{table:3}
    \sisetup{table-format=2.4}% table-column-width =2.5cm
    \centering
    \small
    \begin{tabular} {l S S } 
        \toprule
\thead {Dataset \\ Name}  
    & {\thead{dsaasd add dada (sec) \\ 1000 dsad} } 
        & {\thead{adsdas das ddsa Time (sec) \\ 2000 fdsfds}} \\
    \midrule
dfg gdfs & 22.222 &  4.4222 \\
sdfgg    & 22.222 &  4.0222 \\
sdfggsd  & 22.222 & 22.2226 \\
dsfggfd  & 32.355 &  2.277  \\
dfd      & 20.254 &  2.238  \\
    \bottomrule
    \end{tabular}
\end{table}

\end{document}

enter image description here

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.