0

I need to make a table that spans several pages, likely in landscape format. The code that I have pasted below works well, but I need it to be longtable instead of table so that I can continue adding rows of information without going beyond the page dimensions. When I replace table with longtable, I get an error message:

Package array Error: Illegal pream-token (\caption): `c' used.

I should also add that I have the following in my preamble so that tables are APA formatted, and so that I can have automatically-numbered row.

\DeclareCaptionLabelSeparator*{spaced}{\\[1ex]}
\captionsetup[table]{textfont=it,format=plain,justification=justified,
  singlelinecheck=false,labelsep=spaced,skip=0pt, belowskip=-10pt}

 \preto\tabular{\setcounter{magicrownumbers}{0}}
\newcounter{magicrownumbers}
\newcommand\rownumber{\stepcounter{magicrownumbers}\arabic{magicrownumbers}.}

Below is my table. Any thoughts here? Thanks in advance!

\begin{landscape}

\begin{table}[h]
\caption{Table Caption Goes Here}
\label{table_lable}
\begin{tabular}{p{1cm} p{10.75cm} p{3.25cm} p{3.75cm}}
\toprule
No. & Header1 & Header2 & Header3 \\
\midrule 
{\makebox[0.5cm][l]{1-\rownumber}} & (a) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text text text  & text text text text text text  \\

& (b) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text & text text text text text text  & text text text text text text  \\

& (c) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text & text text text text & text text text text  \\

{\makebox[0.5cm][l]{1-\rownumber}} & (a) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text & text text text text  \\

& (b) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text & text text text text  \\

{\makebox[0.5cm][l]{1-\rownumber}} & text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text & text text text text  \\
\bottomrule
\end{tabular}
%\bigskip
%\small\textit{Note}. 
\end{table}

\end{landscape}
1
  • 1
    Regarding "When I replace table with longtable": Replace tabular with longtable, remove the table environment and place \caption and \label` inside of the longtable environment. Don't forget to add a \\ after the label. – leandriis Sep 25 '20 at 18:10
0

enter image description here

\documentclass{article}
\usepackage{longtable}
\usepackage{pdflscape}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{etoolbox}
\DeclareCaptionLabelSeparator*{spaced}{\\[1ex]}
\captionsetup[table]{textfont=it,format=plain,justification=justified,
  singlelinecheck=false,labelsep=spaced,skip=0pt, belowskip=-10pt}

 \preto\tabular{\setcounter{magicrownumbers}{0}}
\newcounter{magicrownumbers}
\newcommand\rownumber{\stepcounter{magicrownumbers}\arabic{magicrownumbers}.}
\begin{document}

\begin{landscape}

\begin{longtable}{p{1cm} p{10.75cm} p{3.25cm} p{3.75cm}}
\caption{Table Caption Goes Here}
\label{table_lable}\\
\toprule
No. & Header1 & Header2 & Header3 \\
\midrule 
\endfirsthead
\caption{Table Caption Goes Here - continued from previous page}
\label{table_lable}\\
\toprule
No. & Header1 & Header2 & Header3 \\
\midrule 
\endhead
\bottomrule
\endfoot
{\makebox[0.5cm][l]{1-\rownumber}} & (a) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text text text  & text text text text text text  \\

& (b) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text & text text text text text text  & text text text text text text  \\

& (c) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text & text text text text & text text text text  \\

{\makebox[0.5cm][l]{1-\rownumber}} & (a) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text & text text text text  \\

& (b) text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text & text text text text  \\

{\makebox[0.5cm][l]{1-\rownumber}} & text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text & text text text text  \\

{\makebox[0.5cm][l]{1-\rownumber}} & text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text & text text text text  \\

{\makebox[0.5cm][l]{1-\rownumber}} & text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text & text text text text  \\

{\makebox[0.5cm][l]{1-\rownumber}} & text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text  & text text text text & text text text text  \\
\end{longtable}


\end{landscape}
\end{document}
1
  • Thanks a bunch! :) – Guest1729 Sep 25 '20 at 18:26

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.