0

I am facing trouble including caption with a longtabu environment. The code is given below, which throws tons of errors.

\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}
  • 3
    Try \\ after \caption{}. Just a guess. I wouldn't touch tabu with a barge pole, personally. – cfr Jun 17 '16 at 23:03
  • 1
    @cfr why would you not touch tabu? Is tabularx a better environment compared to tabu? Why? – Sumit Jun 18 '16 at 2:41
  • 2
    Because the author has promised an update which will break existing documents and, in the meantime, doesn't think it worth fixing bugs. At least, so it has been reported here. There was discussion around of it, but I don't know if it was in comments or regular posts, so it might have been deleted or difficult to find. – cfr Jun 18 '16 at 2:50
  • 1
    See the discussion here and considerably more critical here. – cfr Jun 18 '16 at 2:59
  • 1
    Definitely read this. – cfr Jun 18 '16 at 3:11
0

It is possible to use \caption{} within tabu, simply add \\ at the end of the line, e.g.:

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

Any credits go to @cfr who already explained the solution within the comment section, but unfortunately did not provide an answer (according to the SE question-answer paradigm) and hence, lazy people (like me) might miss the solution.

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.