6

Now i am drawing the table using latex code.
However, the spacing between the lines of the table does not seem appropriate (slightly off)

Here is the table what i made enter image description here

However, i want this type of form (to clarify, using powerpoint :/ , for 2 columns width)

enter image description here


Additianally, similar type of the table below, is also needed (for 1 column width)

enter image description here

I almost spent three days...
And here is the 'messy' code !!!

\begin{table*}[]\label{table_test}\centering
\renewcommand{\arraystretch}{1.3}
\renewcommand{\tabcolsep}{4 mm}
\caption{ }
\begin{tabular}{clccccccccccl}
\hline
\multicolumn{13}{c}{(1) MachineLearning-based}           
\\ \hline
\multicolumn{2}{c|}{Method}    
\multicolumn{2}{c|}{Method}
& A01 & A02 & A03 & A04 & A05 & A06 & A07 & A08 & \multicolumn{1}{c|}{A09} & 
\multicolumn{2}{c}{Mean}                                                                                    \\ \hline 
~~~~~~~~
~~~~~~~~
\multicolumn{2}{c|}{Model3}                                  
& \multicolumn{1}{l}{\begin{tabular}[c]{@{}l@{}}00.00\\ $\pm$00.00\end{tabular}}        
& \multicolumn{1}{l}{\begin{tabular}[c]{@{}l@{}}00.00\\ $\pm$00.00\end{tabular}} 
& \multicolumn{1}{l}{\begin{tabular}[c]{@{}l@{}}00.00\\ $\pm$00.00\end{tabular}}      
& \multicolumn{1}{l}{\begin{tabular}[c]{@{}l@{}}00.00\\ $\pm$00.00\end{tabular}}     
& \multicolumn{1}{l}{\begin{tabular}[c]{@{}l@{}}00.00\\ $\pm$00.00\end{tabular}}
& \multicolumn{1}{l}{\begin{tabular}[c]{@{}l@{}}00.00\\ $\pm$00.00\end{tabular}}      
& \multicolumn{1}{l}{\begin{tabular}[c]{@{}l@{}}00.00\\ $\pm$00.00\end{tabular}}     
& \multicolumn{1}{l}{\begin{tabular}[c]{@{}l@{}}00.00\\ $\pm$00.00\end{tabular}}    
& \multicolumn{1}{l|}{\begin{tabular}[c]{@{}l@{}}00.00\\ $\pm$00.00\end{tabular}}
& \multicolumn{2}{l}{\begin{tabular}[c]{@{}l@{}}00.00\\ $\pm$00.00\end{tabular}}                                  \\

\rowcolor[HTML]{EFEFEF}
\multicolumn{2}{c|}{\cellcolor[HTML]{EFEFEF}\textbf{Model4}} 
& \multicolumn{1}{l}{\cellcolor[HTML]{EFEFEF}\textbf{\begin{tabular}[c]{@{}l@{}}\textbf{00.00}\\ \textbf{$\pm$00.00}\end{tabular}}} 
& \multicolumn{1}{l}{\cellcolor[HTML]{EFEFEF}\textbf{\begin{tabular}[c]{@{}l@{}}\textbf{00.00}\\ \textbf{$\pm$00.00}\end{tabular}}} 
& \multicolumn{1}{l}{\cellcolor[HTML]{EFEFEF}\textbf{\begin{tabular}[c]{@{}l@{}}\textbf{00.00}\\ \textbf{$\pm$00.00}\end{tabular}}} 
& \multicolumn{1}{l}{\cellcolor[HTML]{EFEFEF}\textbf{\begin{tabular}[c]{@{}l@{}}\textbf{00.00}\\ \textbf{$\pm$00.00}\end{tabular}}} 
& \multicolumn{1}{l}{\cellcolor[HTML]{EFEFEF}\textbf{\begin{tabular}[c]{@{}l@{}}\textbf{00.00}\\ \textbf{$\pm$00.00}\end{tabular}}} 
& \multicolumn{1}{l}{\cellcolor[HTML]{EFEFEF}\textbf{\begin{tabular}[c]{@{}l@{}}\textbf{00.00}\\ \textbf{$\pm$00.00}\end{tabular}}} 
& \multicolumn{1}{l}{\cellcolor[HTML]{EFEFEF}\textbf{\begin{tabular}[c]{@{}l@{}}\textbf{00.00}\\ \textbf{$\pm$00.00}\end{tabular}}} 
& \multicolumn{1}{l}{\cellcolor[HTML]{EFEFEF}\textbf{\begin{tabular}[c]{@{}l@{}}\textbf{00.00}\\ \textbf{$\pm$00.00}\end{tabular}}} 
& \multicolumn{1}{l|}{\cellcolor[HTML]{EFEFEF}\textbf{\begin{tabular}[c]{@{}l@{}}\textbf{00.00}\\ \textbf{$\pm$00.00}\end{tabular}}} 
& \multicolumn{2}{l}{\cellcolor[HTML]{EFEFEF}\textbf{\begin{tabular}[c]{@{}l@{}}\textbf{00.00}\\ \textbf{$\pm$00.00$^{**}$}\end{tabular}}} 
\\ \hline
\end{tabular}

