3

I have a set of pdf files (without the latex source) which I merged into a larger pdf file. Each individual pdf file is an article with sections. I created a set of bookmarks for the larger pdf which point to each of the sections in each of the constituent smaller pdf files using the bookmarks package.

\bookmark[level=2,page=6,view={FitH 842}]{<Section>}
\bookmark[level=3,page=6,view={FitH \calc{\paperheight-\topmargin-8in} null}]{<Subsection1>}
\bookmark[level=3,page=8,view={FitH \calc{\paperheight-\topmargin-7in} null}]{<Subsection2>}
\bookmark[level=3,page=11,view={FitH \calc{\paperheight-\topmargin-2in} null}]{<Subsection3>}
\bookmark[level=3,page=13,view={FitH \calc{\paperheight-\topmargin-7in} null}]{<Subsection4>}

Unfortunately I could not use these bookmarks to create the ToC. To create the ToC I did the following

\tableofcontents
\clearpage\phantomsection
\addcontentsline{toc}{chapter}{<Chaptername N>}
\includepdf[pages=-,linktodoc=false]{<file N>.pdf}
\clearpage\phantomsection
\addcontentsline{toc}{chapter}{<Chaptername N+1>}
\includepdf[pages=-,linktodoc=false]{<file N+1>.pdf}

The issue I am facing now is that the contents of the ToC are being added (prepended) to the bookmarks data containing the the bookmarks I had manually added.

My question is: How can I keep the ToC contents from being added to the bookmarks?

More info:

The ToC data comes before the bookmarks data (the bookmark commands refer to page numbers of the fully merged pdf file). The file structure is as follows:

<ToC data>
\bookmarksetup{startatroot}
\bookmarks ...
  • I need to add the bookmarks because I cannot add the sections of each individual pdf file to the ToC (since I do not have the LaTeX sources)

  • The reason I want a separate contents page at the very beginning is because some lightweight pdf readers (such as the google chrome's native pdf reader) do not utilize bookmarks)

This is a continuation of the question I had previously asked at How do I use LaTeX to create a table of contents for a set of pdf files which I am merging into a single large pdf?

0

1 Answer 1

5

You can select to which depth the sectioning commands (part, chapter, section, subsection, etc.) are added as PDF bookmarks using the depth package option. To complete remove them choose the value -2 or lower (-1 is for parts, 0 for chapters, ...).

The following example shows the usage. Here only the manually added bookmark is added:

\documentclass{report}
\usepackage[depth=-1]{bookmark}
\begin{document}
\tableofcontents
\bookmark[level=2,page=2,view={FitH 842}]{Section}
\chapter{Test}
\section{test}
\subsection{test}
\subsubsection{test}
\end{document}
1
  • Works perfectly. Thanks a ton. I need to read the documentation for the packages more carefully. Commented Mar 9, 2011 at 2:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .