1

I'm looking for ideas to improve the layout of the following table.

  • Is there a better way to separate ABC Metrics and XYZ Metrics (other than using separate table for each metric)?
  • Should I convert Algorithms row into a column?
  • Should I convert Dataset row into a column?

I would appreciate any ideas, thanks.

Table

\documentclass{article}

\usepackage[margin=1in]{geometry}  
\usepackage{tabularx,ragged2e,booktabs}

\begin{document}

\begin{table*}[!ht]
        \caption{Evaluation results}
        \centering
        \setlength{\tabcolsep}{4pt}
        \begin{tabularx}{\textwidth}{>{\hsize=1.9\hsize\bfseries\RaggedRight}X!{\extracolsep{\fill}}*{6}{>{\centering\arraybackslash\hsize=0.48\hsize}X}}
                \toprule[1pt]\midrule[0.3pt]
                \multicolumn{7}{c}{\textbf{ABC Metrics}} \\ \midrule[0.3pt]
                \textbf{Algorithm}& \multicolumn{2}{c}{\textit{Algo 1}} & \multicolumn{2}{c}{\textit{Algo 2}} & \multicolumn{2}{c}{\textit{Algo 3}} \\
                \cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7}%
                {Dataset} & $D_1$ & $D_2$ & $D_1$ & $D_2$ & $D_1$ & $D_2$ \\
                \addlinespace%
                {Matric 1} & 0 & 0 & 0 & 0 & 0 & 0 \\
                \addlinespace%
                {Matric 2} & 0 & 0 & 0 & 0 & 0 & 0 \\
                \addlinespace%
                {Matric 3} & 0 & 0 & 0 & 0 & 0 & 0 \\
                \addlinespace
                {Matric 4} & 0 & 0 & 0 & 0 & 0 & 0 \\
                \midrule
                \multicolumn{7}{c}{\textbf{XYZ Metrics}} \\ \midrule[0.3pt]
                \textbf{Algorithm}& \multicolumn{2}{c}{\textit{Algo 1}} & \multicolumn{2}{c}{\textit{Algo 2}} & \multicolumn{2}{c}{\textit{Algo 3}} \\
                \cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7}%
                {Matric 5} & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{0} \\ \addlinespace
                {Matric 6} & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{0} \\
                \midrule[0.3pt]\bottomrule[1pt]
        \end{tabularx}
\end{table*}

\end{document}
2

i only repair some inconsistencies in your column width calculation. the sum of the defined widths is 4.78. but it should be an integer number. all other is opinion based ...

my suggestion for your table code (with some opinion based changes and simplification of writing) is:

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage[skip=1ex]{caption}

\usepackage{ragged2e}
\usepackage{booktabs,tabularx}
\newcommand\mcc[1]{\multicolumn{2}{c}{#1}}

\begin{document}
    \begin{table}[!ht]
\caption{Evaluation results}
\centering
\begin{tabularx}{\textwidth}{
>{\hsize=0.4\hsize\bfseries\RaggedRight}X
*{6}{>{\hsize=0.1\hsize\centering\arraybackslash}X}}
    \toprule
\multicolumn{7}{c}{\textbf{ABC Metrics}} \\
    \midrule
\textbf{Algorithm}
    & \mcc{\textit{Algo 1}} & \mcc{\textit{Algo 2}} & \mcc{\textit{Algo 3}} \\
    \cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7}%
Dataset     & $D_1$ & $D_2$ & $D_1$ & $D_2$ & $D_1$ & $D_2$ \\
    \midrule
 Matric 1   & 0 & 0 & 0 & 0 & 0 & 0 \\
    \addlinespace%
Matric 2    & 0 & 0 & 0 & 0 & 0 & 0 \\
    \addlinespace%
Matric 3    & 0 & 0 & 0 & 0 & 0 & 0 \\
    \addlinespace
Matric 4    & 0 & 0 & 0 & 0 & 0 & 0 \\
    \midrule
\multicolumn{7}{c}{\textbf{XYZ Metrics}} \\ \midrule[0.3pt]
\textbf{Algorithm}
    & \mcc{\textit{Algo 1}} & \mcc{\textit{Algo 2}} & \mcc{\textit{Algo 3}} \\
    \cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7}%
{Matric 5} & \mcc{0} & \mcc{0} & \mcc{0} \\ 
    \addlinespace
{Matric 6} & \mcc{0} & \mcc{0} & \mcc{0} \\
    \bottomrule
\end{tabularx}
    \end{table}
\end{document}

which gives:

enter image description here

2

