1

When I include PDFs in the annex, the label gets not set correctly. In the list of tables the link appears correctly, but clicking it brings me to the first page of the document.

The link in the text via \ref does also not work, as the label does not seem to be recognized, although as far as I understand the packages' documentation, it should work this way (see code):

\documentclass[12pt,a4paper,twoside]{report}

\usepackage{float}
\usepackage{pdfpages}
\usepackage[plainpages=true,pdfpagelabels]{hyperref}

\begin{document}

\chapter{Introduction}

A page with reference to table \ref{tab_sup:test_table}.

\newpage
\phantomsection

\addcontentsline{toc}{chapter}{List of Tables}
\listoftables
\endgroup

\newpage
\phantomsection

\addcontentsline{toc}{chapter}{Annex I}

\includepdf[pages={-}, addtolist={1, table, {Test table}, tab_sup:test_table}]{test.pdf}

\end{document} 

I saw a posting with a very similar problem here: pdfpages + hyperref : hyperlinks in list of tables pointing wrongly to first page of document

And indeed, removing the float package seems to solve the problem. However, I need float. Is there any other solution or workaround?

  • Is each pdf just one page? Why would/could you not use them directly as \includegraphics[page=1,width=.45\textwidth]{somemultipagepdf} with the usual table wrappers and labels? – Aubrey Blumsohn May 11 '15 at 11:50
  • No, in my real document each PDF contains tens of pages. And I have to include altogether around 20 such PDFs. So including them as figures is not really an option, unfortunetaly, as the inclusion of figures in the annex works without any problems. – ecsi May 11 '15 at 14:21
1

This seems to be working

\usepackage{pdfpages}
\makeatletter
\renewcommand{\AM@addtolist@hook}{\phantomsection}
\makeatother

both before and after loading hyperref

I just looked into the code for addtolist in pdfpages

  • It seems to work with the link in the text, but the entry in the list of tables still points to page one of the document, in my case. Additionally, I get the following console output: pdfTeX warning (dest): name (table1.1.1} has been referenced but does not exist, replaced by a fixed one. texify: pdflatex.exe failed for some reason (see log file). – ecsi May 11 '15 at 10:50
  • Pass, I think you need to file a bug report on this. addtolist is marked experimental, but this ought to work. Not quite sure what is missing. – daleif May 11 '15 at 11:08
  • Hmm, I think it is because addtolist locally nulls \@makecaption which hyperref messes with to add the anchor that in this case is missing. – daleif May 11 '15 at 11:13

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.