桌子不适合 TexMaker

桌子不适合 TexMaker

我认为我的表格有 25 列,如何使每列变小并使表格适合一页?

\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}

答案1

只需减小字体大小,以及列间距,最后一列似乎不需要 10 厘米,所以我将其设置为与l其他列相匹配。

enter image description here

注意article没有9pt选项。

\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}

答案2

如果您不介意将文档的一页移至横向视图,请尝试该sidewaystable环境。您需要将rotating包添加到您的序言中。

相关内容