1

I am trying to insert a pdf document in LaTeX using \includepdf[pages={1}]{myfile.pdf} But the inserted .pdf loses all its hyperreferences. Is there a way to retain hyperrefs while doing so?

myfile.tex

\begin{document}
\tableofcontents
\chapter{a}
\section{a}
\chapter{b}
\section{b}
\end{document}

Now when generated, myfile.pdf has clickable links to chapters and sections

maindoc.tex

\begin{document}
\tableofcontents

\chapter{abc}
\includepdf[pages={-}]{myfile.pdf}

\end{document}

But when included as .pdf, the links are lost.

dk3896s
  • 11
  • 2
  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Sep 03 '14 at 11:28
  • 3
    I think the short answer is 'no', not because of a limitation of TeX but one of the PDF format. The way that links are specified means that they can't 'carry over' when an entire PDF is included in another one. You don't outline the full situation: can you not use the source for the included PDF directly in the larger document? – Joseph Wright Sep 03 '14 at 11:31
  • Hi @ChristianHupfer. The pdf to be inserted is created using latex So myfile.tex \begin{document} \tableofcontents

    \chapter{a} \section{a}

    \chapter{b} \section{b}

    \end{document}

    and main file says \begin{document} \tableofcontents

    \chapter{abc} \includepdf[pages={-}]{myfile.pdf} \end{document}

    But now the sections inside the pdf are no more clickable

    – dk3896s Sep 03 '14 at 11:40
  • @dk3896s: Please add that code to your original post above. If the included document is to be generated with latex/pdflatex at all, the usage of xr package is of use –  Sep 03 '14 at 11:43
  • @JosephWright All my tex files need to be generated from Matlab. I am writing an m-script to include many such pdfs under the larger document. Each of these pdfs is generated seperately via m-script too. So i guess its too complex to have the entire code under one document – dk3896s Sep 03 '14 at 11:51
  • You could try the pax package http://www.ctan.org/pkg/pax. – Ulrike Fischer Sep 03 '14 at 12:53

0 Answers0