\begin{tabular}{clccccccccccl}
\hline
\multicolumn{13}{c}{(2) DeepLearning-based} 

~~~~~~~~~~~
SAME as above
~~~~~~~~~~~      
6
  • 1
    Welcome to TeX.SX! Please provide a minimum working example (MWE) of your table in code block so that we can specify what you can do. Feb 12, 2023 at 7:39
  • Hello, @TeddyvanJerry !!! I appociate your comment! I uploaded my latex code!!! Thank you for spending time on my problem.
    – 20am847
    Feb 12, 2023 at 8:04
  • When you write "PowerPoint", do you actually mean the beamer document class? Please advise.
    – Mico
    Feb 12, 2023 at 12:56
  • Actually, I couldn't express exactly what I wanted with latex, so I drew the table using the power point function. But I first learned about beamer this time. Thank you so much for letting me know :D
    – 20am847
    Feb 12, 2023 at 16:37
  • I suspect the conversion program, in particular putting tabular inside \multicolumn. Each tabular adds a little space above and below. Feb 12, 2023 at 20:49

2 Answers 2

6

The following solution tries to simplify the "look" of the table, mainly by getting rid of the vertical rules and using fewer horizontal rules. I would also abstain from using \rowcolor and \cellcolor as colorizing cells and entire rows doesn't appear to do anything other than provide gaudiness and cheap entertainment -- at least for the table at hand.

The code shown below employs a shortcut macro -- named, not very imaginatively, \myarray -- to allow replacing the rather complicated-looking

\multicolumn{1}{l}{\textbf{\begin{tabular}[c]{@{}l@{}}\textbf{00.00}\\ \textbf{$\pm$00.00}\end{tabular}}} 

with a much more manageable

\myarray[\boldmath]{00.00 \\ \pm 00.00}

If you don't need to bold-face the main argument of \myarray, just omit the macro's optional argument, i.e, [\boldmath].


enter image description here