Some general observations and comments:

  • I don't understand why you're using 1 tabularx environment for two structures that don't look all that much connected. I'd use two separate environments.

  • Since there appears to be no line-wrapping whatsoever, I don't understand why you'd be using a tabularx environment to begin with. Why not use a tabular* environment? For that matter, why not use tabular environments?

Some more specific comments:

  • Using bold-facing and/or italics in the header cells is a transparent attempt to compensate for the lack of clear visual structure. With such an approach, you are mostly going to come across as somebody who (a) isn't particularly well organized and (b) thinks it's ok to shout at people. The people I know, though, very much prefer not to be shouted at. Your experience may differ...

  • Based on the information you've provided, the material can easily be presented in two separate, side-by-side tabular environments.

The following solution tries to present the material without any shouting, while still trying to be visually "open" and inviting.

enter image description here

PS. What's a "matric"?

\documentclass{article}
\usepackage[margin=1in,letterpaper]{geometry}  
\usepackage[skip=0.5\baselineskip]{caption} % optional
\usepackage{array,booktabs}

\begin{document}
\begin{table}[!ht]
   \setlength\tabcolsep{10pt} % default: 6pt
   \caption{Evaluation results}   

   \begin{tabular}[t]{@{} l *{6}{c} @{}}
   \multicolumn{7}{@{}l}{ABC Metrics, for datasets $D_1$ and $D_2$} \\ 
   \toprule
   & \multicolumn{6}{c@{}}{Algorithm}\\
   \cmidrule(l){2-7}
   & \multicolumn{2}{c}{Algo 1} 
   & \multicolumn{2}{c}{Algo 2} 
   & \multicolumn{2}{c@{}}{Algo 3} \\
   \cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(l){6-7}
   & $D_1$ & $D_2$ & $D_1$ & $D_2$ & $D_1$ & $D_2$ \\
   \midrule
   Matric 1 & 0 & 0 & 0 & 0 & 0 & 0 \\
   Matric 2 & 0 & 0 & 0 & 0 & 0 & 0 \\
   Matric 3 & 0 & 0 & 0 & 0 & 0 & 0 \\
   Matric 4 & 0 & 0 & 0 & 0 & 0 & 0 \\
   \bottomrule
   \end{tabular}
   \hspace{\fill}
   \begin{tabular}[t]{@{} l ccc @{}}
   \multicolumn{4}{@{}l}{XYZ Metrics} \\ 
   \toprule
   & \multicolumn{3}{c@{}}{Algorithm}\\ 
   \cmidrule(l){2-4}
   & Algo 1 & Algo 2 & Algo 3 \\
   \midrule
   Matric 5 & 0 & 0 & 0 \\ 
   Matric 6 & 0 & 0 & 0 \\ 
   \bottomrule
   \end{tabular}
\end{table}
\end{document}
2

I propose this variant layout, with correct coefficients fòr \hsize=:

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage[skip=1ex]{caption}
\usepackage[table, svgnames]{xcolor}

\usepackage{ragged2e}
\usepackage{booktabs,tabularx}
\newcommand\mcc[1]{\multicolumn{2}{c}{#1}}

\begin{document}

\begin{table}[!ht]
\caption{Evaluation results}
\centering
\setlength{\extrarowheight}{2pt}
\setlength{\belowrulesep}{0pt}
\begin{tabularx}{\textwidth}{
>{\hsize=2.8\hsize\bfseries\RaggedRight}X
*{6}{>{\hsize=0.7\hsize\centering\arraybackslash}X}}
    \toprule
 & \multicolumn{6}{c}{\textbf{Algorithm}} \\
    \cmidrule{2-7}
    & \mcc{\textit{Algo 1}} & \mcc{\textit{Algo 2}} & \mcc{\textit{Algo 3}} \\
\rowcolor{WhiteSmoke} ABC Metrics\hfill Dataset & $D₁$ & $D₂$ & $D₁$ & $D₂$ & $D₁$ & $D₂$ \\
 \addlinespace
 Metric 1 & 0 & 0 & 0 & 0 & 0 & 0 \\
    \addlinespace%
Metric 2 & 0 & 0 & 0 & 0 & 0 & 0 \\
    \addlinespace%
Metric 3 & 0 & 0 & 0 & 0 & 0 & 0 \\
    \addlinespace
Metric 4 & 0 & 0 & 0 & 0 & 0 & 0 \\
    \addlinespace
\rowcolor{WhiteSmoke} XYZ Metrics & & & & & & \\
    \addlinespace
{Metric 5} & \mcc{0} & \mcc{0} & \mcc{0} \\
    \addlinespace
{Metric 6} & \mcc{0} & \mcc{0} & \mcc{0} \\
    \bottomrule
\end{tabularx}
\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.