[Tex/LaTex] Captions for tables included via pdfpages

captionslongtablepdfpages

I have a large number of multipage longtables as independent pdfs. I am including these pdfs in my main document using the pdfpages package. My code for including the PDFs currently looks like this:

\section{Analysis}

We first present the data for group A (Table~\ref{tab:groupadata}).
{
\includepdf[pages={-},nup=1x1,templatesize={5.45in}{8.5in}, pagecommand={}, addtolist={1,table,Caption for the LOT,tab:groupadata}
]{directory/firstgroupdata.pdf}
}

I can get the captions for these tables to go into the List of Tables with the addtolist= option but how do I get the inserted PDF tables to have auto-captions like regular tables? I thought of hardcoding the caption into the longtable in the pdfs, but if I shuffle the position of the tables, it is a pain to go into the tex files and change the caption once more for each of the tables.

Any solutions or workarounds for adding captions to these external tables would be great. Thanks for your time!

Best Answer

use the capt-of package (only one line of code:-) then you can go

\captionof{table}{a table caption}

before or after each included table pdf.

Related Question