longtable 包不跨越多个页面的表格

longtable 包不跨越多个页面的表格

我有一张跨越多页的表格。但是,我无法让该表格跨越多页。这是我的 MWE。

\documentclass[a4paper,10pt]{book}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{pstricks}
\usepackage{epstopdf}

\usepackage{pdflscape}    % to change certain pages to landscape mode
\usepackage{array}
\newcolumntype{P}[1]{>{\raggedright\arraybackslash\hspace{0pt}\mybreaks}p{#1}}

% Macro for my work
\begingroup
\catcode`=\active
\catcode`-\active
\catcode`)\active
\gdef\mybreaks{%
\catcode`=\active\edef={\string=\penalty0 }%
\catcode`)\active\edef){\string)\penalty0 }%
\catcode`-\active\edef-{\string-\penalty0 }}
\endgroup


\usepackage{verbatim}       % to commenet multiline


\usepackage{cite} %for compressing referenceing

\usepackage[para]{footmisc}

\usepackage{longtable}

\usepackage{booktabs,chemnum}
\usepackage[version=3]{mhchem}

\usepackage{imakeidx}
\makeindex

\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{xparse}% http://ctan.org/pkg/xparse

% another macro for my work
\newcounter{compoundcntr} \newcounter{subcompoundcntr}[compoundcntr]
\renewcommand{\thesubcompoundcntr}{\thecompoundcntr\alph{subcompoundcntr}}
 \NewDocumentCommand{\compound}{s o m}{%
  \IfBooleanTF{#1}
   {% \compound*[<label>]{<name>}
     \IfNoValueTF{#2}
      {#3}% \compound{<name>}
      {\stepcounter{compoundcntr}\refstepcounter{subcompoundcntr}#3,         \thesubcompoundcntr\label{#2}}% \compound[<label>]{<name>}
    }
{% \compound[<label>]{<name>}
  \IfNoValueTF{#2}
    {#3}% \compound*{<name>}
    {\refstepcounter{subcompoundcntr}#3, \thesubcompoundcntr\label{#2}}% \compound*      [<label>]{<name>}
    }
}


 \begin{document}

\begin{tabular}{|p{1cm}|p{1cm}|}
 \hline 
 Names & Score \tabularnewline \hline 
 A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
A & 1 \tabularnewline \hline 
\end{tabular}

\end{document}

问题是如何让表格横跨多页。重新排序包可能是一个选项。

答案1

此示例未使用永不跨页中断的longtable环境。将 更改为。tabulartabularlongtable

相关内容