\documentclass{beamer}
\usepackage{booktabs}
%% Define a handy shortcut macro:
\newcommand\myarray[2][]{\ensuremath{#1\begin{array}[t]{r} #2 \end{array}}}

\begin{document}
\begin{frame}[t]
\frametitle{A table with two subpanels}

\tiny
\setlength{\tabcolsep}{0pt}
\centerline{%
\begin{tabular*}{1.1\textwidth}{ l @{\extracolsep{\fill}}*{10}{c} }

\toprule
Method  
& A01 & A02 & A03 & A04 & A05 & A06 & A07 & A08 & A09 & Mean \\ 
\midrule
\addlinespace[2mm]
\multicolumn{4}{l}{(1) Machine Learning-based} \\ 
\addlinespace
Model2                                 
& \myarray{01.00 \\ \pm 00.00}        
& \myarray{02.00 \\ \pm 00.00} 
& \myarray{03.00 \\ \pm 00.00}      
& \myarray{04.00 \\ \pm 00.00}     
& \myarray{05.00 \\ \pm 00.00}
& \myarray{06.00 \\ \pm 00.00}  
& \myarray{07.00 \\ \pm 00.00}     
& \myarray{08.00 \\ \pm 00.00}    
& \myarray{08.00 \\ \pm 00.00}
& \myarray{05.00 \\ \pm 00.00} 
\\
\addlinespace
Model3                                 
& \myarray{21.00 \\ \pm 00.00}        
& \myarray{22.00 \\ \pm 00.00} 
& \myarray{23.00 \\ \pm 00.00}      
& \myarray{24.00 \\ \pm 00.00}     
& \myarray{25.00 \\ \pm 00.00}
& \myarray{26.00 \\ \pm 00.00}  
& \myarray{27.00 \\ \pm 00.00}     
& \myarray{28.00 \\ \pm 00.00}    
& \myarray{29.00 \\ \pm 00.00}
& \myarray{25.00 \\ \pm 00.00} 
\\
\addlinespace[4mm]
\multicolumn{4}{l}{(2) Deep Learning-based} \\
\addlinespace
\textbf{Model4} 
& \myarray[\boldmath]{01.00 \\ \pm 00.00} 
& \myarray[\boldmath]{02.00 \\ \pm 00.00} 
& \myarray[\boldmath]{03.00 \\ \pm 00.00}
& \myarray[\boldmath]{04.00 \\ \pm 00.00} 
& \myarray[\boldmath]{05.00 \\ \pm 00.00} 
& \myarray[\boldmath]{06.00 \\ \pm 00.00} 
& \myarray[\boldmath]{07.00 \\ \pm 00.00} 
& \myarray[\boldmath]{08.00 \\ \pm 00.00} 
& \myarray[\boldmath]{09.00 \\ \pm 00.00} 
& \myarray[\boldmath]{05.00 \\ \pm 00.00\rlap{${}^{**}$}}\\
\addlinespace
\textbf{Model5} 
& \myarray[\boldmath]{41.00 \\ \pm 00.00} 
& \myarray[\boldmath]{42.00 \\ \pm 00.00} 
& \myarray[\boldmath]{43.00 \\ \pm 00.00}
& \myarray[\boldmath]{44.00 \\ \pm 00.00} 
& \myarray[\boldmath]{45.00 \\ \pm 00.00} 
& \myarray[\boldmath]{46.00 \\ \pm 00.00} 
& \myarray[\boldmath]{47.00 \\ \pm 00.00} 
& \myarray[\boldmath]{48.00 \\ \pm 00.00} 
& \myarray[\boldmath]{49.00 \\ \pm 00.00} 
& \myarray[\boldmath]{45.00 \\ \pm 00.00}\\
\bottomrule
\end{tabular*}
}
\end{frame}
\end{document}
1
  • 1
    Your answer was very helpful. Thank you so much :)
    – 20am847
    Feb 12, 2023 at 16:43
2

An experiment how to write your table with use of the tabularray package with its libraries booktabs and siunitx (which load packages of the same names) and package changepage by which is extend \textwidth of table:

\documentclass{beamer}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\usepackage{changepage}

\begin{document}
\begin{frame}[t]
\frametitle{A table with two subpanels}

\begin{adjustwidth}{-1.5em}{-1.5em}
\tiny
\sisetup{minimum-integer-digits=2,
         detect-weight,
         mode=text}
\SetTblrStyle{remark}{fg=black!80}
\begin{talltblr}[
       entry = none,
       label = none,
remark{Note} = {\sisetup{minimum-integer-digits=1}  % <---
                Symbols *, **, and *** denote significance at the
                \qty{10}{\%}, \qty{5}{\%} and \qty{1}{\%} levels, respectively.}
                ]{colsep = 0pt,
                 colspec = {    l 
                           *{9}{X[c, si]}
                                X[c, si={table-format=-2.2{**}}]
                           },
                 row{1}  = {guard},
                 row{3-Z}={rowsep=0pt},
                 row{odd[3-7]}  = {abovesep=1ex},
                 row{even[8-Z]} = {abovesep=1ex},
                 row{8-Z}={font=\bfseries},
                 }
    \toprule
Method
    & A01 & A02 & A03 & A04 & A05 & A06 & A07 & A08 & A09 & Mean \\
    \midrule
\SetCell[c=4]{l, guard}    (1) Machine Learning-based
    &       &       &       &       &       &       &       &       &       &           \\
Model 2
    & 01.00 & 02.00 & 03.00 & 04.00 & 05.00 & 06.00 & 07.00 & 08.00 & 09.00 & 10.00     \\
    & \pm 00.00     & \pm 00.00     & \pm 00.00     & \pm 00.00     & \pm 00.00 
    & \pm 00.00     & \pm 00.00     & \pm 00.00     & \pm 00.00     & \pm 00.00         \\
Model 3
    & 01.00 & 02.00 & 03.00 & 04.00 & 05.00 & 06.00 & 07.00 & 08.00 & 09.00 & 10.00     \\
    & \pm 00.00     & \pm 00.00     & \pm 00.00     & \pm 00.00     & \pm 00.00
    & \pm 00.00     & \pm 00.00     & \pm 00.00     & \pm 00.00     & \pm 00.00         \\

\SetCell[c=4]{l, guard}    (2) Deep Learning-based
    &       &       &       &       &       &       &       &       &       &           \\
Model 4
    & 01.00 & 02.00 & 03.00 & 04.00 & 05.00 & 06.00 & 07.00 & 08.00 & 09.00 & 10.00     \\
    & \pm 00.00     & \pm 00.00     & \pm 00.00     & \pm 00.00     & \pm 00.00
    & \pm 00.00     & \pm 00.00     & \pm 00.00     & \pm 00.00     & \pm 00.00\TblrNote{**}   \\
Model 5
    & 01.00 & 02.00 & 03.00 & 04.00 & 05.00 & 06.00 & 07.00 & 08.00 & 09.00 & 10.00     \\
    & \pm 00.00     & \pm 00.00     & \pm 00.00     & \pm 00.00     & \pm 00.00
    & \pm 00.00     & \pm 00.00     & \pm 00.00     & \pm 00.00     & \pm 00.00         \\
    \bottomrule
\end{talltblr}
\end{adjustwidth}
\end{frame}
\end{document}

enter image description here

3
  • I'm sorry I couldn't adopt it. But it was very helpful. Thank you.
    – 20am847
    Feb 13, 2023 at 2:44
  • @20am847, what you mean with "adopt it"? Since proposed solution is a bit experimental (for me). I'm curious, what problems you have with code.
    – Zarko
    Feb 13, 2023 at 5:31
  • Oh i just want to say i couldn't 'accept' your answer becuase i already accept the other one. Apologize to confuse you. Also, your advice works well!!! No problem!
    – 20am847
    Feb 13, 2023 at 8:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .