Agrupe marcadores de capítulo em marcadores adicionados separados

Agrupe marcadores de capítulo em marcadores adicionados separados

Estou projetando um livro com um ToC elaborado. Eu gostaria de manter o sumário como está, mas gostaria de tornar os marcadores no PDF um pouco menos complicados, agrupando os capítulos.

MWE:

\usepackage[utf8]{inputenc}
\usepackage[hidelinks, bookmarksopen=false]{hyperref}
\usepackage{bookmark}

\title{Question PDF bookmarks}
\author{Alex Dijk}
\date{April 2022}

\begin{document}

\chapter{1 jan}First January lecture
\chapter{2 jan}Another January lecture
\chapter{3 jan}Another January lecture
\chapter{4 jan}Another January lecture
\chapter{5 jan}Another January lecture
\chapter{6 jan}Another January lecture
\chapter{7 jan}Another January lecture
\chapter{8 jan}Another January lecture
\chapter{1 feb}First February lecture
\chapter{2 feb}Another February lecture
\chapter{3 feb}Another February lecture
\chapter{4 feb}Another February lecture
\chapter{5 feb}Another February lecture
\chapter{6 feb}Another February lecture
\chapter{7 feb}Another February lecture
\chapter{8 feb}Another February lecture

\end{document} 

Então, aqui, gostaria de adicionar marcadores chamados 'Janeiro' e 'Fevereiro' ao PDF resultante (mas não ao ToC). Esses marcadores adicionais precisam então ser fechados por padrão, sob o qual todos os capítulos individuais de janeiro e fevereiro são ordenados. Como faço isso?

Responder1

Com um hyperref atual você pode fazer isso (inputenc não é mais necessário em um latex atual, utf8 é o padrão há alguns anos):

\documentclass{book}
\usepackage[hidelinks, bookmarksopen=false]{hyperref}
\usepackage{bookmark}

\title{Question PDF bookmarks}
\author{Alex Dijk}
\date{April 2022}

\begin{document}

\bookmark[level=part,dest=\hyperget{anchor}{chap:jan}]{January}
\chapter{1 jan}\label{chap:jan}First January lecture
\chapter{2 jan}Another January lecture
\chapter{3 jan}Another January lecture
\chapter{4 jan}Another January lecture
\chapter{5 jan}Another January lecture
\chapter{6 jan}Another January lecture
\chapter{7 jan}Another January lecture
\chapter{8 jan}Another January lecture
\cleardoublepage
\bookmark[level=part,dest=\hyperget{anchor}{chap:feb}]{February}
\chapter{1 feb}\label{chap:feb}First February lecture
\chapter{2 feb}Another February lecture
\chapter{3 feb}Another February lecture
\chapter{4 feb}Another February lecture
\chapter{5 feb}Another February lecture
\chapter{6 feb}Another February lecture
\chapter{7 feb}Another February lecture
\chapter{8 feb}Another February lecture

\end{document} 

insira a descrição da imagem aqui

Em sistemas mais antigos você deve criar destinos manualmente:

\documentclass{book}
\usepackage[hidelinks, bookmarksopen=false]{hyperref}
\usepackage{bookmark}

\title{Question PDF bookmarks}
\author{Alex Dijk}
\date{April 2022}

\begin{document}

\hypertarget{jan}{}
\bookmark[level=part,dest=jan]{January}
\chapter{1 jan}First January lecture
\chapter{2 jan}Another January lecture
\chapter{3 jan}Another January lecture
\chapter{4 jan}Another January lecture
\chapter{5 jan}Another January lecture
\chapter{6 jan}Another January lecture
\chapter{7 jan}Another January lecture
\chapter{8 jan}Another January lecture
\cleardoublepage
\hypertarget{feb}{}
\bookmark[level=part,dest=feb]{February}
\chapter{1 feb}\label{chap:feb}First February lecture
\chapter{2 feb}Another February lecture
\chapter{3 feb}Another February lecture
\chapter{4 feb}Another February lecture
\chapter{5 feb}Another February lecture
\chapter{6 feb}Another February lecture
\chapter{7 feb}Another February lecture
\chapter{8 feb}Another February lecture

\end{document} 

informação relacionada