Take the 2-minute tour ×
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.

I'm importing some pdf files, to my document.

\pdfbookmark{First}{r01}

\includepdf[pages=-,pagecommand={}]{inc/r01.pdf}

\pdfbookmark{Second}{r02}
\includepdf[pages=-,pagecommand={}]{inc/r02.pdf}

These are book chapters, with their own formatting - it's a reason, why I can't use \section there.

I don't want to have any table of contents in my document, just the chapters names in the bookmarks area together with the numbering. How to do this?

share|improve this question
add comment

1 Answer 1

Using the hyperref package, your code should work to produce the bookmarks. Alternatively, the smaller bookmark package provides the same interface for just PDF bookmarks. Remember that you need to compile your document at least twice in order for the PDF bookmarks to be accurate.

\documentclass{article}
\usepackage{pdfpages}% http://ctan.org/pkg/pdfpages
\usepackage{hyperref}% http://ctan.org/pkg/hyperref
%\usepackage{bookmark}% http://ctan.org/pkg/bookmark
\begin{document}
% file.pdf contains 8 pages of \lipsum[1-40] in article document class
\pdfbookmark{1 First}{r01}
\includepdf[pages=1-2]{file.pdf}

\pdfbookmark{2 Second}{r02}
\includepdf[pages=3-4]{file.pdf}

\pdfbookmark{3 Third}{r03}
\includepdf[pages=5-6]{file.pdf}

\pdfbookmark{4 Fourth}{r04}
\includepdf[pages=7-8]{file.pdf}

\end{document}

enter image description here

share|improve this answer
    
Adding bookmarks to the document works fine, but this is not the question. The question is, how to automatically number the bookmarks, as opposed to your example, where you put the numbers by hand. –  Pawel Oct 14 '11 at 16:53
    
Do you have access to the .aux file that produced r0?.pdf? Even more desirable, do you have access to the LaTeX code that produced r0?.pdf? –  Werner Oct 14 '11 at 16:54
    
Unfortunately, no. r0?.pdfs were exported from MS Word. –  Pawel Oct 14 '11 at 19:25
    
Well, unfortunately you'll need some way to process the source in order to extract this information. Word documents are binary and LaTeX would not be able to extract the contents nor know which components represent a chapter or just plain text. You could convert the source from Word to (La)TeX using Word2TeX. Of course, this heavily depends on the contents of the Word for it to be effective. –  Werner Oct 14 '11 at 19:29
    
I don't care about sections etc inside imported pdfs, I just put them as they are and add bookmarks to have a quick access to them. Therefore, includepdf + pdfbookmarks are quite enough - except the fact, that they don't automatically add bookmarks numbers. Will I have to type the numbers by hand? I wish there is more elegant solution. –  Pawel Oct 14 '11 at 20:12
show 1 more comment

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.