1

I am using IEEEtran.

I want this table to fit the double column width but I want the gaps between columns reduced and possibly the entire table elongated vertically so it comes out nice when printed.

\documentclass[twocolumn]{IEEEtran}
\usepackage{array,amsmath,adjustbox,multirow}
\begin{document}
\begin{table*}
\caption{XXX}
\label{tab2}
\begin{adjustbox}{max width=\textwidth}
\begin{tabular}{cc|ccc|ccc|cc|ccc|ccc|cccccc|ccc|ccc}
\hline
\multicolumn{16}{c|}{\textbf{X \& X}}                                                                                                                                                                                                                                                                                                                
& \multicolumn{6}{c|}{\textbf{X \& X}}                                                                     
& \multicolumn{3}{c|}{\multirow{2}{*}{\textbf{X}}} & \multicolumn{3}{c}  
{\multirow{2}{*}{\textbf{X}}} \\ \cline{1-22}
\multirow{2}{*}{\textbf{X}} & \multirow{2}{*}{\textbf{X}} & \multicolumn{3}  
{c|}{\textbf{X}}               & \multicolumn{3}{c|}{\textbf{X}}               
& \multirow{2}{*}{\textbf{X}} & \multirow{2}{*}{\textbf{X}} &    
\multicolumn{3}{c|}{\textbf{X}}               & \multicolumn{3}{c|}  
{\textbf{X}}             & \multicolumn{3}{c}{\textbf{X}}                                     
& \multicolumn{3}{c|}{\textbf{X}}          & \multicolumn{3}{c|}{}                                             
& \multicolumn{3}{c}{}                                               \\    
\cline{3-8} \cline{11-28}
                               &                                  &   
