These may be separate questions, but the following MWE:

\addcontentsline{lot}{subsection}{\ref{tab:UserRoles} \textbf{User Roles}}  
\includepdf[pages={-}, pagecommand={\label{tab:UserRoles}}, offset=0in -1in, addtolist={9, table, {The User Roles table}, tab:UserRoles}]{UserRolesTable}  

has several unexpected behaviors.

  1. I get the following warning:

    Package pdfpages Warning: There's something wrong with the entries of `addtolist'.
    Not all entries were processed. Check `addtolist' [in the MWE]."  
  2. Probably due to the \label not being bound to the inserted pdf (in a table environment), my inserted PDF is numbered using the section, and not the expected "Table X" value.

  3. The manually-inserted LoT line (which also uses the section number rather than the incremented table number) is not formatted like the other lines in the LoT - the number lines up, but the table caption itself is not aligned with the others in the list.

The source PDF has no errors and displays correctly in the output PDF.

PDFLaTeX -> BibTex


\textbf{Table \ref{tab:UserRoles} - The User Roles Table} \addcontentsline{lot}{subsection}{\ref{tab:UserRoles} 
\textbf{User Roles}} % manual entry in ToC 
\includepdf[pages={-}, pagecommand={\label{tab:UserRoles}}, offset=0in -1in, addtolist={9, table, {The User Roles table}, tab:UserRoles, lot}]{UserRolesTable}
  • How many pages does the included PDF have? – egreg May 16 '12 at 16:01
  • 5 pages in the included PDF. I tried specifying ('\includepdf{pages=1-5...' but that threw the same errors. – Yonah May 16 '12 at 16:45
  • Can you upload the pdf file? – Marco Daniel Jun 2 '12 at 22:07
  • Can't figure out how to attach to this page. The PDF is not hosted online (nor will it be), and I've had to strip out all identifying info. By way of update, the new PDF is only 2 pages, but that isn't an issue in the MWE - the "unspecified error" (#1 above) still shows. – Yonah Jun 4 '12 at 15:32

There are some errors in the MWE:

  • pagecommand={\label{tab:UserRoles}}: This is executed on each builded page. In case of more than one page the result are warnings because of multiply defined labels. Also the label setting is already done by your option setting for addtolist. (Edit: Fix of PolGab applied, thanks)
  • The argument list for addtolist expects four parameters, the page number, the type, the title and the label. However there is a fifth element lot in the MWE. The package pdfpages sets the list entry by calling \caption, where \@makecaption is a dummy. Thus the caption is not actually typeset, but the counter is incremented and the entry for the list is done.
  • With a working addtolist the manual \addcontentsline is not longer needed. Also it should be called at the right page to get the correct page number.

The corrected MWE:


\section*{Table \ref{tab:UserRoles} - The User Roles Table}
  offset=0in -1in,
  addtolist={3, table, {The User Roles table}, tab:UserRoles},

The result:


The first page contains the list of tables and the "table section title". The third page of the included pages gets the entry in the list of tables, that is the fourth page.

  • Thanks so much for your help! The reason I used \pagecommand is that it adds my custom header/footer around the inserted PDF (which also explains the offsets). Your MWE does not insert a line to the LoT (I also tried changing it to \subsection* to fit with my hierarchy, but no dice). I get a section titled "Table ?? - The User Roles Table" with nothing else on the page, then the PDF starts on the following page. Thanks, all, for your help so far. – Yonah Jul 30 '12 at 20:30
  • The entry in the LoT is present, see the result image. The entry is done by option addtolist alone and has nothing to do with the previous \section*. Ignore this line if you like; it's only there to show \ref. – Heiko Oberdiek Jul 30 '12 at 21:34
  • So now I have to wonder what else is causing TeX to ignore the label. I'm still not seeing (MWE below) an entry in the ToC and the table comes out a page too late (and dialing it back to p12 doesn't help). \includepdf[ pages={ - }, pagecommand={}, offset=0in -1in, addtolist={13, table, {The User Roles table}, tab:UserRoles}, ]{UserRolesTable} Is it possible that pdfpages conflicts with another package I use? – Yonah Jul 31 '12 at 13:34
  • First make sure that you are indeed including 13 or more pages, your addtolist specification fires on the 13th page. If it does not work, a complete MWE would make sense (it could be appended to the question). – Heiko Oberdiek Jul 31 '12 at 14:13
  • AHA!! So this was a misunderstanding on my part. I had been assuming that the first argument was the destination PDF page number (for building the reference). It's the page number of the inserted PDF - and since I wanted all of it, "1" is the correct answer. The PDF is only 4 pages long... @Heiko-Oberdiek, you're my hero. – Yonah Jul 31 '12 at 14:32

The addtolist option uses 4 (or any multiple of 4) arguments.

For example, if your external PDF file (UserRolesTable.pdf) contains three pages, you can say:


  offset=0in -1in,%
    1, table, {The User Roles table 1}, tab:UserRoles1,
    2, table, {The User Roles table 2}, tab:UserRoles2,
    3, table, {The User Roles table 3}, tab:UserRoles3

and you got the following list of tables:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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