Why is the header overlaps in the following table:
and how can I improve it?
\begin{table}[H]
\centering
\sisetup{table-format=1.3e-2, table-alignment=center, tight-spacing}
\setlength{\tabcolsep}{3pt}
\small
\centering
\sisetup{detect-weight,mode=text}
\renewrobustcmd{\bfseries}{\fontseries{b}\selectfont}
\renewrobustcmd{\boldmath}{}
% abbreviation
\newrobustcmd{\B}{\bfseries}
% shorten the intercolumn spaces
\addtolength{\tabcolsep}{-4.1pt}
\begin{tabularx}{\linewidth}{X cSS[table-format=1.5] SS[table-format=1.5]}
\toprule
\thead {Algorithm\\ Name} & {\thead{ABC Dataset \\ Name} }& {\thead{Bxxx ABS Txx\\ aaaa $80\%$ }} & {\thead{Mxxx YYYYYYY Tcxx\\ Tzzz $80\%$} }
& {\thead{Bxxx sdsdf Tfds\\Tdfs $90\%$}} \\ [0.5ex]
\midrule
ABCD & XXXXX YYY & 0.222 & 0.228 & \B 0.230 \\
ABCD & DEFG & 0.222 & \B 0.282 & 0.222 \\
ABCD & ABCD & 0.992 & 0.992 & \B 0.998 \\
ABCD & XXXXX Y & 0.992 & 0.992 & \B 0.992 \\
DEF & XXXXX Hand & 0.220 & \B 0.222 & 0.222 \\
DEF & DEFG & 0.223 & 0.232 & \B 0.22 \\
DEF & ABCD & 0.999 & \B 2.000 & 0.999 \\
DEF & XXXXX YY & 0.998 & \B 0.999 & 0.998 \\ [2ex]
\bottomrule
\end{tabularx}
\caption{Cfdfsd (In \textbf{Bold} the gsfdsd per line)}
\label{table:4}
\end{table}


\bottomrule,tabularx,\newrobustcmd,\sisetupare defined by default – David Carlisle Jan 01 '18 at 13:440.6\linewidthI suggested in a comment to your other question was a guess only, I did not check. If that value does not fit, you've to increase it accordingly. – Jan 01 '18 at 13:48tabularbut unless you provide a proper example we have no information about the width of the column, so can not suggest how much the table needs to shrink. – David Carlisle Jan 01 '18 at 13:50tabularx... you also have issues with number of columns. – Zarko Jan 01 '18 at 13:51