I tried different solutions to make the following table fit the width of the page, but no success.
Your help is highly appreciated!
%%%The Table
\documentclass[12pt,oneside]{book}
\usepackage{booktabs,tabularx}
\usepackage{caption}
\usepackage{booktabs,array}
\usepackage{multirow}
\begin{document}
\begin{table*}[]
\centering
\caption{XYZ}
\label{xyz}
\begin{tabularx}{\textwidth}{@{}ccccccccccccccccccccc@{}}
\hline \hline
\multirow{4}{*}{Distribution model} & \multicolumn{20}{c}{SNR (dB)} \\ \cmidrule(l){2-21}
& \multicolumn{4}{c}{-12} & \multicolumn{4}{c}{-6} & \multicolumn{4}{c}{0} & \multicolumn{4}{c}{4} & \multicolumn{4}{c}{8} \\ \cmidrule(lr){2-5} \cmidrule(lr){6-9} \cmidrule(lr){10-13} \cmidrule(lr){14-17} \cmidrule(lr){18-21}
& \multicolumn{2}{c}{Colored} & \multicolumn{2}{c}{White} & \multicolumn{2}{c}{Colored} & \multicolumn{2}{c}{White} & \multicolumn{2}{c}{Colored} & \multicolumn{2}{c}{White} & \multicolumn{2}{c}{Colored} & \multicolumn{2}{c}{White} & \multicolumn{2}{c}{Colored} & \multicolumn{2}{c}{White} \\ \cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7} \cmidrule(lr){8-9} \cmidrule(lr){10-11} \cmidrule(lr){12-13} \cmidrule(lr){14-15} \cmidrule(lr){16-17} \cmidrule(lr){18-19} \cmidrule(lr){20-21}
& \multicolumn{1}{l}{$SNR_o$} & \multicolumn{1}{l}{MSE} & \multicolumn{1}{l}{$SNR_o$} & \multicolumn{1}{l}{MSE} & \multicolumn{1}{l}{$SNR_o$} & \multicolumn{1}{l}{MSE} & \multicolumn{1}{l}{$SNR_o$} & \multicolumn{1}{l}{MSE} & \multicolumn{1}{l}{$SNR_o$} & \multicolumn{1}{l}{MSE} & \multicolumn{1}{l}{$SNR_o$} & \multicolumn{1}{l}{MSE} & \multicolumn{1}{l}{$SNR_o$} & \multicolumn{1}{l}{MSE} & \multicolumn{1}{l}{$SNR_o$} & \multicolumn{1}{l}{MSE} & \multicolumn{1}{l}{$SNR_o$} & \multicolumn{1}{l}{MSE} & \multicolumn{1}{l}{$SNR_o$} & \multicolumn{1}{l}{MSE} \\ \hline
Laplacian & 2.66 & 1.51 & 5.26 & 0.60 & 6.27 & 0.386 & 10.17 & 0.15 & 11.48 & 0.096 & 15.70 & 0.038 & 15.26 & 0.038 & 19.55 & 0.015 & 19.22 & 0.015 & 23.49 & 0.0062 \\
Gaussian & 6.12 & 0.505 & 16.09 & 0.044 & 10.98 & 0.129 & 21.45 & 0.0127 & 16.44 & 0.032 & 26.44 & 0.0034 & 19.87 & 0.014 & \textbf{29.74} & \textbf{0.0016} & \textbf{23.57} & \textbf{0.006} & \textbf{32.92} & \textbf{0.0008} \\
Uniform & \textbf{8.62} & \textbf{0.29} & \textbf{17.11} & \textbf{0.032} & \textbf{12.55} & \textbf{0.084} & \textbf{22.15} & \textbf{0.0095} & \textbf{17.25} & \textbf{0.026} & \textbf{26.5} & \textbf{0.0033} & \textbf{20.28} & \textbf{0.013} & 29.37 & 0.0018 & 23.54 & 0.0072 & 32.54 & 0.001 \\ \hline \hline
\end{tabularx}
\end{table*}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The modified code:
\documentclass[11pt,oneside]{book}
\usepackage{booktabs,tabularx}
\usepackage{caption}
\usepackage{booktabs,array}
\usepackage{graphicx,multirow}
\begin{document}
\begin{table}[htp]
\centering
\caption{XYZ}
\scriptsize\setlength{\tabcolsep}{2pt}
\hspace*{-4cm}
\begin{tabular}{l@{\hspace{4pt}} *{21}{c}}
\hline \hline
\multirow{4}{*}{\rotatebox[origin=c]{90}{\kern-2em Distribution}} & \multicolumn{20}{c}{SNR (dB)} \\ \cmidrule(l){2-21}
& \multicolumn{4}{c}{-12} & \multicolumn{4}{c}{-6} & \multicolumn{4}{c}{0} & \multicolumn{4}{c}{4} & \multicolumn{4}{c}{8} \\ \cmidrule(lr){2-5} \cmidrule(lr){6-9} \cmidrule(lr){10-13} \cmidrule(lr){14-17} \cmidrule(lr){18-21}
& \multicolumn{2}{c}{Colored} & \multicolumn{2}{c}{White} & \multicolumn{2}{c}{Colored} & \multicolumn{2}{c}{White} & \multicolumn{2}{c}{Colored} & \multicolumn{2}{c}{White} & \multicolumn{2}{c}{Colored} & \multicolumn{2}{c}{White} & \multicolumn{2}{c}{Colored} & \multicolumn{2}{c}{White} \\ \cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7} \cmidrule(lr){8-9} \cmidrule(lr){10-11} \cmidrule(lr){12-13} \cmidrule(lr){14-15} \cmidrule(lr){16-17} \cmidrule(lr){18-19} \cmidrule(lr){20-21}
& \multicolumn{1}{l}{$\textrm{SNR}_o$} & \multicolumn{1}{l}{MSE} & \multicolumn{1}{l}{$\textrm{SNR}_o$} & \multicolumn{1}{l}{MSE} & \multicolumn{1}{l}{$\textrm{SNR}_o$} & \multicolumn{1}{l}{MSE} & \multicolumn{1}{l}{$\textrm{SNR}_o$} & \multicolumn{1}{l}{MSE} & \multicolumn{1}{l}{$\textrm{SNR}_o$} & \multicolumn{1}{l}{MSE} & \multicolumn{1}{l}{$\textrm{SNR}_o$} & \multicolumn{1}{l}{MSE} & \multicolumn{1}{l}{$SNR_o$} & \multicolumn{1}{l}{MSE} & \multicolumn{1}{l}{$SNR_o$} & \multicolumn{1}{l}{MSE} & \multicolumn{1}{l}{$SNR_o$} & \multicolumn{1}{l}{MSE} & \multicolumn{1}{l}{$\textrm{SNR}_o$} & \multicolumn{1}{l}{MSE} \\ \hline
Laplacian & 2.66 & 1.51 & 5.26 & 0.60 & 6.27 & 0.386 & 10.17 & 0.15 & 11.48 & 0.096 & 15.70 & 0.038 & 15.26 & 0.038 & 19.55 & 0.015 & 19.22 & 0.015 & 23.49 & 0.0062 \\
Gaussian & 6.12 & 0.505 & 16.09 & 0.044 & 10.98 & 0.129 & 21.45 & 0.0127 & 16.44 & 0.032 & 26.44 & 0.0034 & 19.87 & 0.014 & \textbf{29.74} & \textbf{0.0016} & \textbf{23.57} & \textbf{0.006} & \textbf{32.92} & \textbf{0.0008} \\
Uniform & \textbf{8.62} & \textbf{0.29} & \textbf{17.11} & \textbf{0.032} & \textbf{12.55} & \textbf{0.084} & \textbf{22.15} & \textbf{0.0095} & \textbf{17.25} & \textbf{0.026} & \textbf{26.5} & \textbf{0.0033} & \textbf{20.28} & \textbf{0.013} & 29.37 & 0.0018 & 23.54 & 0.0072 & 32.54 & 0.001 \\ \hline \hline
\end{tabular}
\hspace*{-3cm}
\end{table}
\end{document}


a1paperpage. You want to fit that onto a normal paper? You cannot squeeze an elephant into a suitcase. – Johannes_B May 13 '17 at 05:18@and the user name, you would not reach the user with your comment. Anyway: The table is extreme wide, so you need to change something or you need to shrink it as much, that you need to add a microscope to the book. I think rotation or other standard suggestions wouldn't be enough in this case. – Schweinebacke May 13 '17 at 06:36Can I change the page setting only for the page of the table to be \documentclass[11pt,oneside]{book} instead of the rest of the document that must be [12pt,oneside].
– Mhameed May 13 '17 at 20:08