[Tex/LaTex] How to reduce space between two columns

alignmenthorizontal alignmentmulticolumntablesvertical alignment

I have the table shown below. Due to the fact that the titles in Rown#2 are long, the numbers and their percentages become so distant from each other and made the table unreadable.

enter image description here

Q: How to reduced the space between the columns which contains numbers and percentage so the distance becomes reasonable and the number and its percentage become close to each other.

I have a shorter titles in another table and the problem did not arise and it looks good to me. I would like my big table above to look like this in terms of columns spaces between the number and its percentage.

enter image description here

Note that I need to separate the number from its percentage because of alignment issue that could not be solved otherwise.

Here is the sample script:

\documentclass[10pt]{llncs}
\usepackage{graphicx}
\usepackage{sistyle} 
\SIthousandsep{,} 
\usepackage{booktabs} 
\usepackage{array, makecell} 
\usepackage{adjustbox} 

\begin{document}
\title{Test}
\maketitle

\begin{table}[!tp]
    \centering
    \caption{Table}
    \begin{tabular}{lrrrrrr}
        \toprule
        & \multicolumn{6}{c}{\thead{Title}} \\
        \cline{2-7}
        & \multicolumn{2}{r}{\texttt{Col\#1 title starts here}} & \multicolumn{2}{r}{\texttt{Col\#2 title starts here}}     & \multicolumn{2}{r}{\texttt{Col\#3 title starts here}} \\
        \midrule
        Title \#1               
        & \multicolumn{2}{r}{\num{44444}} & \multicolumn{2}{r}{\num{222222}} & \multicolumn{2}{r}{\num{1111111}} \\
        \midrule 
        \quad Title\#2 is Here      
        & \num{44444}&(99.99\%) & \num{222222}&(99.99\%) & \num{1111111}&(99.99\%) \\
        \midrule            
        \quad \quad Title\#3 is Here (brackets)     
        & \num{44444}&(99.99\%)   & \num{222222}&(99.99\%)  & \num{1111111}&(99.99\%)\\
        \quad \quad \quad Title \#4 is Here      
        & \num{33333}&(77.77\%)  & \num{666666}&(22.22\%)   & \num{1111111}&(111\%) \\
        \quad \quad \quad \quad \% Title\#4 is Here 
        & \num{77}&(2.22\%)      & \num{361}&(0.59\%)       & \num{444444}&(33.33\%) \\
        \bottomrule
    \end{tabular}
    \vspace{-10pt}
\end{table}

\end{document}

Best Answer

You need to allow line breaks. One way to do so is to employ a tabularx environment.

enter image description here

\documentclass[10pt]{llncs}
\usepackage{sistyle} 
\SIthousandsep{,} 
\usepackage{booktabs} 
\usepackage{tabularx, ragged2e, makecell} 
\newcolumntype{R}{>{\RaggedLeft\arraybackslash}X}
\newcolumntype{C}{>{\Centering\arraybackslash}X}
\newcommand\myhsize{\dimexpr2\hsize+2\tabcolsep\relax}
\begin{document}

\begin{table}[!th]
\setlength\tabcolsep{2pt} % default: 6pt
\caption{Table}
\begin{tabularx}{\textwidth}{@{} l *{6}{R} @{}}
\toprule
& \multicolumn{6}{c@{}}{Title} \\
\cmidrule(l){2-7}
& \multicolumn{2}{>{\hsize=\myhsize\linewidth=\hsize}C}{\texttt{Col\#1 title starts here}} 
& \multicolumn{2}{>{\hsize=\myhsize\linewidth=\hsize}C}{\texttt{Col\#2 title starts here}}     
& \multicolumn{2}{>{\hsize=\myhsize\linewidth=\hsize}C@{}}{\texttt{Col\#3 title starts here}}\\
\midrule
Title \#1               
& \multicolumn{2}{r}{\num{44444}} 
& \multicolumn{2}{r}{\num{222222}} 
& \multicolumn{2}{r@{}}{\num{1111111}} \\
\midrule 
\quad Title\#2 here      
    & \num{44444}   & (99.99\%) 
    & \num{222222}  & (99.99\%) 
    & \num{1111111} & (99.99\%) \\
\midrule            
\qquad Title\#3 here      
    & \num{44444}   & (99.99\%)   
    & \num{222222}  & (99.99\%)  
    & \num{1111111} & (99.99\%)\\
\qquad\quad Title \#4 here      
    & \num{33333}   &  (77.77\%)  
    & \num{666666}  &  (22.22\%)   
    & \num{1111111} & (111\%)\\
\qquad\qquad Title\#5 here 
    & \num{77}      &  (2.22\%)
    & \num{361}     &  (0.59\%)
    & \num{444444}  & (33.33\%)\\
\bottomrule
\end{tabularx}
\end{table}

\end{document}