# Make a csvsimple longtable appear on the list of tables

My question is somewhat related to my previous one (See Underfull \hbox warning about alignement in a csvsimple table

I need to add a caption to a csvsimple-generated longtable, but if I enclose my csv table inside a \table element, it will take just one page and be truncated at the end (even though it would appear on the list of tables).

My aim is to have this table appearing on my List of tables.

Is there any parameter of csvreader that allows it to affect a caption to a table generated with it, so that it would appear on the list of tables?

Something like that:

\begin{filecontents*}{\jobname.csv}
\end{filecontents*}

\documentclass{article}

\usepackage{csvsimple,array,longtable}

\begin{document}

\listoftables

\section{Test}

\noindent
longtable=
|*{5}{>{\raggedright\arraybackslash}p{\dimexpr 0.2\linewidth-2\tabcolsep-1.2\arrayrulewidth}|},

Alternatively, you can always create the longtable head and foot outside the \csvreader, if more control is needed.
• Perfect, adding late after last line=\\\hline\caption{My nice table} did it. – Hakim Mar 11 '16 at 15:39