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.

This is a follow-up question to PDF bookmark customization

How is it possible, to set in an report/scrreprt all chapters with bold bookmarks in the pdf bookmarks? I've found a discussion about it (in german: renewcommand chapter), however, the MWE from there is not compiling with pdflatex (TeX Live 2012)

\documentclass{scrbook}
\usepackage[ngerman]{babel}
\usepackage{blindtext}
\usepackage[pdftex]{hyperref}
\usepackage[pdftex,open=true]{bookmark}
\makeatletter

\renewcommand{\@chapter}{}
\let\@chapter\chapter

\renewcommand{\chapter}{%
\@ifstar {\@chapter}{\@dblarg\@chapter}%
}
\newcommand*{\@chapter}[2][]{%
\bookmarksetup{bold=true}%
\@chapter[#1]{#2}%
\bookmarksetup{bold=false}%
}

\makeatother

\begin{document}
\tableofcontents
\chapter{Einleitung}
\section{Test}
\blindtext
\chapter[Kurze Überschrift]{Lange Überschrift}
\section{foobar}
\blindtext
\end{document}
share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Option addtohook helps:

\usepackage{bookmark}
\bookmarksetup{
  open,
  addtohook={%
    \ifnum\bookmarkget{level}<1 %
      \bookmarksetup{bold}%
    \fi
  },
}

Some remarks:

  • pdfTeX in PDF mode is detected automatically by hyperref and bookmark.
  • I have put option open in \bookmarksetup. This way \usepackage{bookmark} do not need options (reducing option clash conflicts).
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.