我有一张长桌子
%!TEX TS-program = xelatex
%%%
\documentclass[14pt, a4paper]{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures={TeX},Renderer=Basic}
\setmainfont[Ligatures={TeX,Historic}]{Times New Roman}
\usepackage{indentfirst}
\frenchspacing
%%% Tables.
\usepackage{array,tabularx,tabulary,booktabs}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{tabu}
%
% Caption of Table
\usepackage{caption}
\usepackage[
singlelinecheck=false
]{caption}
\captionsetup{labelsep = space}
\usepackage[format=hang]{caption}
%
%%% Page
\usepackage{extsizes}
\usepackage{geometry}
\geometry{top=20mm}
\geometry{bottom=20mm}
\geometry{left=20mm}
\geometry{right=15mm}
%
\begin{document}
\begin{longtable}[l]{|c|c|c|c|c|c|c|c|}
\caption{--- Caption of long table}
\label{tableLabel} \\
\hline
\multirow{2}{*}{Date} & \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}Values \\ of \\ balances\end{tabular}} & \multicolumn{2}{c|}{\begin{tabular}[c]{@{}c@{}}Absolute \\ increases \end{tabular}} & \multicolumn{2}{c|}{Coefficients}&\multicolumn{2}{c|}{\begin{tabular}[c]{@{}c@{}}Rates of growth, \\ \%\end{tabular}} \\ \cline{3-8}
&&chain& \begin{tabular}[c]{@{}c@{}}base\end{tabular}&chain& \begin{tabular}[c]{@{}c@{}}base\end{tabular}&chain&\begin{tabular}[c]{@{}c@{}}base\end{tabular}\\ \hline
1&2&3&4&5&6&7&8\\ \hline
\endfirsthead
%
\multicolumn{8}{r}{Table continuation (Error Here) \ref{tableLabel}}
\hline
\multirow{2}{*}{Date} & \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}Values \\ of \\ balances\end{tabular}} & \multicolumn{2}{c|}{\begin{tabular}[c]{@{}c@{}}Absolute \\ increases, \\ млрд.руб.\end{tabular}} & \multicolumn{2}{c|}{Coefficients}&\multicolumn{2}{c|}{\begin{tabular}[c]{@{}c@{}}Rates of growth, \\ \%\end{tabular}} \\ \cline{3-8}
&&chain& \begin{tabular}[c]{@{}c@{}}base\end{tabular}&chain& \begin{tabular}[c]{@{}c@{}}base\end{tabular}&chain&\begin{tabular}[c]{@{}c@{}}base\end{tabular}\\ \hline
1&2&3&4&5&6&7&8\\ \hline
\endhead
%\hline
\multicolumn{8}{r}{Table continuation \ref{tableLabel} on the next page\ldots}
\endfoot
\hline
\endlastfoot
%
30.09.2014&1438&---&---&---&1&---&--- \\ \hline
01.10.2014&1358,6&-79,4&-79,4&0,945&0,94&-5,5&-5,5 \\ \hline
02.10.2014&796,3&-562,3&-641,7&0,586&0,55&-41,4&-44,6 \\ \hline
03.10.2014&685,5&-110,8&-752,5&0,861&0,48&-13,9&-52,3 \\ \hline
06.10.2014&574,8&-110,7&-863,2&0,839&0,4&-16,1&-60 \\ \hline
07.10.2014&620,7&45,9&-817,3&1,08&0,43&8&-56,8 \\ \hline
08.10.2014&696,9&76,2&-741,1&1,123&0,48&12,3&-51,5 \\ \hline
09.10.2014&647,1&-49,8&-790,9&0,929&0,45&-7,1&-55 \\ \hline
10.10.2014&734,6&87,5&-703,4&1,135&0,51&13,5&-48,9 \\ \hline
13.10.2014&764,8&30,2&-673,2&1,041&0,53&4,1&-46,8 \\ \hline
01.10.2014&1358,6&-79,4&-79,4&0,945&0,94&-5,5&-5,5 \\ \hline
02.10.2014&796,3&-562,3&-641,7&0,586&0,55&-41,4&-44,6 \\ \hline
03.10.2014&685,5&-110,8&-752,5&0,861&0,48&-13,9&-52,3 \\ \hline
06.10.2014&574,8&-110,7&-863,2&0,839&0,4&-16,1&-60 \\ \hline
07.10.2014&620,7&45,9&-817,3&1,08&0,43&8&-56,8 \\ \hline
08.10.2014&696,9&76,2&-741,1&1,123&0,48&12,3&-51,5 \\ \hline
09.10.2014&647,1&-49,8&-790,9&0,929&0,45&-7,1&-55 \\ \hline
10.10.2014&734,6&87,5&-703,4&1,135&0,51&13,5&-48,9 \\ \hline
13.10.2014&764,8&30,2&-673,2&1,041&0,53&4,1&-46,8 \\ \hline
01.10.2014&1358,6&-79,4&-79,4&0,945&0,94&-5,5&-5,5 \\ \hline
02.10.2014&796,3&-562,3&-641,7&0,586&0,55&-41,4&-44,6 \\ \hline
03.10.2014&685,5&-110,8&-752,5&0,861&0,48&-13,9&-52,3 \\ \hline
06.10.2014&574,8&-110,7&-863,2&0,839&0,4&-16,1&-60 \\ \hline
07.10.2014&620,7&45,9&-817,3&1,08&0,43&8&-56,8 \\ \hline
08.10.2014&696,9&76,2&-741,1&1,123&0,48&12,3&-51,5 \\ \hline
09.10.2014&647,1&-49,8&-790,9&0,929&0,45&-7,1&-55 \\ \hline
10.10.2014&734,6&87,5&-703,4&1,135&0,51&13,5&-48,9 \\ \hline
13.10.2014&764,8&30,2&-673,2&1,041&0,53&4,1&-46,8 \\ \hline
01.10.2014&1358,6&-79,4&-79,4&0,945&0,94&-5,5&-5,5 \\ \hline
02.10.2014&796,3&-562,3&-641,7&0,586&0,55&-41,4&-44,6 \\ \hline
03.10.2014&685,5&-110,8&-752,5&0,861&0,48&-13,9&-52,3 \\ \hline
06.10.2014&574,8&-110,7&-863,2&0,839&0,4&-16,1&-60 \\ \hline
07.10.2014&620,7&45,9&-817,3&1,08&0,43&8&-56,8 \\ \hline
08.10.2014&696,9&76,2&-741,1&1,123&0,48&12,3&-51,5 \\ \hline
09.10.2014&647,1&-49,8&-790,9&0,929&0,45&-7,1&-55 \\ \hline
10.10.2014&734,6&87,5&-703,4&1,135&0,51&13,5&-48,9 \\ \hline
13.10.2014&764,8&30,2&-673,2&1,041&0,53&4,1&-46,8 \\ \hline
01.10.2014&1358,6&-79,4&-79,4&0,945&0,94&-5,5&-5,5 \\ \hline
02.10.2014&796,3&-562,3&-641,7&0,586&0,55&-41,4&-44,6 \\ \hline
03.10.2014&685,5&-110,8&-752,5&0,861&0,48&-13,9&-52,3 \\ \hline
06.10.2014&574,8&-110,7&-863,2&0,839&0,4&-16,1&-60 \\ \hline
07.10.2014&620,7&45,9&-817,3&1,08&0,43&8&-56,8 \\ \hline
08.10.2014&696,9&76,2&-741,1&1,123&0,48&12,3&-51,5 \\ \hline
09.10.2014&647,1&-49,8&-790,9&0,929&0,45&-7,1&-55 \\ \hline
10.10.2014&734,6&87,5&-703,4&1,135&0,51&13,5&-48,9 \\ \hline
13.10.2014&764,8&30,2&-673,2&1,041&0,53&4,1&-46,8 \\ \hline
14.10.2014&1003,6&238,8&-434,4&1,312&0,7&31,2&-30,2
\end{longtable}
\end{document}
正如您在图片上看到的,转移到新页面的表格部分带有标题“表格延续(此处有错误)1”。我使用以下代码制作了此标题:
\multicolumn{8}{r}{Table continuation (Error Here) \ref{tableLabel}}
并且此代码已执行并发出了正确的 PDF 文件。但是在执行代码时,我收到错误:
Misplaced \noalign. ^^I\hline
Misplaced \omit. ^^I\multirow
Extra alignment tab has been changed to \cr. ^^I\multirow
出现这个错误的问题该如何解决呢?
PS如果我删除此行:
\multicolumn{8}{r}{Table continuation (Error Here) \ref{tableLabel}}
不会发生错误。但必要的标题将会消失。
答案1
您的基本问题已通过我的上述评论得到解决:
\\
表中之前的每一行都必须以或结尾\tabularnewline
- 表格水平线(除了最开始表格上的线)必须位于行终止之后
一些题外话:
我会重新设计你的表格,如下图所示:
即使用在序言(booktabs
)中加载的包并添加另外两个:makcell
用于简化表格代码和siunitx
用于制作S
列类型的包,它们可以使数字在小数点对齐:
\documentclass[14pt, a4paper]{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures={TeX},Renderer=Basic}
\setmainfont[Ligatures={TeX,Historic}]{Times New Roman}
\usepackage{indentfirst}
\frenchspacing
%%% Tables.
\usepackage{array, booktabs, longtable}
\usepackage{makecell, multirow}
%
\usepackage{siunitx}
% Caption of Table
\usepackage[format=hang,
labelsep = space,
skip=1ex,
singlelinecheck=false]{caption}
%%% Page
\usepackage{extsizes}
\usepackage{geometry}
\geometry{top=20mm, bottom=20mm, left=20mm, right=15mm}
%-------------------------------- show page layout, only for test
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begingroup
\sisetup{table-column-width=7.5ex}
\begin{longtable}[l]{c S[table-format= 4.1]
S[table-format=-3.1]
S[table-format=-3.1]
S[table-format= 1.4]
S[table-format= 1.2]
S[table-format=-2.1]
S[table-format=-2.1]
}
\caption{--- Caption of long table}
\label{tableLabel} \\
\toprule
\multirow{3}{*}{Date}
& {\multirow{3}{*}{\makecell{Values of \\ balances}}}
& \multicolumn{2}{c}{\makecell{Absolute \\ increases}}
& \multicolumn{2}{c}{Coefficients}
& \multicolumn{2}{c}{\makecell{Rates of\\ growth \%}} \\
\cmidrule(lr){3-8}
& & {chain}
& {base}
& {chain}
& {base}
& {chain}
& {base} \\
\midrule
{1} & {2} & {3} & {4} & {5} & {6} & {7} & {8} \\
\midrule
\endfirsthead
%
\multicolumn{8}{r}{Table continuation \ref{tableLabel}} \\
\midrule
\multirow{3}{*}{Date}
& {\multirow{3}{*}{\makecell{Values of \\ balances}}}
& \multicolumn{2}{c}{\makecell{Absolute \\ increases}}
& \multicolumn{2}{c}{Coefficients}
& \multicolumn{2}{c}{\makecell{Rates of\\ growth \%}} \\
\cmidrule(lr){3-8}
& & {chain}
& {base}
& {chain}
& {base}
& {chain}
& {base} \\
\midrule
{1} & {2} & {3} & {4} & {5} & {6} & {7} & {8} \\
\midrule
\endhead
\midrule
\multicolumn{8}{r}{Table continuation \ref{tableLabel} on the next page\ldots}
\endfoot
\bottomrule
\endlastfoot
%
30.09.2014 & 1438 & {--} & {--} & {--} & 1 & {--} & {--} \\
01.10.2014 & 1358,6&-79,4&-79,4&0,945&0,94&-5,5&-5,5 \\
02.10.2014&796,3&-562,3&-641,7&0,586&0,55&-41,4&-44,6 \\
03.10.2014&685,5&-110,8&-752,5&0,861&0,48&-13,9&-52,3 \\
06.10.2014&574,8&-110,7&-863,2&0,839&0,4&-16,1&-60 \\
\addlinespace
07.10.2014&620,7&45,9&-817,3&1,08&0,43&8&-56,8 \\
08.10.2014&696,9&76,2&-741,1&1,123&0,48&12,3&-51,5 \\
09.10.2014&647,1&-49,8&-790,9&0,929&0,45&-7,1&-55 \\
10.10.2014&734,6&87,5&-703,4&1,135&0,51&13,5&-48,9 \\
13.10.2014&764,8&30,2&-673,2&1,041&0,53&4,1&-46,8 \\
\addlinespace
01.10.2014&1358,6&-79,4&-79,4&0,945&0,94&-5,5&-5,5 \\
02.10.2014&796,3&-562,3&-641,7&0,586&0,55&-41,4&-44,6 \\
03.10.2014&685,5&-110,8&-752,5&0,861&0,48&-13,9&-52,3 \\
06.10.2014&574,8&-110,7&-863,2&0,839&0,4&-16,1&-60 \\
07.10.2014&620,7&45,9&-817,3&1,08&0,43&8&-56,8 \\
\addlinespace
08.10.2014&696,9&76,2&-741,1&1,123&0,48&12,3&-51,5 \\
09.10.2014&647,1&-49,8&-790,9&0,929&0,45&-7,1&-55 \\
10.10.2014&734,6&87,5&-703,4&1,135&0,51&13,5&-48,9 \\
13.10.2014&764,8&30,2&-673,2&1,041&0,53&4,1&-46,8 \\
01.10.2014&1358,6&-79,4&-79,4&0,945&0,94&-5,5&-5,5 \\
\addlinespace
02.10.2014&796,3&-562,3&-641,7&0,586&0,55&-41,4&-44,6 \\
03.10.2014&685,5&-110,8&-752,5&0,861&0,48&-13,9&-52,3 \\
06.10.2014&574,8&-110,7&-863,2&0,839&0,4&-16,1&-60 \\
07.10.2014&620,7&45,9&-817,3&1,08&0,43&8&-56,8 \\
08.10.2014&696,9&76,2&-741,1&1,123&0,48&12,3&-51,5 \\
\addlinespace
09.10.2014&647,1&-49,8&-790,9&0,929&0,45&-7,1&-55 \\
10.10.2014&734,6&87,5&-703,4&1,135&0,51&13,5&-48,9 \\
13.10.2014&764,8&30,2&-673,2&1,041&0,53&4,1&-46,8 \\
01.10.2014&1358,6&-79,4&-79,4&0,945&0,94&-5,5&-5,5 \\
02.10.2014&796,3&-562,3&-641,7&0,586&0,55&-41,4&-44,6 \\
\addlinespace
03.10.2014&685,5&-110,8&-752,5&0,861&0,48&-13,9&-52,3 \\
06.10.2014&574,8&-110,7&-863,2&0,839&0,4&-16,1&-60 \\
07.10.2014&620,7&45,9&-817,3&1,08&0,43&8&-56,8 \\
08.10.2014&696,9&76,2&-741,1&1,123&0,48&12,3&-51,5 \\
09.10.2014&647,1&-49,8&-790,9&0,929&0,45&-7,1&-55 \\
\addlinespace
10.10.2014&734,6&87,5&-703,4&1,135&0,51&13,5&-48,9 \\
13.10.2014&764,8&30,2&-673,2&1,041&0,53&4,1&-46,8 \\
01.10.2014&1358,6&-79,4&-79,4&0,945&0,94&-5,5&-5,5 \\
02.10.2014&796,3&-562,3&-641,7&0,586&0,55&-41,4&-44,6 \\
03.10.2014&685,5&-110,8&-752,5&0,861&0,48&-13,9&-52,3 \\
\addlinespace
06.10.2014&574,8&-110,7&-863,2&0,839&0,4&-16,1&-60 \\
07.10.2014&620,7&45,9&-817,3&1,08&0,43&8&-56,8 \\
08.10.2014&696,9&76,2&-741,1&1,123&0,48&12,3&-51,5 \\
09.10.2014&647,1&-49,8&-790,9&0,929&0,45&-7,1&-55 \\
10.10.2014&734,6&87,5&-703,4&1,135&0,51&13,5&-48,9 \\
\addlinespace
13.10.2014&764,8&30,2&-673,2&1,041&0,53&4,1&-46,8 \\
14.10.2014&1003,6&238,8&-434,4&1,312&0,7&31,2&-30,2
\end{longtable}
\endgroup
\end{document}