\textbf{X} & \textbf{X} & \textbf{\% Change} & \textbf{X} & \textbf{X} &   
\textbf{\% Change} &                                    &                                   
& \textbf{X} & \textbf{X} & \textbf{\% Change} & \textbf{X} & \textbf{X} &   
\textbf{\% Change} & \textbf{X} & \textbf{X} & \multicolumn{1}{c|}
{\textbf{\% Change}} & \textbf{X} & \textbf{X} & \textbf{\% Change} & 
\textbf{X}      & \textbf{X}     & \textbf{\% Change}     & \textbf{X}       
& \textbf{X}      & \textbf{\% Change}      \\ \hline
1                                  & 2                                &      
150.18        & 150.17        & -0.0044            & -19.91        & -19.91           
& -0.0103            & 2                                  & 1                                
& -145.41       & -145.41       & 0.0028             & 26.12         & 26.11         
& -0.0135            & 4.77          & 4.76          & \multicolumn{1}{c|}
{-0.2248}            & 6.21          & 6.21          & -0.0237            & 
79.66              & 78.98             & -0.8551                & 84.06               
& 83.45              & -0.73                   \\
1                                  & 5                                &     
81.26         & 81.24         & -0.0162            & 11.30         & 11.28         
& -0.1641            & 5                                  & 1                                
& -77.69        & -77.68        & -0.0112            & -2.47         & -2.45         
& -0.5262            & 3.57          & 3.56          & \multicolumn{1}{c|}    
{-0.1241}            & 8.83          & 8.83          & -0.0635            &     
48.89              & 48.64             & -0.4949                & 45.45                 
& 44.98              & -1.04                   \\
2                                  & 3                                &         
53.61         & 53.61         & -0.0005            & 1.52          & 1.52          
& -0.1098            & 3                                  & 2                                
& -52.27        & -52.27        & 0.0012             & -0.18         & -0.18         
& -0.1561            & 1.34          & 1.34          & \multicolumn{1}{c|}
{-0.0662}            & 1.35          & 1.34          & -0.1037            &     
42.47              & 42.33             & -0.3346                & 30.28               
& 29.85              & -1.44                   \\
2                                  & 4                                & 
62.87         & 62.87         & 0.0030             & 2.96          & 2.96          
& 0.0938             & 4                                  & 2                                
& -60.57        & -60.57        & 0.0057             & -1.57         & -1.58         
& 0.2546             & 2.30          & 2.30          & \multicolumn{1}{c|}
{-0.0677}            & 1.39          & 1.38          & -0.0892            & 
44.37              & 44.20             & -0.3841                & 35.51               
& 35.08              & -1.24                   \\
2                                  & 5                                & 
50.65         & 50.65         & 0.0048             & 6.70          & 6.70          
& 0.0360             & 5                                  & 2                                
& -49.17        & -49.17        & 0.0065             & -5.99         & -6.00             
& 0.0508             & 1.48          & 1.48          & \multicolumn{1}{c|}    
{-0.0513}            & 0.71          & 0.71          & -0.0896            &     
42.05              & 41.91             & -0.3213                & 28.97               
& 28.54              & -1.50                   \\
3                                  & 4                                & 5.17          
& 5.17          & 0.0121             & 4.58          & 4.58          & 
-0.0061            & 4                                  & 3                                
& -5.12         & -5.12         & 0.0125             & -7.96         & -7.96         
& 0.0044             & 0.05          & 0.05          & \multicolumn{1}{c|}    
{-0.0326}            & -3.38         & -3.38         & 0.0185             & 
37.73              & 37.66             & -0.1838                & 6.10                
& 4.92               & -24.01                  \\
4                                  & 5                                & 
-51.21        & -51.20        & -0.0081            & 14.36         & 14.37         
& 0.0486             & 5                                  & 4                                
& 51.62         & 51.61         & -0.0087            & -14.43        &     
-14.44        & 0.0520             & 0.41          & 0.41          & 
\multicolumn{1}{c|}{-0.0788}            & -0.07         & -0.07         & 
0.7179             & 42.83              & 42.68             & -0.3457                
& 31.32               & 30.89              & -1.40                   \\
4                                  & 7                                &               
&               &                    & -3.89         & -3.89         &     
0.0492             & 7                                  & 4                                
&               &               &                    & 7.89          & 7.89          
& 0.0154             &               &               & \multicolumn{1}{c|}{}                       
& 4.00          & 3.99          & -0.0175            &                    &                   
&                        &                     &                    &                         
\\
4                                  & 9                                &               
&               &                    & 2.97          & 2.97          & -0.0262            
& 9                                  & 4                                &               
&               &                    & 0.50          & 0.50          & 0.0271             
&               &               & \multicolumn{1}{c|}{}                   & 3.47          
& 3.47          & -0.0185            &                    &                   &                        
&                     &                    &                         \\
5                                  & 6                                &               
&               &                    & 22.85         & 22.85         & -0.0110            
& 6                                  & 5                                &               
&               &                    & -11.02        & -11.02        & -0.0002            
&               &               & \multicolumn{1}{c|}{}                   & 
11.83         & 11.83         & -0.0211            &                    &                   
&                        &                     &                    &                         
\\
6                                  & 11                               & 8.71          
& 8.71          & -0.0031            & 3.65          & 3.65          & 0.0053             
& 11                                 & 6                                & -8.63         
& -8.63         & -0.0027            & -3.49         & -3.49         & 0.0066             
& 0.08          & 0.08          & \multicolumn{1}{c|}{-0.0476}            & 0.17          
& 0.17          & -0.0219            & 37.76              & 37.69             & 
-0.1851                & 6.58                & 5.49               & -19.78                  
\\
6                                  & 12                               & 14.84         
& 14.84         & -0.0018            & 2.92          & 2.92          & -0.0102            
& 12                                 & 6                                & -14.57        
& -14.57        & -0.0009            & -2.37         & -2.37         & -0.0074            
& 0.28          & 0.28          & \multicolumn{1}{c|}{-0.0494}            & 0.55          
& 0.55          & -0.0224            & 37.99              & 37.92             
& -0.1934                & 9.34                & 8.57               & -8.97                   
\\
6                                  & 13                               & 32.89         
& 32.89         & -0.0015            & 8.40          & 8.40          & 0.0010             
& 13                                 & 6                                & -32.14        
& -32.14        & -0.0002            & -6.99         & -6.99         & 0.0053             
& 0.75          & 0.75          & \multicolumn{1}{c|}{-0.0564}            & 1.40          
& 1.40          & -0.0208            & 39.55              & 39.45             & 
-0.2466                & 19.45               & 18.98              & -2.48                   
\\
7                                  & 8                                &               
&               &                    & -16.93        & -16.93        & 0.0005             
& 8                                  & 7                                &               
&               &                    & 17.40         & 17.40         & 0.0000             
&               &               & \multicolumn{1}{c|}{}                   & 0.47          
& 0.47          & -0.0172            &                    &                   &                        
&                     &                    &                         \\

