I have been trying to add caption and label to a long table (not entirely written below) inside the xltabular
environment.
After checking Caption on tabular environment, labels with tabular and some other posts, I did this:
\usepackage{xltabular}
\usepackage{caption}
\captionsetup[table]{skip=-10pt}
\captionof{table}{My Table}
\begin{xltabular}{\textwidth}{@{}Y|Y|Y@{}}
0.0 & 0 & 0 \\
1.0 & 1000 & 0 \\
2.0 & 2000 & 0
\end{xltabular}
which kinda works. However, I keep getting yellow warning messages:
Package caption Warning: \captionsetup{type*=...} or \captionof outside box or environment on input line 161.
Package caption Warning: The option 'hypcap=true' will be ignored for this particular \caption on input line 161.
Also, \captionsetup[table]{skip=-10pt}
stops working if I use \captionof{table}{My Table}
and I need it because the space between the table and the caption is too large.
How can I solve these problems without using table
environment (it makes my table start in a new page)?
\caption
command should be inside thexltabular
environment. It is not a floating environmen, and it uses the same syntax aslongtable
..\caption{}
. It was just a matter or rearranging things after all, but I could only do it thanks to you... So, thanks, @Bernard! :)\endhead
? Since it will repeat also the caption on every page, once it is inside thexltabular
environment...begin{xltabular}
, interpreted as a row. I wish I could specify which rows should be repeated.