TransWikia.com

Table in IEEE paper format

TeX - LaTeX Asked on February 20, 2021

I’m trying to create the below table by using the below packages, but the format of it is not well organised especially the numbers as they need to be in the centre and the tabs. can someone please help to make the table more adjustable and look professional?

documentclass[conference]{IEEEtran}
IEEEoverridecommandlockouts

usepackage{booktabs,tabulary,lipsum}
usepackage{dcolumn,tipa}
newcolumntype{d}{D{.}{.}{6.5}}
usepackage{siunitx}
usepackage[usestackEOL]{stackengine}
usepackage{multirow}


begin{document}

begin{table*}[ht]
caption{Table ex.}
label{tab1}
centering
renewcommandfootnoterule{kern -1ex}
renewcommand{arraystretch}{1.3}
begin{tabular*}{linewidth}{l*{9}{d}}
toprule multirow{3}{*}{Subjects}   & 

multicolumn{4}{c}{Numbers} & 
multicolumn{4}{c}{Numbers}
cmidrule(r){2-5}cmidrule(l){6-9}  &
multicolumn{1}{c}{XYZ} & 
multicolumn{1}{c}addstackgap{stackanchor{XYZ}{(Numbers)}} & 
multicolumn{1}{c}{Numbers Tree} & 
multicolumn{1}{c}{Numbers Tree} & 
multicolumn{1}{c}{XYZ} & 
multicolumn{1}{c}addstackgap{stackanchor{XYZ}{(Numbers)}} & 
multicolumn{1}{c}{Numbers Tree} & 
multicolumn{1}{c}{Numbers Tree} midrule 
 
X1 & 0.5000 & 0.4888 & 0.0112 & 0.0001 & 0.8500 & 0.3540 & 0.2332 & 0.2367 

X2 & 0.5000 & 0.4888 & 0.0112 & 0.0001 & 0.8500 & 0.3540 & 0.2332 & 0.2367  

X3 & 0.5000 & 0.4888 & 0.0112 & 0.0001 & 0.8500 & 0.3540 & 0.2332 & 0.2367  

X4 & 0.5000 & 0.4888 & 0.0112 & 0.0001 & 0.8500 & 0.3540 & 0.2332 & 0.2367  

X5 & 0.5000 & 0.4888 & 0.0112 & 0.0001 & 0.8500 & 0.3540 & 0.2332 & 0.2367 bottomrule
end{tabular*}

end{table*}

end{document}

And the result is this:

enter image description here

2 Answers

You should use the S columns of siunitx.

 documentclass[conference]{IEEEtran}
 IEEEoverridecommandlockouts

 usepackage{booktabs,tabulary,lipsum}
 usepackage{dcolumn,tipa}
 newcolumntype{d}{D{.}{.}{6.5}}
 usepackage{siunitx}
 usepackage[usestackEOL]{stackengine}
 usepackage{multirow}


 begin{document}

 begin{table*}[ht]
 sisetup{
 table-number-alignment = center,
 table-figures-integer = 1,
 table-figures-decimal = 4
 }
 caption{Table ex.}
 label{tab1}
 centering
 renewcommandfootnoterule{kern -1ex}
 renewcommand{arraystretch}{1.3}
 begin{tabular}{l*{8}{S}}
 toprule multirow{3}{*}{Subjects}   & 
 multicolumn{4}{c}{Numbers} & 
 multicolumn{4}{c}{Numbers}
 cmidrule(r){2-5}cmidrule(l){6-9}  &
 multicolumn{1}{c}{XYZ} & 
 multicolumn{1}{c}addstackgap{stackanchor{XYZ}{(Numbers)}} & 
 multicolumn{1}{c}{Numbers Tree} & 
 multicolumn{1}{c}{Numbers Tree} & 
 multicolumn{1}{c}{XYZ} & 
 multicolumn{1}{c}addstackgap{stackanchor{XYZ}{(Numbers)}} & 
 multicolumn{1}{c}{Numbers Tree} & 
 multicolumn{1}{c}{Numbers Tree} midrule 
 X1 & 0.5000 & 0.4888 & 0.0112 & 0.0001 & 0.8500 & 0.3540 & 0.2332 & 0.2367 
 X2 & 0.5000 & 0.4888 & 0.0112 & 0.0001 & 0.8500 & 0.3540 & 0.2332 & 0.2367  
 X3 & 0.5000 & 0.4888 & 0.0112 & 0.0001 & 0.8500 & 0.3540 & 0.2332 & 0.2367  
 X4 & 0.5000 & 0.4888 & 0.0112 & 0.0001 & 0.8500 & 0.3540 & 0.2332 & 0.2367  
 X5 & 0.5000 & 0.4888 & 0.0112 & 0.0001 & 0.8500 & 0.3540 & 0.2332 & 0.2367 bottomrule
 end{tabular}

 end{table*}

 end{document}

Output of the above code

Answered by F. Pantigny on February 20, 2021

The main problem with your table is the unfortunate choice of 6.5 to format the 8 numerical columns; it should be 1.4 throughout. A second issue is that you employ a tabular* environment but give LaTeX no chance to achieve the desired overall width (here: linewidth). Finally, there are only 8, not 9, columns of type d.

enter image description here

documentclass[conference]{IEEEtran}
IEEEoverridecommandlockouts

usepackage{booktabs}
usepackage{dcolumn,tipa}
newcolumntype{d}[1]{D{.}{.}{#1}} % let the 'd' column type take an argument
%usepackage{siunitx}             % not needed for this example
usepackage[usestackEOL]{stackengine}
usepackage{multirow}
newcommandmcc[1]{multicolumn{1}{c}{#1}} % handy shortcut macro

begin{document}

begin{table*}[ht]
caption{Table example}
label{tab1}
%%centering % redundant
%%renewcommandfootnoterule{kern -1ex} % What is this instruction doing here??
renewcommand{arraystretch}{1.3}
setlengthtabcolsep{0pt} % make LaTeX figure out the intercolumn separation
begin{tabular*}{linewidth}{@{extracolsep{fill}} l *{8}{d{1.4}} } % '1.4', not '6.5'
toprule 
multirow{3}{*}{Subjects} & multicolumn{4}{c}{Numbers} & multicolumn{4}{c}{Numbers}
cmidrule{2-5} cmidrule{6-9} &
mcc{XYZ} & mcc{addstackgap{stackanchor{XYZ}{(Numbers)}}} & 
mcc{Numbers Tree} & mcc{Numbers Tree} & 
mcc{XYZ} & mcc{addstackgap{stackanchor{XYZ}{(Numbers)}}} & 
mcc{Numbers Tree} & mcc{Numbers Tree} 
midrule 
X1 & 0.5000 & 0.4888 & 0.0112 & 0.0001 & 0.8500 & 0.3540 & 0.2332 & 0.2367  
X2 & 0.5000 & 0.4888 & 0.0112 & 0.0001 & 0.8500 & 0.3540 & 0.2332 & 0.2367  
X3 & 0.5000 & 0.4888 & 0.0112 & 0.0001 & 0.8500 & 0.3540 & 0.2332 & 0.2367  
X4 & 0.5000 & 0.4888 & 0.0112 & 0.0001 & 0.8500 & 0.3540 & 0.2332 & 0.2367  
X5 & 0.5000 & 0.4888 & 0.0112 & 0.0001 & 0.8500 & 0.3540 & 0.2332 & 0.2367 
bottomrule
end{tabular*}
end{table*}
end{document}

Answered by Mico on February 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP