TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question
up vote 5 down vote accepted

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.

share|improve this answer
    
Thank you for this solution! It works very well for portrait-oriented pages! So now my code looks like { \captionof{table}{Caption of table} \label{tab:tablelabel} \includepdf[pages={-},nup=1x1,templatesize={5.45in}{8.5in},pagecommand={}]{direc‌​tory/firsttable.pdf} } By including this: pagecommand={\begin{center} Table~\ref{tab:tablelabel} \end{center} I can get it to print this caption on top of the table. But what do I do for landscape oriented tables? It still puts the caption in portrait format. – Ariel Apr 6 '12 at 11:55
1  
you can probably use lscape package to rotate the pages including the inclusion and the caption – David Carlisle Apr 6 '12 at 21:56
1  
@DavidCarlisle I do not get that working. In the documentation of the caption package it is written that captionof should only be used inside of environments. But which one should I use? `\begin{figure} messes up everything – louis cypher Apr 28 '12 at 16:02
1  
Is it possible to get the caption on the same page where the last page of included pdfs end ? or on each of the pages ? Using captionof gives the figure caption but at the start of the next page after included pages. Tries adjusted the size but that approach doesnt work. Any solutions ? – Anusha Sep 28 '14 at 8:15
1  
I am using this for graphs. I found some clues using answers in this question tex.stackexchange.com/questions/170113/… but it is not giving the captions at the end of the page. Any additions to that approach ? Thanks. – Anusha Sep 28 '14 at 9:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.