7                                  & 9                                &               
&               &                    & 9.21          & 9.21          & -0.0120            
& 9                                  & 7                                &               
&               &                    & -7.13         & -7.13         & -0.0099            
&               &               & \multicolumn{1}{c|}{}                   & 2.08          
& 2.08          & -0.0194            &                    &                   &                        
&                     &                    &                         \\
9                                  & 10                               & 16.47         
& 16.47         & 0.0012             & 4.36          & 4.36          & -0.0063            
& 10                                 & 9                                & -16.38        
& -16.38        & 0.0014             & -4.12         & -4.12         & -0.0057            
& 0.09          & 0.09          & \multicolumn{1}{c|}{-0.0449}            & 0.23              
& 0.23          & -0.0173            & 38.11              & 38.03             & 
-0.1974                & 10.42               & 9.72               & -7.19                   
\\

9                                  & 14                               & 23.13         
& 23.13         & -0.0010            & 4.69          & 4.69          & -0.0120            
& 14                                 & 9                                & -22.42        
& -22.42        & 0.0006             & -3.25         & -3.25         & -0.0077            
& 0.71          & 0.71          & \multicolumn{1}{c|}{-0.0517}            & 1.44          
& 1.44          & -0.0216            & 38.56              & 38.48             & 
-0.2135                & 13.94               & 13.38              & -4.20                   
\\
10                                 & 11                               & -1.62         
& -1.62         & -0.0143            & -1.68         & -1.68         & 0.0139             
& 11                                 & 10                               & 1.63          
& 1.63          & -0.0144            & 1.69          & 1.69          & 0.0137             
& 0.00          & 0.00          & \multicolumn{1}{c|}{-0.0437}            & 0.01          
& 0.01          & -0.0188            & 37.62              & 37.55             & 
-0.1800                & 4.12                & 2.06               & -100.12                 
\\

12                                 & 13                               & 2.37          
& 2.37          & -0.0055            & 0.77          & 0.77          & 
-0.0226            
& 13                                 & 12                               & 
-2.35         
& -2.35         & -0.0052            & -0.76         & -0.76         & 
-0.0224            
& 0.01          & 0.01          & \multicolumn{1}{c|}{-0.0594}            & 
0.01          
& 0.01          & -0.0345            & 37.62              & 37.55                 
&     
-0.1800                & 4.15                & 2.12               & -95.73                      
\\
13                                 & 14                               & 7.49          
& 7.49          & -0.0024            & 1.95          & 1.95          & 
0.0103             
& 14                                 & 13                               &     
-7.38         
& -7.38         & -0.0017            & -1.75         & -1.75         &     
0.0144             
& 0.11          & 0.11          & \multicolumn{1}{c|}{-0.0496}            & 
0.21          
& 0.21          & -0.0241            & 37.71              & 37.65             
& 
-0.1835                & 5.94                & 4.72               & -25.84                  
\\ \hline
                               &                                  &               
& Total         & -0.0377            &               & Total         & 
-0.1319            
&                                    &                                  &               
& Total         & -0.0142            &               & Total         &     
-0.3047            
&               & Total         & \multicolumn{1}{c|}{-1.0481}            &                   
& Total         & 0.0916             &                    & Total                 
&     
-4.4992                &                     & Total              & -295.69                     
\\ \hline
\end{tabular}
\end{adjustbox}
\end{table*}
\end{document}
1
  • 2
    your table is to huge that after it fit to page be readable (fonts are smaller then \tiny) . you should reconsider to reorganize it: split into two parts and parts then vertically stack in one table.
    – Zarko
    Commented Apr 5, 2017 at 10:28

1 Answer 1

1

I've put your table vertically using sidewaystable and I've decreased the gap between the columns with \setlength{\tabcolsep}{3.3pt}.

Moreover, I've used dcolumn to better align the columns (if you don't like it, you can easily go back to c alignment) and \renewcommand*{\arraystretch}{2} to increase the gap between rows.

However, as Zarko said, you should reconsider to reorganize your table, split it into two or more parts and also avoid vertical rules.

