Fit large table horizontally into a page

Please try to ensure your question has a complete document that shows all packages used (I had to guess booktabs) and avoids unrelated errors

! Extra alignment tab has been changed to \cr.

However

enter image description here

\documentclass{article}
 \usepackage{graphicx,rotating,booktabs}

\usepackage[verbose]{placeins}
\usepackage[ngerman]{babel}
\usepackage{blindtext}


\begin{document}

    \begin{sidewaystable}[htbf]
    \caption{Gross errors found using plausible value check}
    \label{tab:gr}
  \bigskip
    \centering\small\setlength\tabcolsep{2pt}
        \hspace*{-1cm}\begin{tabular}{l  c c c c c c c c c c c c c c c c c c c c c c c  }
           \toprule
             \textbf{Name} &\textbf{2} &\textbf{3} &\textbf{4} &\textbf{5} &\textbf{6} &\textbf{7} &\textbf{8} &\textbf{9} &\textbf{10} &\textbf{11} &\textbf{12} &\textbf{13} &\textbf{14} &\textbf{15} &\textbf{17} &\textbf{18} &\textbf{19} &\textbf{20} &\textbf{25} &\textbf{28} &\textbf{29} &\textbf{31} &\textbf{32} \\
           \midrule
             \textbf{Total Number Observations} 33 & 34 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33  \\
             \textbf{Number of Faults} & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33  \\

           \bottomrule
        \end{tabular}\hspace*{-1cm}
\end{sidewaystable}
\end{document}

You can try and spare on intercolumn spaces, by locally reducing the value of \tabcolsep; also the headers should be as short as possible.

\documentclass{article}

\usepackage[pass,showframe]{geometry} % just to show the margins
\usepackage{booktabs}

\begin{document}

Here is a table

\begin{table}[htp]
\centering
\footnotesize\setlength{\tabcolsep}{2.5pt}
\begin{tabular}{l@{\hspace{6pt}} *{22}{c}}
\toprule
\bfseries Type & \multicolumn{22}{c}{\bfseries Node name} \\
\cmidrule(l){2-23}
& 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 \\
\midrule
\bfseries A
& 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33
& 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 \\
\bfseries B
& 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33
& 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 & 33 \\
\bottomrule
\addlinespace
\multicolumn{23}{l}{A: Total number of observations}\\
\multicolumn{23}{l}{B: Number of faults}
\end{tabular}
\caption{Observations}\label{tab:observ}
\end{table}
\end{document}

enter image description here

Tags:

Tables