2

My table has 25 columns I think and how can I make each column smaller and make the table fit on one page ?

\documentclass[9pt]{article}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{tabularx}% http://ctan.org/pkg/tabularx

\begin{document}

% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{table}[htbp]
  \centering
  \caption{Add caption}
    \begin{tabular}{l|lllllllllllllllllllllllll p{10cm}}

    Shifts/Time & 8     & 9     & 10    & 11    & 12    & 13    & 14    & 15    & 16    & 17    & 18    & 19    & 20    & 21    & 22    & 23    & 24    & 1     & 2     & 3     & 4     & 5     & 6     & 7 \\
     \hline \hline

    A1    & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    A2    & 0     & 1     & 1     & 0     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    B1    & 0     & 0     & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    B2    & 0     & 0     & 0     & 1     & 1     & 0     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    C1    & 0     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    C2    & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 0     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    D1    & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    D2    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 0     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    E1    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    E2    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 0     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    F1    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0 \\
    F2    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 0     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0 \\
    G1    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1     & 0     & 0     & 0     & 0 \\
    G2    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 0     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0 \\
    H1    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1     & 0     & 0 \\
    H2    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 0     & 1     & 1     & 1     & 1     & 1     & 0 \\
    I1    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1 \\
    I2    & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 0     & 1     & 1     & 1     & 1 \\

    \end{tabular}%
  \label{tab:addlabel}%
\end{table}%


\end{document}
2

Just reduce the font size, and also the inter-column space The last column didn't seem to need 10cm so I made that l to match the others.

enter image description here

Note article does not have a 9pt option.

\documentclass{article}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{tabularx}% http://ctan.org/pkg/tabularx

\begin{document}

% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{table}[htbp]
  \centering
 \small
  \setlength\tabcolsep{3pt}
  \caption{Add caption}
    \begin{tabular}{l|llllllllllllllllllllllllll}
\begin{tabular}{@{}l@{}}Shifts/\\Time\end{tabular}
& 8     & 9     & 10    & 11    & 12    & 13    & 14    & 15    & 16    & 17    & 18    & 19    & 20    & 21    & 22    & 23    & 24    & 1     & 2     & 3     & 4     & 5     & 6     & 7 \\
     \hline \hline

    A1    & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    A2    & 0     & 1     & 1     & 0     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    B1    & 0     & 0     & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    B2    & 0     & 0     & 0     & 1     & 1     & 0     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    C1    & 0     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    C2    & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 0     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    D1    & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    D2    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 0     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    E1    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    E2    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 0     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0 \\
    F1    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0     & 0 \\
    F2    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 0     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0     & 0     & 0 \\
    G1    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1     & 0     & 0     & 0     & 0 \\
    G2    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 0     & 1     & 1     & 1     & 1     & 1     & 0     & 0     & 0 \\
    H1    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1     & 0     & 0 \\
    H2    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 0     & 1     & 1     & 1     & 1     & 1     & 0 \\
    I1    & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 1     & 1     & 0     & 1     & 1     & 1 \\
    I2    & 1     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 0     & 1     & 1     & 0     & 1     & 1     & 1     & 1 \\

    \end{tabular}%
  \label{tab:addlabel}%
\end{table}%

\end{document}
0

If you don't mind shifting one page of your document to landscape view, try the sidewaystable environment. You'll need to add the rotating package to your preamble.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.