Hyperref automatically generates bookmarks for document divisions (part, chapter, section) in the PDF output. When opening a document with a browser we can use anchor syntax to link to a specific page or section:
http://website.net/document.pdf#page=4
http://webiste.net/document.pdf#introduction
But what is the format of the default hyperref bookmarks? It's not always their name as it appears in a standard pdf viewer. I haven't been able to find either (a) hyperref's naming procedure or (b) a way of parsing PDFs to display the actual anchor names.
I've found a few Q&A on how to change hyperref's defaults bookmarks. But I want to use the default bookmarks.
My test document below shows the problem. It has parts and chapters. If I open it in a browser using:
/path/to/file/document.pdf#Introduction
The document correctly opens at the introduction chapter page. So linking to divisions works in principle. But I can't find the bookmarks names for other parts and chapters. For instance, the following fail and land me on the title page instead:
/path/to/file/document.pdf#Baby
/path/to/file/document.pdf#Baby Logic
/path/to/file/document.pdf#Baby%20Logic
/path/to/file/document.pdf#Part%20I%20Baby%Logic
/path/to/file/document.pdf#I%20Baby%20Logic
/path/to/file/document.pdf#Syntax%20%and%semantics
Even though some of these are the bookmarks that appear in a PDF viewer.
Added challenge: some sections within different chapters have the same name, and some chapters within different parts have the same name. I don't know how hyperref handles bookmarking those.
Here is the test document:
\documentclass[a4paper]{memoir}
\RequirePackage{hyperref}
\hypersetup{breaklinks,
bookmarks,
bookmarksopen,
bookmarksopenlevel=1,
colorlinks,
urlcolor=dark-gray}
%linkcolor=reflex-blue}
\begin{document}
% title page
{\Huge Title of the book}
\frontmatter
\newpage
\tableofcontents*
\mainmatter
\chapter{Introduction}
\section{dummy section 1}
\section{dummy section 2}
\section{FAQ}
\part{Baby Logic}
\chapter{Syntax and semantics}
\section{dummy section 3}
\section{dummy section 4}
\section{FAQ}
\chapter{Exercises}
\section{dummy section 5}
\part{Advanced Logic}
\chapter{Syntax and semantics}
\section{dummy section 6}
\section{dummy section 7}
\section{FAQ}
\chapter{Exercises}
\end{document}