\documentclass[twocolumn]{IEEEtran}
\usepackage{array,amsmath,multirow}
\renewcommand*{\arraystretch}{2}
\setlength{\tabcolsep}{3.3pt}
\usepackage{float,rotating}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}
%\usepackage{showframe} % for testing purpose only

\begin{document}
\begin{sidewaystable}
    \vspace*{.35\linewidth}
    \centering  \tiny
        \caption{XXX}
        \label{tab2}
            \begin{tabular}{d{2.0}d{2.0}|d{3.2}d{3.2}d{2.4}|d{3.2}d{3.2}d{2.4}|d{2.0}d{2.0}|d{4.2}d{4.2}d{2.4}|d{3.2}d{3.2}d{2.4}|d{1.2}d{1.2}d{2.4}|d{2.2}d{2.2}d{2.4}|d{2.2}d{2.2}d{2.4}|d{2.2}d{2.2}d{4.2}}
                \hline
                 \multicolumn{16}{c|}{\textbf{X \& X}}                                                                                                                                                                                                                                                                                                                
                & \multicolumn{6}{c|}{\textbf{X \& X}}                                                                     
                & \multicolumn{3}{c|}{\multirow{2}{*}{\textbf{X}}} & \multicolumn{3}{c}  
                {\multirow{2}{*}{\textbf{X}}} \\ 
                \cline{1-22}
                 \multirow{2}{*}{\textbf{X}} & \multirow{2}{*}{\textbf{X}} & \multicolumn{3}  
                {c|}{\textbf{X}}               & \multicolumn{3}{c|}{\textbf{X}}               
                & \multirow{2}{*}{\textbf{X}} & \multirow{2}{*}{\textbf{X}} &    
                \multicolumn{3}{c|}{\textbf{X}}               & \multicolumn{3}{c|}  
                {\textbf{X}}             & \multicolumn{3}{c|}{\textbf{X}}                                     
                & \multicolumn{3}{c|}{\textbf{X}}          & \multicolumn{3}{c|}{}                                             
                & \multicolumn{3}{c}{}                                               \\    
                \cline{3-8} \cline{11-28}
                 &                                  &   
                \textbf{X} & \textbf{X} & \multicolumn{1}{r|}{\textbf{\% Change}} & \textbf{X} & \textbf{X} &   
                \multicolumn{1}{r|}{\textbf{\% Change}} &                                    &                                   
                & \textbf{X} & \textbf{X} & \multicolumn{1}{r|}{\textbf{\% Change}} & \textbf{X} & \textbf{X} &   
                \multicolumn{1}{r|}{\textbf{\% Change}} & \textbf{X} & \textbf{X} & \multicolumn{1}{r|}
                {\textbf{\% Change}} & \textbf{X} & \textbf{X} & \multicolumn{1}{r|}{\textbf{\% Change}} & 
                \textbf{X}      & \textbf{X}     & \multicolumn{1}{r|}{\textbf{\% Change}}     & \textbf{X}       
                & \textbf{X}      & \multicolumn{1}{r}{\textbf{\% Change}}      \\ \hline
                 1                                & 2                                &      
                150.18        & 150.17        & -0.0044            & -19.91        & -19.91           
                & -0.0103            & 2                                  & 1                                
                & -145.41       & -145.41       & 0.0028             & 26.12         & 26.11         
                & -0.0135            & 4.77          & 4.76          & -0.2248            & 6.21          & 6.21          & -0.0237            & 
                79.66              & 78.98             & -0.8551                & 84.06               
                & 83.45              & -0.73                   \\
                1                                  & 5                                &     
                81.26         & 81.24         & -0.0162            & 11.30         & 11.28         
                & -0.1641            & 5                                  & 1                                
                & -77.69        & -77.68        & -0.0112            & -2.47         & -2.45         
                & -0.5262            & 3.57          & 3.56          & -0.1241            & 8.83          & 8.83          & -0.0635            &     
                48.89              & 48.64             & -0.4949                & 45.45                 
                & 44.98              & -1.04                   \\
                2                                  & 3                                &         
                53.61         & 53.61         & -0.0005            & 1.52          & 1.52          
                & -0.1098            & 3                                  & 2                                
                & -52.27        & -52.27        & 0.0012             & -0.18         & -0.18         
                & -0.1561            & 1.34          & 1.34          & -0.0662            & 1.35          & 1.34          & -0.1037            &     
                42.47              & 42.33             & -0.3346                & 30.28               
                & 29.85              & -1.44                   \\
                2                                  & 4                                & 
                62.87         & 62.87         & 0.0030             & 2.96          & 2.96          
                & 0.0938             & 4                                  & 2                                
                & -60.57        & -60.57        & 0.0057             & -1.57         & -1.58         
                & 0.2546             & 2.30          & 2.30          & -0.0677            & 1.39          & 1.38          & -0.0892            & 
                44.37              & 44.20             & -0.3841                & 35.51               
                & 35.08              & -1.24                   \\
                2                                  & 5                                & 
                50.65         & 50.65         & 0.0048             & 6.70          & 6.70          
                & 0.0360             & 5                                  & 2                                
                & -49.17        & -49.17        & 0.0065             & -5.99         & -6.00             
                & 0.0508             & 1.48          & 1.48          & -0.0513            & 0.71          & 0.71          & -0.0896            &     
                42.05              & 41.91             & -0.3213                & 28.97               
                & 28.54              & -1.50                   \\
                3                                  & 4                                & 5.17          
                & 5.17          & 0.0121             & 4.58          & 4.58          & 
                -0.0061            & 4                                  & 3                                
                & -5.12         & -5.12         & 0.0125             & -7.96         & -7.96         
                & 0.0044             & 0.05          & 0.05          & -0.0326            & -3.38         & -3.38         & 0.0185             & 
                37.73              & 37.66             & -0.1838                & 6.10                
                & 4.92               & -24.01                  \\
                4                                  & 5                                & 
                -51.21        & -51.20        & -0.0081            & 14.36         & 14.37         
                & 0.0486             & 5                                  & 4                                
                & 51.62         & 51.61         & -0.0087            & -14.43        &     
                -14.44        & 0.0520             & 0.41          & 0.41          & 
                -0.0788            & -0.07         & -0.07         & 
                0.7179             & 42.83              & 42.68             & -0.3457                
                & 31.32               & 30.89              & -1.40                   \\
                4                                  & 7                                &               
                &               &                    & -3.89         & -3.89         &     
                0.0492             & 7                                  & 4                                
                &               &               &                    & 7.89          & 7.89          
                & 0.0154             &               &               &                        
                & 4.00          & 3.99          & -0.0175            &                    &                   
                &                        &                     &                    &                         
                \\
                4                                  & 9                                &               
                &               &                    & 2.97          & 2.97          & -0.0262            
                & 9                                  & 4                                &               
                &               &                    & 0.50          & 0.50          & 0.0271             
                &               &               &                    & 3.47          
                & 3.47          & -0.0185            &                    &                   &                        
                &                     &                    &                         \\
                5                                  & 6                                &               
                &               &                    & 22.85         & 22.85         & -0.0110            
                & 6                                  & 5                                &               
                &               &                    & -11.02        & -11.02        & -0.0002            
                &               &               &                 & 
                11.83         & 11.83         & -0.0211            &                    &                   
                &                        &                     &                    &                         
                \\
                6                                  & 11                               & 8.71          
                & 8.71          & -0.0031            & 3.65          & 3.65          & 0.0053             
                & 11                                 & 6                                & -8.63         
                & -8.63         & -0.0027            & -3.49         & -3.49         & 0.0066             
                & 0.08          & 0.08          & -0.0476         & 0.17          
                & 0.17          & -0.0219            & 37.76              & 37.69             & 
                -0.1851                & 6.58                & 5.49               & -19.78                  
                \\
                6                                  & 12                               & 14.84         
                & 14.84         & -0.0018            & 2.92          & 2.92          & -0.0102            
                & 12                                 & 6                                & -14.57        
                & -14.57        & -0.0009            & -2.37         & -2.37         & -0.0074            
                & 0.28          & 0.28          & -0.0494            & 0.55          
                & 0.55          & -0.0224            & 37.99              & 37.92             
                & -0.1934                & 9.34                & 8.57               & -8.97                   
                \\
                6                                  & 13                               & 32.89         
                & 32.89         & -0.0015            & 8.40          & 8.40          & 0.0010             
                & 13                                 & 6                                & -32.14        
                & -32.14        & -0.0002            & -6.99         & -6.99         & 0.0053             
                & 0.75          & 0.75          & -0.0564           & 1.40          
                & 1.40          & -0.0208            & 39.55              & 39.45             & 
                -0.2466                & 19.45               & 18.98              & -2.48                   
                \\
                7                                  & 8                                &               
                &               &                    & -16.93        & -16.93        & 0.0005             
                & 8                                  & 7                                &               
                &               &                    & 17.40         & 17.40         & 0.0000             
                &               &               &                    & 0.47          
                & 0.47          & -0.0172            &                    &                   &                        
                &                     &                    &                         \\

                7                                  & 9                                &               
                &               &                    & 9.21          & 9.21          & -0.0120            
                & 9                                  & 7                                &               
                &               &                    & -7.13         & -7.13         & -0.0099            
                &               &               &                    & 2.08          
                & 2.08          & -0.0194            &                    &                   &                        
                &                     &                    &                         \\
                9                                  & 10                               & 16.47         
                & 16.47         & 0.0012             & 4.36          & 4.36          & -0.0063            
                & 10                                 & 9                                & -16.38        
                & -16.38        & 0.0014             & -4.12         & -4.12         & -0.0057            
                & 0.09          & 0.09          & -0.0449            & 0.23              
                & 0.23          & -0.0173            & 38.11              & 38.03             & 
                -0.1974                & 10.42               & 9.72               & -7.19                   
                \\

                9                                  & 14                               & 23.13         
                & 23.13         & -0.0010            & 4.69          & 4.69          & -0.0120            
                & 14                                 & 9                                & -22.42        
                & -22.42        & 0.0006             & -3.25         & -3.25         & -0.0077            
                & 0.71          & 0.71          & -0.0517            & 1.44          
                & 1.44          & -0.0216            & 38.56              & 38.48             & 
                -0.2135                & 13.94               & 13.38              & -4.20                   
                \\
                10                                 & 11                               & -1.62         
                & -1.62         & -0.0143            & -1.68         & -1.68         & 0.0139             
                & 11                                 & 10                               & 1.63          
                & 1.63          & -0.0144            & 1.69          & 1.69          & 0.0137             
                & 0.00          & 0.00          & -0.0437           & 0.01          
                & 0.01          & -0.0188            & 37.62              & 37.55             & 
                -0.1800                & 4.12                & 2.06               & -100.12                 
                \\

                12                                 & 13                               & 2.37          
                & 2.37          & -0.0055            & 0.77          & 0.77          & 
                -0.0226            
                & 13                                 & 12                               & 
                -2.35         
                & -2.35         & -0.0052            & -0.76         & -0.76         & 
                -0.0224            
                & 0.01          & 0.01          & -0.0594            & 
                0.01          
                & 0.01          & -0.0345            & 37.62              & 37.55                 
                &     
                -0.1800                & 4.15                & 2.12               & -95.73                      
                \\
                13                                 & 14                               & 7.49          
                & 7.49          & -0.0024            & 1.95          & 1.95          & 
                0.0103             
                & 14                                 & 13                               &     
                -7.38         
                & -7.38         & -0.0017            & -1.75         & -1.75         &     
                0.0144             
                & 0.11          & 0.11          & -0.0496           & 
                0.21          
                & 0.21          & -0.0241            & 37.71              & 37.65             
                & 
                -0.1835                & 5.94                & 4.72               & -25.84                  
                \\ \hline
                &                                  &               
                & \multicolumn{1}{r}{Total}         & -0.0377            &               & \multicolumn{1}{r}{Total}         & 
                -0.1319            
                &                                    &                                  &               
                & \multicolumn{1}{r}{Total}         & -0.0142            &               & \multicolumn{1}{r}{Total}         &     
                -0.3047            
                &               & \multicolumn{1}{r}{Total}         & -1.0481            &                   
                & \multicolumn{1}{r}{Total}         & 0.0916             &                    & \multicolumn{1}{r}{Total}                 
                &     
                -4.4992                &                     & \multicolumn{1}{r}{Total}              & -295.69                     
                \\ 
                \hline
            \end{tabular}
\end{sidewaystable}
\end{document}

enter image description here

You must log in to answer this question.

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