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.
\documentclass[12pt,a4paper]{mwrep}
\usepackage{polski}
\usepackage[cp1250]{inputenc}
\usepackage{pdfpages}
\usepackage[hidelinks]{hyperref}
\renewcommand\baselinestretch{1.5}

\usepackage{etoolbox}
\patchcmd{\thebibliography}{*}{}{}{}

\makeatletter
\pretocmd{\tableofcontents}{%
  \if@openright\cleardoublepage\else\clearpage\fi
  \pdfbookmark[0]{\contentsname}{toc}%
}{}{}%
\makeatother

\begin{document}
%\begin{titlepage}
%\includepdf[pages=1-]{titlepage.pdf}
%\end{titlepage}
\tableofcontents
\chapter{A}
a\dots
\chapter{B}c\dots
\chapter{D}
d\dots
\chapter{E}
e\dots

\begin{thebibliography}{999}
\bibitem{bib1}Author:
\emph{Title},
Publisher, Year
\end{thebibliography}
\end{document}

Everything works good, I have nice links in pdf viewer. But when I uncomment three lines with includepdf I got errors when trying to compile. titlepage.pdf contains two pages but I don't think this is relevant.

Second question, how can I add something to bookmars (generated by hyperref)? I want to add ToC as well as first page of titlepage.pdf.

Also, adding titlepage.pdf brokes page numeration in pdf viewer (bookmarks). When I try to go to page 7, I to to page 5 instead. Can it be fixed? (I know it is the result of adding two extra pages at the beginning).

Also, hyperref changes Polish letters.
I have chapter Wstęp but in bookmarks there is Wstep.
Can it be fixed?

EDIT:
Bookmark to ToC solved.

EDIT 2:
One more thing that I need is adding included pdf's first page to bookmarks.

share|improve this question
    
As for the Polish diacritics in pdf bookmarks: AFAIR, you can't get them, since adobe reader (or at least its older versions) displays bookmarks with a built-in font with very small repertoire of characters. So substituting "Wstep" for "Wstęp" is perfectly reasonable. (Although I'm by no means expert as far as pdf format goes - this may as well be wrong nowadays, pdf wizards please correct me if its the case!) –  mbork Jul 13 '11 at 23:22
    
@mbork: Yes, you're wrong. :) @Ichibann: Pass unicode option to hyperref package, but you possibly should convert your doc to UTF-8 before (and obviously change then inputenc option to utf8). –  przemoc Jul 14 '11 at 0:14
    
I converted my documents to utf8 in Notepad++, but now LEd wont work with them :(. It displays WstÄ™p instead of Wstęp (but compiles correctly) –  Ichibann Jul 14 '11 at 0:25
    
Is LEd maintained even at all now? By looking at its page it looks like it is pretty dead. Currently we are working on: adding support for Unicode and UTF-7, UTF-8, UTF-16, UTF-32 encodings,... Notepad++ isn't best tool for conversion, because it's damn easy to screw there encoding (BTW you should go w/o BOM). Also add \usepackage[T1]{fontenc} to your preamble apart from fixed inputenc setting. You may also go with T1,OT4, but it is more tricky if you use some other fonts, thus it requires switching via \fontencoding{T1}. Gain is only in a few KBs, so I suggest sticking just to T1. –  przemoc Jul 14 '11 at 0:31
    
I think Notepad++ didn't screw anything here. What LaTeX editor supports UTF8? –  Ichibann Jul 14 '11 at 0:33
show 3 more comments

1 Answer

up vote 4 down vote accepted

If the "errors" are like

pdfTeX warning
 (ext4): destination with the same identifier (name{page.1}) has been already used, duplicate ignored

then they are solved by saying

\begin{document}
\pagenumbering{Alph}
\begin{titlepage}
\includepdf[pages=1-]{titlepage.pdf}
\end{titlepage}
\pagenumbering{arabic}
\tableofcontents

The reason is that hyperref finds two "page 1", which is not the case if we order LaTeX to number with letters the first two pages.

share|improve this answer
    
That worked :). Can you help me with bookmark to included pdf? –  Ichibann Jul 14 '11 at 0:06
1  
You can just add a \pdfbookmark{Title page}{} before \includepdf. –  egreg Jul 14 '11 at 7:13
add 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.