I need to center the title of the parts in the toc. I'm trying these two approaches:
\documentclass{article}
\usepackage{hyperref}
\usepackage{tocloft}
\cftpagenumbersoff{part}
\begin{document}
\tableofcontents
\addcontentsline{toc}{part}{\centerline{Part A}}
\addcontentsline{toc}{section}{Section A}
\addcontentsline{toc}{part}{\hfill{Part B}\hfill}
\addcontentsline{toc}{section}{Section B}
\end{document}
When the PDF is generated, the bookmarks have some of problems:
- Part A appears in the bookmarks as "toPart A".
- Part B appears hierarchically under Section A.
- Part B appears correctly in the bookmarks, but it's not correctly centered in the page.
What can I do to solve this problem? Thank you!
\hfill
etc. is not allowed in the bookmarks. Why are you generating such entries manually?