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 have several problems with my latex book:

  1. I want the appendix bookmark as an extra bookmark on part level, now it is under my second part. In the table of content its is right, but not on the pdf bookmarks.

  2. The bookmark link of the Index is not correct, if I click on it, I go to the list of tables, not to the Index

  3. The page numbering is totaly wrong. How can I do big roman Letters for the frontmatter and normal letters on the mainmatter without getting problems with the linking? I want that page numbers on every page, now there is no number or totally wrong.

My Latex - Code:

\documentclass{book}
\usepackage{geometry}

\geometry{left=4cm,right=3cm, top=2cm, bottom=2cm} 

\usepackage{titlesec}
\titlespacing*{\chapter}{0pt}{-30pt}{20pt}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\usepackage[ngerman]{babel}
\usepackage{mathptmx}
\usepackage{helvet}
\usepackage{wallpaper}
\usepackage{color}
\usepackage[final]{pdfpages} 
%,bookmarksopenlevel={1}
%\usepackage[bookmarks=true,bookmarksopen=true,bookmarksnumbered=true,colorlinks=true,linkcolor=black]{hyperref}
\usepackage[colorlinks,linkcolor=black,bookmarksopen=false]{hyperref}
\hypersetup{ 
  pdftitle={test},
  pdfauthor={\textcopyright test},
  pdfsubject={test}, 
  pdfkeywords={test}, 
  }

\usepackage{xcolor,bookmark}
\usepackage{scrextend}
\usepackage{titlepic}
\usepackage{shorttoc}
\usepackage{courier}
%
\usepackage{type1cm}         



\usepackage{makeidx}         % allows index generation

\usepackage{graphicx}        % standard LaTeX graphics tool
                             % when including figure files
\usepackage{multicol}        % used for the two-column index
\usepackage[bottom]{footmisc}% places footnotes at page bottom
\usepackage{tocstyle}
\usetocstyle{allwithdot} 


\makeindex             % used for the subject index
                       % please use the style svind.ist with
                       % your makeindex program
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}

\begin{document}
\author{test}
\bookmark[page=\thepage,rellevel=1,keeplevel,view={XYZ},bold,color=blue]{Cover}

\includepdf{cover} 
\pagestyle{empty}
\newpage

\section*{} 
\newpage
\huge
\textbullet \hspace{0.1cm} test \hspace{-0.1cm} \textbullet\\
\\
\vspace{7cm}
\\
\large
test test\\
\vspace{4cm}
\\
\bookmark[page=\thepage,rellevel=1,keeplevel,view={XYZ},bold,color=blue]{Info}
Die Verlagsseite


