2

I'm using

\usepackage[numbered]{bookmark}

to get numbered bookmarks for the chapters of my book and that works as expected. However, I'd like to change the style and have the bookmarks look like "42. Cool Chapter" instead of "42 Cool Chapter", i.e. I want to add a dot after the chapter number (without changing the document itself, of course). I guess this can be done with the styles and/or hooks that the bookmark package offers, but my TeX fu isn't good enough to extract from the documentation what I have to do. I'd be happy if someone could show me how to do this.

(In case you're wondering whether it is a wise decision to add dots there: This is what the publisher wants.)

EDIT: The setup for my book is too complicated to show here, but if people insist on having a MWE, I guess I can take it from here:

\documentclass{book}
\usepackage{hyperref}
\usepackage[numbered]{bookmark}
\begin{document}
\chapter*{Preface}
\addcontentsline{toc}{chapter}{Preface}
Some text
\chapter{First chapter}
More text
\chapter{Second chapter}
Even more text
\end{document}

I now have three bookmarks. I want the first one to remain untouched while the second one should be "1. First chapter" and the third one should be "2. Second chapter".

3
  • 2
    I don't wonder why you want this, I wonder why you neither show a minimal example that can be used for tests and not even mention the class and how chapters are numbered in the text. Aug 7, 2020 at 8:04
  • what about sections in the bookmarks? Should they get dots too? Aug 7, 2020 at 8:48
  • No, there are only chapter bookmarks. If there are any sections in my book, I use \section* and I also have \setcounter{secnumdepth}{0}.
    – Frunobulax
    Aug 7, 2020 at 8:53

1 Answer 1

1
\documentclass{book}
\usepackage{hyperref}
\usepackage[numbered]{bookmark}
\makeatletter
 \renewcommand\Hy@numberline[1]{#1. }
\makeatother
\begin{document}
\chapter*{Preface}
\addcontentsline{toc}{chapter}{Preface}
Some text
\chapter{First chapter}
More text
\chapter{Second chapter}
Even more text
\end{document}

enter image description here

You must log in to answer this question.

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