for my thesis I have several long tables, thus I'm using xltabular. I need to add captions below the tables, but this seems to be possible only if I put it in a table environment :
\begin{table}
\begin{small}
\begin{xltabular}{\linewidth}{|X|X|X|}
\hline
text & text & text \\
\hline
text & text & text \\
\hline
\end{xltabular}
\caption{example}
\end{small}
\end{table}
This provides the right table output (caption below not above table}, but now the float option doesn't seem to work anymore; the table apprears in the wrong place. I tried adding [!h], but nothing works, except removing the table environment which makes my caption disappear when placed below the table.
In other cases, I also have footnotes in the tables. Before, I used tabularx and it worked well (except that the numbering of the tables was wrong, that's why I'm using xltabular now), but with the xltabular environment, the footnotes appear on the wrong page.
Any idea what I can do to solve this issue?
Here is part of my code :
\documentclass[openany,ngerman]{book}
\usepackage[main=french,italian, spanish, portuguese, latin, greek]{babel}
\usepackage[small]{dgruyter}
\usepackage{microtype}
\baretabulars
\usepackage{fontspec}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{graphicx,lmodern}
\usepackage{enumitem}
\usepackage{slantsc}
\usepackage{float}
\usepackage{tablefootnote}
\usepackage{tabularx}
\usepackage{xltabular}
\usepackage{array}
\usepackage{caption}
\usepackage{makecell}
\usepackage{multirow}
\usepackage{ltablex}
\begin{document}
\begin{small}
\begin{xltabular}{\linewidth}{|X|X|X|}
\hline
text\footnotemark{} & text & text \\
\hline
\end{xltabular}
\end{small}
\caption{text}
\footnotetext{Cf. ci-dessus \ref{reconstructionmorphologiqueI} pour l'explication de la place de l'accent.}
\end{table}
\end{document}
I'd appreciate your help very much.
xltabularis intended to be used when you want the table to split across several pages. Such a table can not be placed inside of atableenvironment. – leandriis May 09 '20 at 09:44smallis not an environment. – leandriis May 09 '20 at 09:45tabularxbut due to theltablexpackage that you added to the preamble. If you want to usexltabular, remove `ltablex. (For an explanation see also: https://tex.stackexchange.com/a/375104/134144) – leandriis May 09 '20 at 09:51