\frontmatter
\include{dedic}
\newpage\section*{} 
\include{foreword}
\newpage\section*{} 
\include{preface}
\newpage\section*{} 
\include{acknow}
\newpage\section*{} 
\include{acronym}
%
\
\shorttableofcontents{Inhalts\"ubersicht}{1}
\bookmark[page=15,rellevel=1,keeplevel,view={XYZ},color=red]{Inhalts\"ubersicht}
\bookmark[page=17,rellevel=1,keeplevel,view={XYZ},color=red]{Inhaltsverzeichnis}
\tableofcontents

%



\mainmatter
\include{part1} 
\include{chapter1}
\include{chapter2}
\include{part2}
\include{chapter3}
\include{chapter4}
\backmatter

\appendix 

\include{appendix}

\listoffigures
\newpage
\listoftables
\backmatter%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\include{glossary}
%\include{solutions}


\printindex
\addcontentsline{toc}{part}{Index}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\includepdf{ueberautor}
\includepdf{back}
\end{document}

I tried a lot and hard for it and I could find no solution - would be great, if you could help me. Thanks

share|improve this question
    
ok, thanks a lot for your answer, but now I have the following problem: If I click on the booksmark in the pdf file I get to the rigth page, but the problem is: Not to the top of e.g. the index, but the the "middle". So the entry "Index" is not readable, one has to scroll up, but I want have the following: Click on the bookmark Index and the Index appears, not scrolled to the middle or something like that thanks a lot again! –  Studentgerman Aug 16 '12 at 13:50
add comment

1 Answer

1. Appendix bookmark

Package bookmarks allows to restart the bookmark hierarchy at top level:

\bookmarksetup{startatroot}

If the appendix is something like

\chapter{Appendix}

then the entry in the table of contents is formatted as chapter, not as part. Instead of

\bookmarksetup{startatroot}
\chapter{Appendix}

something like the following can be used:

\cleardoublepage
\phantomsection
\addcontentsline{toc}{part}{\appendixname}
\chapter*{\appendixname}

Explanation, see 2.

2. Index bookmark

\printindex
\addcontentsline{toc}{part}{Index}

Then you get the page number from the end of the index in the table of contents. The bookmark also needs an anchor that can be set by \phantomsection.

\cleardoublepage
\phantomsection % anchor setting
\addcontentsline{toc}{part}{\indexname}
\printindex

3. Page bookmark links

The following example shows, how the correct absolute page numbers can be get from labels for use in \bookmark. I use package zref here for the labels and references, because it provides absolute page numbers and expandable extraction methods.

\documentclass{book}

\usepackage[ngerman]{babel}
\usepackage{xcolor}

\usepackage{titlesec}
\titlespacing*{\chapter}{0pt}{-30pt}{20pt}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\
  \thechapter}{20pt}{\Huge}

\usepackage[hidelinks,bookmarksopen=false]{hyperref}[2011/02/05]
\hypersetup{
  pdftitle={test},
  pdfauthor={\textcopyright test},
  pdfsubject={test},
  pdfkeywords={test},
}
\usepackage{bookmark}
\usepackage{shorttoc}

\usepackage{makeidx}         % allows index generation
\makeindex

\usepackage{tocstyle}
\usetocstyle{allwithdot}

\usepackage{zref-abspage}

\makeatletter
\newcounter{zpage}
\renewcommand*{\thezpage}{pagelabel\the\value{zpage}}
\newcommand*{\pagebookmark}[2][]{%
  \stepcounter{zpage}%
  \zref@labelbyprops{\thezpage}{abspage}%
  \zref@refused{\thezpage}%
  \bookmark[{%
    page=\zref@extractdefault{\thezpage}{abspage}{1},%
    view={XYZ},%
    #1%
  }]{#2}%
}
\makeatother

\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}

\author{test}

\begin{document}
\pagestyle{empty}
\hypersetup{pageanchor=false}

\pagebookmark[rellevel=1,keeplevel,bold,color=blue]{Cover}

\begin{center}
  \fbox{\bfseries\Huge Cover}
\end{center}
\newpage

\null\newpage % empty page

% Verlagsseite
\pagebookmark[rellevel=1,keeplevel,bold,color=blue]{Info}
\begingroup
  \huge
  \textbullet \hspace{0.1cm} test \hspace{-0.1cm} \textbullet

  \vspace{7cm}

  \large   
  test test

  \vspace{4cm}

  Die Verlagsseite
  \newpage
\endgroup


\frontmatter
\pagestyle{headings}% or whatever
\hypersetup{pageanchor=true}

\chapter*{Dedication}

\chapter*{Foreword}

\chapter*{Preface}

\chapter*{Acknowlegements}

\cleardoublepage
\pagebookmark[rellevel=1,keeplevel,color=red]{Inhalts\"ubersicht}
\shorttableofcontents{Inhalts\"ubersicht}{1}

\cleardoublepage
\pagebookmark[rellevel=1,keeplevel,color=red]{Inhaltsverzeichnis}
\tableofcontents

\mainmatter

\part{First part}
\chapter{First chapter}
\index{first}
\chapter{Second chapter}
\index{second}
\part{Second part}
\chapter{Third chapter}
\index{third}
\chapter{Fourth chapter}
\index{fourth}

\backmatter

\appendix

\bookmarksetup{startatroot}
\chapter{\appendixname}

\listoffigures
\listoftables 

\cleardoublepage
\phantomsection 
\addcontentsline{toc}{part}{\indexname}
\printindex

\end{document}

The bookmark window:

Bookmarks

4. Empty pages

\section*{}\newpage

is not the best way to create empty pages, the risk of side effects because of the complex \section is too large. A simple \null is sufficient to get something invisible on the page:

\null\newpage

Headers/footers can also be suppressed, if needed:

\begingroup
  \thispagestyle{empty}
  \null
  \newpage
\endgroup

But in the cases above often a simple

\cleardoublepage

might suffice.

5. Invisible links

Because the document is intended for printing, invisible links make sense. Since hyperref 2011/02/05 v6.82a option hidelinks is added for this purpose.

share|improve this answer
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.