标题和longtabu

标题和longtabu

我在 longtabu 环境中遇到了包括标题在内的麻烦。代码如下所示,它引发了大量错误。

\documentclass{article}

\usepackage{longtable}
\usepackage{tabu}

\begin{document}


\newpage 
\begin{longtabu} to 1\textwidth {l X[c] X[c] X[c] X[c] X[c] X[c] X[c]}
    \caption{Hello}
    \hline\hline
    $\Delta RealEstate_{region}$ = 1 &  0.004 & 0.003 & 0.010 & -0.003 &    0.010 \\
    $\Delta RealEstate_{region}$ = 2    &0.002& 0.003&  0.013&  -0.002& 0.008 \\
    $\Delta RealEstate_{region}$ = 3    &0.003& 0.003&  0.012&  -0.001& 0.009 \\
    $\Delta RealEstate_{region}$ = 4&   0.002&  0.003&  0.009&  -0.002& 0.007\\
    $\Delta RealEstate_{region}$ = 5&   0.005&  0.005&  0.011&  -0.002& 0.012\\
    $\Delta RealEstate_{region}$ = 6&   0.005&  0.005&  0.013&  -0.002& 0.012\\
    $\Delta RealEstate_{region}$ = 7&   0.004&  0.004&  0.008&  0.000&  0.009\\
    $\Delta RealEstate_{region}$ = 8&   0.003&  0.004&  0.011&  -0.001& 0.009\\
    $\Delta RealEstate_{region}$ = 9&   0.004&  0.003&  0.010&  -0.003& 0.011\\
    $\Delta RealEstate_{region}$ = 10&  0.002&  0.003&  0.006&  -0.001& 0.006\\
    $\Delta RealEstate_{region}$ = 11&  0.004&  0.004&  0.009&  0.000&  0.009\\
    $\Delta RealEstate_{region}$ = 12&  0.004&  0.004&  0.010&  -0.001& 0.009\\
    $\Delta RealEstate_{region}$ = 13&  0.003&  0.004&  0.013&  0.000&  0.007\\
    $\Delta RealEstate_{region}$ = 14&  0.004&  0.005&  0.011&  -0.002& 0.011\\
    $\Delta RealEstate_{region}$ = 15&  0.002&  0.002&  0.009&  -0.002& 0.007\\
    $\Delta RealEstate_{region}$ = 16&  0.004&  0.004&  0.010&  0.000&  0.010\\
    $\Delta RealEstate_{region}$ = 17&  0.002&  0.002&  0.010&  -0.002& 0.007\\
    $\Delta RealEstate_{region}$ = 18&  0.002&  0.003&  0.011&  0.000&  0.006\\
    $\Delta RealEstate_{region}$ = 19&  0.002&  0.003&  0.014&  -0.002& 0.008\\
    $\Delta RealEstate_{region}$ = 20&  0.004&  0.004&  0.012&  -0.002& 0.011\\
    $\Delta RealEstate_{region}$ = 21&  0.003&  0.006&  0.011&  -0.002& 0.010\\
    $\Delta RealEstate_{region}$ = 22&  0.003&  0.004&  0.009&  -0.002& 0.010\\
    $\Delta Prof$&  0.000&  0.001&  0.020&  -0.006& 0.008\\
    RETURN& 0.020&  0.022&  0.071&  -0.019& 0.065\\
    GDP&    0.024&  0.025&  0.032&  0.013&  0.042\\
    TBILL&  0.057&  0.056&  0.036&  0.033&  0.079\\
    INFLATION&  0.043&  0.035&  0.035&  0.024&  0.057\\
    CORP&   0.101&  0.067&  0.243&  -0.068& 0.222\\
    TERM&   -0.012& -0.013& 0.012&  -0.020& -0.003\\
    $\Delta Prof_{region}$ =1&  0.002&  0.003&  0.028&  -0.008& 0.014\\
    $\Delta Prof_{region}$ =2&  -0.001& 0.000&  0.030&  -0.013& 0.014\\
    $\Delta Prof_{region}$ =3&  0.001&  0.002&  0.042&  -0.009& 0.014\\
    $\Delta Prof_{region}$ =4&  0.000&  0.001&  0.021&  -0.008& 0.011\\
    $\Delta Prof_{region}$ =5&  0.011&  0.007&  0.066&  -0.014& 0.043\\
    $\Delta Prof_{region}$ =6&  0.009&  0.006&  0.035&  -0.009& 0.027\\
    $\Delta Prof_{region}$ =7&  -0.001& 0.001&  0.066&  -0.028& 0.026\\
    $\Delta Prof_{region}$ =8&  0.002&  0.000&  0.027&  -0.008& 0.007\\
    $\Delta Prof_{region}$ =9&  -0.001& 0.001&  0.035&  -0.011& 0.013\\
    $\Delta Prof_{region}$ =10& -0.002& 0.000&  0.043&  -0.010& 0.015\\
    $\Delta Prof_{region}$ =11& -0.002& 0.000&  0.030&  -0.017& 0.015\\
    $\Delta Prof_{region}$ =12& 0.006&  0.007&  0.052&  -0.022& 0.029\\
    $\Delta Prof_{region}$ =13& 0.004&  0.000&  0.291&  -0.020& 0.020\\
    $\Delta Prof_{region}$ =14& 0.002&  0.004&  0.021&  -0.010& 0.015\\
    $\Delta Prof_{region}$ =15& -0.003& 0.001&  0.039&  -0.014& 0.012\\
    $\Delta Prof_{region}$ =16& 0.000&  0.000&  0.026&  -0.013& 0.016\\
    $\Delta Prof_{region}$ =17& -0.003& 0.001&  0.040&  -0.008& 0.012\\
    $\Delta Prof_{region}$ =18& -0.007& -0.002& 0.046&  -0.010& 0.006\\
    $\Delta Prof_{region}$ =19& 0.010&  0.008&  0.083&  -0.015& 0.028\\
    $\Delta Prof_{region}$ =20& 0.000&  0.002&  0.029&  -0.009& 0.012\\
    $\Delta Prof_{region}$ =21& 0.002&  0.003&  0.028&  -0.008& 0.014\\
    $\Delta Prof_{region}$ =22& 0.002&  0.003&  0.021&  -0.007& 0.011
\end{longtabu}
\end{document}

答案1

可以\caption{}在内使用tabu,只需\\在行末尾添加,例如:

\documentclass{article}

\usepackage{longtable}
\usepackage{tabu}

\begin{document}

\begin{longtabu}{l}
    \caption{This is a caption} \\
    This is some table data \\
\end{longtabu}

\end{document}

任何荣誉都归功于@cfr,他已经在评论部分,但不幸的是没有提供答案(根据 SE 问答范式),因此懒人(比如我)可能会错过解决方案。

相关内容