长桌与风景

长桌与风景

我需要制作一个横跨多页的表格,可能采用横向格式。我粘贴在下面的代码中效果很好,但我需要将其替换为,longtable以便table我可以继续添加信息行而不超出页面尺寸。当我用替换时tablelongtable我收到一条错误消息:

包数组错误:使用了非法的前导标记(\caption):‘c’。

我还应该补充一点,我在序言中加入了以下内容,以便表格符合 APA 格式,并且我可以自动编号行。

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

在此处输入图片描述

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

相关内容