# Can I use a \caption in a tabu environment?

Is it possible to use \caption between a tabu environment?

I have tried using these packages:

\usepackage{tabularx}
\usepackage{longtable}
\usepackage{tabu}


And when I write this in my code:

\begin{tabu} spread 2in{|X[2]|X[2]|X|X|X[2]|X[2]|}
%\caption{Marito}
\hline
1 & 2 & 3 & 4 & 5 & 6 \\
\hline
\end{tabu}


I get a lot of errors if I uncomment \caption{Marito}.

Note: The Tabu documentation doesn't say anything about it

• No, it isn't, just like with tabular. The \caption doesn't belong in tabu or tabular. – egreg Mar 31 '13 at 20:17
• If the table isn't breaking over the page surround the tabular (or tabu) with \begin{table}..\end{table} and put the caption in the table environment – David Carlisle Mar 31 '13 at 20:18

As per @egreg and @David Carlisle, \caption cannot be used in a tabular environment. However, it is possible to used if wrapped around a \begin{table}... \end{table} environment as long as the table doesn't go in a pagebreak.

If so, longtabu can be used, and it has no problem with \caption.

• For captions without floats use package caption or capt-of instead, but outside of the tabular environment. – Speravir Apr 1 '13 at 0:09

tricky, though tabu, longtabu and longtable documentations definitely allow the \caption, but do not describe how to use them properly.

as mentioned by @cfr in another thread: put \\ behind the \caption[]{} -- worked for me!

(to be more precise: no errors, but the caption is formatted completely differnt than all others in the document. Maybe the caption package will solve that)

• Thats true it works fine. – J Leon V. Apr 9 '18 at 17:11
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9741067290306091, "perplexity": 3718.0145121572555}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-05/segments/1579250607407.48/warc/CC-MAIN-20200122191620-20200122220620-00355.warc.gz"}