1

I have a table which spans into multiple pages. but, I could not get the table spanning into multiple pages. here is my 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}

The question is how to make the table to span thro multiple pages. May be the reordering of the packages may be an option.

6

The example is not using a longtable environment it is using tabular which never breaks across pages. Change the tabular to longtable.

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.