I am looking to change the title which displays in the PDF bookmark tabs to match the format of how I have my chapters listed.
\documentclass[]{report}
\usepackage[hidelinks]{hyperref} %to add hyperlinks throughout document
\usepackage{titlesec} %reformatting the chapter headings
\titleformat{\chapter}[block]
{\normalfont\LARGE\bfseries\centering}{CHAPTER \thechapter}{0em}{:\hspace{2mm}}
\begin{document}
\chapter{THE BEGINNING}
Hello.
\chapter{THE END}
Goodbye.
\end{document}
What i currently have is:
with the option of creating bookmarks of:
What I want my bookmarks to look like is identical to how the chapter title is formatted:
I have found that I can input \pdfbookmark[0]{THE BEGINNING}{name1}
, but I would need to remove the bookmarks created by hyperref
(which would not be ideal if I have multiple chapters, sections, subsections, etc., and have to input them all manually using this method.)
Will I have to work with changing \chapter{THE BEGINNING}
to \chapter{CHAPTER \thechapter: THE BEGINNING}
, then worry about removing the chapter number from 'CHAPTER 1: THE BEGINNING' from the title and ToC?
UPDATE:
The best option I found is:
How to remove chapter numbering without removing it from tableofcontents
I can use the code
\newcommand{\mychapter}[2]{
\setcounter{chapter}{#1}
\setcounter{section}{0}
\chapter*{#2}
\addcontentsline{toc}{chapter}{#2}}
I use TeXMaker, and I like the structure is provides for opening/organizing subfiles (i.e. using \input{...}
). To keep this as organized as possible, I resorted to the following:
-
Create
.tex
file titledChapter.1.THEBEGINNING
-
This subfile will include
\mychapter{1}{CHAPTER \thechapter: THE BEGINNING}
-
My main document will include
\input{Chapter.1.THEBEGINNING}
This works well enough…although still looking for better options.
Best Answer
This example provides a small modification of Werner's solution. Instead of patching the internal
\Hy@writebookmark
the redefinition of\numberline
is done in the bookmark hookaddtohook
of packagebookmark
: